← PDB & Multitenant
Oracle · PDB & Multitenant

How to check the current container in Oracle Multitenant

Find which container your session is in and list all containers in the CDB, from SYS_CONTEXT and V$CONTAINERS.

Tested on12c18c19c21c23ai26ai

Find which container your session is in, and list every container in the CDB (root, seed, and PDBs).

-- Current container
SELECT SYS_CONTEXT('USERENV','CON_NAME') AS con_name,
       SYS_CONTEXT('USERENV','CON_ID')   AS con_id
FROM   dual;

-- All containers
SELECT con_id, name, open_mode
FROM   v$containers
ORDER  BY con_id;

-- Switch to a PDB for the rest of the session:
-- ALTER SESSION SET CONTAINER = <pdb_name>;
PDBMultitenantV$CONTAINERS