PDB_To display the main Container name
### To display the main Container name.
SQL> show con_name;
CON_NAME
------------------------------
CDB$ROOT
SQL>
### To display the All the Container names which is under CDB ROOT Folder.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBPRIM READ WRITE NO
4 PDBPRIM2 READ WRITE NO
SQL>
### To open Pluggable Database folder ( SUB Container name = PDBPRIM).
SQL> alter session set container=PDBPRIM;
Session altered.
### To display the main Container name.
SQL> show con_name;
CON_NAME
------------------------------
PDBPRIM
SQL>
### To display the All the Container names which is under PDBPRIM Folder.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------- ------------------- ----------
3 PDBPRIM READ WRITE NO
### To SUTDOWN the Pluggable database PDBPRIM from READ WRITE to MOUNTED Status.
SQL> shutdown immediate;
Pluggable Database closed.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------- ----------------- ----------
3 PDBPRIM MOUNTED
## To start the Pluggable DB, The Mode will be changed from MOUNTED WRITE to READ WRITE YES
SQL> startup open restrict
Pluggable Database opened.
SQL> show con_name;
CON_NAME
------------------------------
PDBPRIM
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ---------------- ------------------ ----------
3 PDBPRIM READ WRITE YES
### To open Pluggable Database folder ( SUB Container name = PDBPRIM2).
SQL> alter session set container=PDBPRIM2;
Session altered.
SQL> show con_name;
CON_NAME
------------------------------
PDBPRIM2
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------ ----------------- ----------
4 PDBPRIM2 READ WRITE NO
SQL> shutdown immediate;
Pluggable Database closed.
## Once shutdown the Pluggable DB, The Mode will be changed from READ WRITE to MOUNTED
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ - ----------
4 PDBPRIM2 MOUNTED
## To start the Pluggable DB, The Mode will be changed from MOUNTED WRITE to READ WRITE YES
SQL> startup open restrict
Pluggable Database opened.
SQL> show con_name;
CON_NAME
------------------------------
PDBPRIM2
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 PDBPRIM2 READ WRITE YES
## To Rename the pluggable database PDBPRIM2 to PDBPRIM3
SQL> alter pluggable database PDBPRIM2 rename global_name to PDBPRIM3;
Pluggable database altered.
SQL> show con_name;
CON_NAME
------------------------------
PDBPRIM3
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ ----------
4 PDBPRIM3 READ WRITE YES
SQL> shutdown immediate;
Pluggable Database closed.
SQL> show con_name;
CON_NAME
------------------------------
PDBPRIM3
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ ----------
4 PDBPRIM3 MOUNTED
SQL> alter pluggable database PDBPRIM3 rename global_name to PDBPRIM2;
alter pluggable database PDBPRIM3 rename global_name to PDBPRIM2
*
ERROR at line 1:
ORA-01109: database not open
SQL> startup open restrict
Pluggable Database opened.
SQL> alter pluggable database PDBPRIM3 rename global_name to PDBPRIM2;
Pluggable database altered.
SQL> show con_name;
CON_NAME
------------------------------
PDBPRIM2
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- ----------
4 PDBPRIM2 READ WRITE YES
SQL> shutdown immediate;
Pluggable Database closed.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ ----------
4 PDBPRIM2 MOUNTED
SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> show con_name;
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ - ------------------ ----------
2 PDB$SEED READ ONLY NO
3 PDBPRIM MOUNTED
4 PDBPRIM2 MOUNTED
SQL>
Comments
Post a Comment