Multitenant - Create Common Users in CDB and PDB
sqlplus / as sysdba
SQL> CREATE USER C##USER1 IDENTIFIED BY oracle CONTAINER=ALL;
User created.
SQL> GRANT CREATE SESSION TO C##USER1 CONTAINER=ALL;
Grant succeeded.
oracle@srv3:/u01/app/oracle/product/12.2.0/dbhome_1/network/admin> sqlplus sys/system123@SMRCDB as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Aug 13 18:38:46 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select name,open_mode,database_Role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
SMRCDB READ WRITE PRIMARY
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLM1 MOUNTED
5 PLM2 READ WRITE NO
6 PLM4 READ WRITE NO
8 PLM5 READ WRITE NO
SQL> connect C##USER1/oracle@SMRCDB
Connected.
SQL> connect C##USER1/oracle@PLM2
Connected.
- Create common user in CDB and connect it from PDB database
sqlplus / as sysdba
SQL> CREATE USER C##USER1 IDENTIFIED BY oracle CONTAINER=ALL;
User created.
SQL> GRANT CREATE SESSION TO C##USER1 CONTAINER=ALL;
Grant succeeded.
oracle@srv3:/u01/app/oracle/product/12.2.0/dbhome_1/network/admin> sqlplus sys/system123@SMRCDB as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Aug 13 18:38:46 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select name,open_mode,database_Role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
SMRCDB READ WRITE PRIMARY
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLM1 MOUNTED
5 PLM2 READ WRITE NO
6 PLM4 READ WRITE NO
8 PLM5 READ WRITE NO
SQL> connect C##USER1/oracle@SMRCDB
Connected.
SQL> connect C##USER1/oracle@PLM2
Connected.
No comments:
Post a Comment