-------How to create a normal user in Oracle 12c-------
[Email protected] ~]$ Sqlplus/as SYSDBA
Sql*plus:release 12.1.0.2.0 Production on Sun Nov 29 21:43:50 2015
Copyright (c) 1982, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit Production
With the partitioning, OLAP, Advanced Analytics and Real application testing options
--by Con_name you can see that the current login environment is the CDB root library, and the CDB contains a pluggable library named PDBORCL.
Sql> show Con_name PDBs;
Con_name
------------------------------
Cdb$root
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDBORCL Mounted
--Create public user admin, need to use C # #或者c # #作为该用户名的开头.
sql> Create User C # #admin identified by lxf$txx282534;
User created.
--If you create an error using the normal method
Sql> Create user admin identified by lxf$txx282534;
Create user admin identified by lxf$txx282534
*
ERROR at line 1:
Ora-65096:invalid common user or role name
--Create a common role that, like a public user, needs to use C # #或者c # #作为角色名的开头.
sql> Create role C # #admin01 Container=all;
Role created.
--Grant the DBA role to a common role with all PDB
Sql> Grant DBA to C # #admin01 Container=all;
Grant succeeded.
--grant public roles to public users, using a range of all PDB
Sql> Grant C # #admin01 to C # #admin Container=all;
Grant succeeded.
--Use public users to log into CDB and PDB separately to see if they are generic.
[Email protected] admin]$ sqlplus C # #admin/' lxf$txx282534 ' @pdborcl
Sql*plus:release 12.1.0.2.0 Production on Sun Nov 29 22:33:29 2015
Copyright (c) 1982, Oracle. All rights reserved.
Last Successful login Time:sun Nov 29 2015 22:31:12 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit Production
With the partitioning, OLAP, Advanced Analytics and Real application testing options
Sql> show Con_name;
Con_name
------------------------------
Pdborcl
[Email protected] admin]$ sqlplus C # #admin/' lxf$txx282534 '
Sql*plus:release 12.1.0.2.0 Production on Sun Nov 29 22:33:53 2015
Copyright (c) 1982, Oracle. All rights reserved.
Last Successful login Time:sun Nov 29 2015 22:33:29 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit Production
With the partitioning, OLAP, Advanced Analytics and Real application testing options
Sql> show Con_name;
Con_name
------------------------------
Cdb$root
There's no difference between creating a user in the PDB and creating a normal user.
Sql> create user test identified by test;
User created.
Sql> Grant create session to test;
Grant succeeded.
[Email protected] admin]$ sqlplus Test/[email protected]
Sql*plus:release 12.1.0.2.0 Production on Sun Nov 29 22:17:16 2015
Copyright (c) 1982, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit Production
With the partitioning, OLAP, Advanced Analytics and Real application testing options
Sql> Show User
USER is "TEST"
Sql> Show Con_name
Con_name
------------------------------
Pdborcl
Sql> exit
--Open the PDB
sql> Alter pluggable database PDBORCL open;
Pluggable database altered.
--Switch to the PDB container
Sql> alter session set CONTAINER=PDBORCL;
Session altered.
How to create a normal user in Oracle 12c