본문 바로가기

Database/Oracle

26 - [Oracle 19C] V$containers, cdb_pdbs

 

  • V$CONTAINERS 

displays information about PDBs and the root associated with the current instance

 

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> select con_id,name,open_mode from V$CONTAINERS
  2  ;

    CON_ID NAME 		OPEN_MODE
---------- -------------------- ----------
	 1 CDB$ROOT		READ WRITE
	 2 PDB$SEED		READ ONLY
	 3 ORCLPDB		READ WRITE


SQL> alter session set container=orclpdb;

Session altered.

SQL> select con_id,name,open_mode from V$CONTAINERS;

    CON_ID NAME 		OPEN_MODE
---------- -------------------- ----------
	 3 ORCLPDB		READ WRITE

SQL>

SQL> alter session set container=cdb$root;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> col pdb_name for a15
SQL> select pdb_id,pdb_name, status from cdb_PDBS;

    PDB_ID PDB_NAME	   STATUS
---------- --------------- ----------
	 3 ORCLPDB	   NORMAL
	 2 PDB$SEED	   NORMAL

SQL>

 

 

 

  • The status column 

some imprtant status
NEW - The PDB has never been opened since it was created
NORMAL - The PDB is ready to be used.
UNPLUGGED - The PDB has been unplugged. The only operation that can be performed on it is DROP PLUGGABLE DATABASE.
RELOCATING: The PDB is in the process of being relocated to a different CDB.
RELOCATED: The PDB has been relocated to a different CDB.

 

the status column 

/* 
some imprtant status
NEW - The PDB has never been opened since it was created
NORMAL - The PDB is ready to be used.
UNPLUGGED - The PDB has been unplugged. The only operation that can be performed on it is DROP PLUGGABLE DATABASE.
RELOCATING: The PDB is in the process of being relocated to a different CDB.
RELOCATED: The PDB has been relocated to a different CDB.
*/

 

 

 

SQL> alter session set container=orclpdb;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
ORCLPDB


SQL> select pdb_id,pdb_name, status from cdb_PDBS;

    PDB_ID PDB_NAME	   STATUS
---------- ----------- ----------
	     3 ORCLPDB	   NORMAL

SQL>