Database Reference
In-Depth Information
Connect to CDB Root and PDBs
Once the CDB and PDBs are created, the listener listens to the default services for CDB root and PDBs:
$lsnrctl status
....
Service " cpdb.kcloud.dblab.com " has 1 instance(s).
Instance "cpdb1", status READY, has 1 handler(s) for this
Service " pdb1.kcloud.dblab.com " has 1 instance(s).
Instance "cpdb1", status READY, has 1 handler(s) for this service...
Service " pdb2.kcloud.dblab.com " has 1 instance(s).
Instance "cpdb1", status READY, has 1 handler(s) for this service...
Service " pdb3.kcloud.dblab.com " has 1 instance(s).
Instance "cpdb1", status READY, has 1 handler(s) for this service...
...
The corresponding net service names for these database services are defined in the tnsnames.ora, which will
allow us to connect to the CDB root and PDBs. For example, we have the net service name 'cpdb' for the CDB root and
the pdb1 net service for the pdb1 PDB:
cpdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = knewrac-scan.kcloud.dblab.com
PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cpdb.kcloud.dblab.com ) ))
pdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = knewrac-scan.kcloud.dblab.com )
(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1.kcloud.dblab.com ) ))
To connect to the root (CDB$ROOT), you can use the operating system authentication that has the SYSDBA
administrative privilege:
$sqlplus / as sysdba or
SQLPLUS> connect / as sysdba
Or connect with the net service name for the root in the CDB:
SQLPLUS> connect system@cpdb
To connect to the PDB, you need to connect to a net service name with the PDB property. For example, to
connect the pdb1 PDB on SQLPLUS through the new service name pdb1:
SQLPLUS> connect system@pdb1
 
Search WWH ::




Custom Search