To know if you are connected to a Pluggable Database ( PDB) which is part of Container Database(CDB)
Execute below SQL script.
SELECT DECODE (SYS_CONTEXT ('Userenv', 'CDB_NAME')
,null,'NO','YES'),
Sys_Context('Userenv', 'CON_ID'),
Sys_Context('Userenv', 'CON_NAME')
From dual;
If connected to PDB you will get first column value as YES , a non zero number for second column and PDB Name in third column
If connected to a normal database (non CDB/PDB) you will get first column value as NO, zero for second column and Database Name in third column.
No comments:
Post a Comment