Tuesday, September 8, 2015

HOW CAN WE CONNECT TO PDB, AND CDB

Note: this must be done as “SYSDBA”.
How can we connect to the PDB?
There are 2 methods:
First method: connect to the CDB and then switch to the PDB by setting the container:
$ sqlplus system@apexdev

SQL> show con_name
CON_NAME
——————————
CDB$ROOT

SQL> alter session set container=apexdev_pdb1;

Session altered.

SQL> show con_name

CON_NAME
——————————
APEXDEV_PDB1



Second method: Modify your tnsnames.ora file by adding an entry for the PDB, based on the CDB entry.
Now, you can connect as usual to the PDB:

[oracle@ol6db1 oracle]$ sqlplus system@apexdev_pdb1

SQL*Plus: Release 12.1.0.1.0 Production on Tue Mar 24 20:37:38 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter password:
Last Successful login time: Thu Mar 19 2015 18:59:51 +01:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show con_name

CON_NAME
——————————
APEXDEV_PDB1
======================================================================



No comments:

Post a Comment