You can query the CDB column in the V$DATABASE view to see if a database is CDB. If the current database is CDB, the column value will be YES, otherwise the CDB column value will be NO.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [oracle@orcldb ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Wed Nov 28 21:45:10 2018 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 CDB FROM V$DATABASE; CDB --- YES |
You can get information about container in CDB with a query like below.
Connect with SQLPlus, make sure you are in the root container, and then run the query.
1 2 3 4 5 | SQL> SHOW CON_NAME CON_NAME ------------------------------ CDB$ROOT |
1 2 3 4 5 6 7 8 | SQL> COLUMN NAME FORMAT A8 SQL> SELECT NAME, CON_ID, DBID, CON_UID, GUID FROM V$CONTAINERS ORDER BY CON_ID; NAME CON_ID DBID CON_UID GUID -------- ---------- ---------- ---------- -------------------------------- CDB$ROOT 1 659189539 1 780FA6F89C7572A1E0436797E40AC78D PDB$SEED 2 4026479912 4026479912 780FAE9C00377591E0436797E40AC138 ORCL 3 3718888687 3718888687 780F7543B8826B8BE0532300A8C0FBA1 |