Create an Oracle 12c user

Source: Internet
Author: User

Create an Oracle 12c user

Oracle 12c accounts can be divided into public accounts and local users. A common account is created under CDB and can be used by all PDB users. A local account can only be created in PDB.

Create a public user
Alter session set container = CDB $ ROOT;
Create user c # u02 identified by oracle container = all;
Create a local user
Alter session set container = pdb4;
Create USER u01 identified by oracle container = current;

SQL> SELECT USERNAME, CON_ID, USER_ID FROM CDB_USERS WHERE USERNAME = 'u01 ';
USERNAME CON_ID USER_ID
--------------------------------------------------
U01 4 105

Create a test account in CDB
1. The account created in CDB must start with C #.
Alter session set container = CDB $ ROOT;
SQL> create user orcl identified by;
Create user orcl identified by
*
ERROR at line 1:
ORA-65096: invalid common user or role name

SQL> create user p # orcl identified by;
Create user p # orcl identified by
*
ERROR at line 1:
ORA-65096: invalid common user or role name

SQL> create user c # a identified by;
User created.


SQL> select username from dba_users where username like 'C ##% ';
USERNAME
--------------------------------------------------------------------------------
C ##

--- Note that the local user cannot start with C #
Alter session set container = pdb4;
SQL> create user c # B identified by B;
Create user c # B identified by B
*
ERROR at line 1:
ORA-65094: invalid local user or role name

SQL> SELECT USERNAME, CON_ID, USER_ID FROM CDB_USERS WHERE USERNAME like 'C ##% 'ORDER BY USERNAME;
USERNAME CON_ID USER_ID
--------------------------------------------------
C ## BOSWLL 4 103
C ## BOSWLL 3 110
C ## BOSWLL 1 102
C ## BOSWLL 5 103
C ## U02 4 106
C ## U02 5 104
C ## U02 1 103
C ## U02 3 111

--- You cannot create a public user in pdb when creating a public user. You must create a public user in cdb.
SQL> alter session set container = pdb4;
Session altered.

SQL> create USER C # u02 identified by oracle container = all;
Create user c # u02 identified by oracle container = all
*
ERROR at line 1:

The ORA-65050: Common DDLs only allowed in CDB $ ROOT

Summary:
1. A public user must start with C #. A local user must start with a letter and cannot start with C #.
2 when creating a public user, it must be in the CDB $ ROOT
3. If a user or role already exists in PDB, the same account or role name cannot be created in CDB.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.