Connecting To Pluggable Database as SYSDBA

In Oracle container database architecture when you connect by default using bequeath protocol as SYSDBA you will connect against CDB$ROOT.

Is there a way to connect directly to a pluggable database as SYSDBA ?

Yes,

export ORACLE_PDB_SID=PDB3
sqlplus / as sysdba

as shown below:

In the past I used to switch to a pluggable database after accessing CDB$ROOT :

sqlplus / as sysdba

SQL> alter session set container=PDB3;

so no need for that with environment variable ORACLE_PDB_SID which will help a lot if you want to develop shell scripts to run against specific databases within the container.

Leave a comment