Connect to container database (cdb1)
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
Perform close instance operation in seed database (pdb$seed)
SQL> alter pluggable database pdb$seed close;
alter pluggable database pdb$seed close
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set "_oracle_script"=TRUE;
Session altered.
Perform close instance operation in seed database (pdb$seed)
SQL> alter pluggable database pdb$seed close immediate instances=all;
Pluggable database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
Open the pdb$seed database in read write mode
SQL> alter pluggable database pdb$seed open read write;
Pluggable database altered.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> alter session set container=PDB$SEED;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ WRITE NO
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
Create Pluggable Database (cdb1_pdb4) in Container Database (cdb1)
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- ----------
2 PDB$SEED READ WRITE NO
3 CDB1_PDB3 MOUNTED
create pluggable database cdb1_pdb4 admin user user1 identified by oracle
*
ERROR at line 1:
ORA-65081: database or pluggable database is not open in read only mode
Close the pdb$seed and open it in read only mode
SQL> alter pluggable database pdb$seed close immediate instances=all;
Pluggable database altered.
SQL> alter pluggable database pdb$seed open read only;
Pluggable database altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY
Set the parameter "_oracle_script" and create pluggable database (cdb1_pdb4)
SQL> alter session set "_oracle_script"=FALSE;
Session altered.
SQL> create pluggable database cdb1_pdb4 admin user user1 identified by oracle;
Pluggable database created.
SQL> alter pluggable database cdb1_pdb4 open;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------------- ----------
2 PDB$SEED READ ONLY NO
3 CDB1_PDB3 MOUNTED
4 CDB1_PDB4 READ WRITE NO
SQL> alter session set container=cdb1_pdb4;
Session altered.
Conclusion: pdb$seed is template database for new pluggable databases in container database (cdb).
Nice Article about PDB$SEED.. thanks Sir.
ReplyDelete