Wednesday, September 7, 2016

Connect to a Pluggable Oracle 12c Database

Scenario: Trying to connect to a pluggable database in Oracle 12c from a Client like SQL Developer. To connect from a remote client, we would require the following details,

Host name: This is the host name of your database server

Service name:  This is the service name of your database. 

Port number: The port number to connect to database.

The host, port and service name can be found by going to the app folder. That is you have to navigate to app > oracle > product > 12.1.0 > dbhome_1 > NETWORK > ADMIN > tnsnames.ora

Inside the tnsnames.ora file you can find a entry to your server installation as below, 

Click to Enlarge
from this you can copy details to your SQL Developer or other connections, 


This connection remember will be your container database. To find the names of your pluggable database you can run the following query,

SELECT NAME, OPEN_MODE FROM V$PDBS;


Now if the pluggable database is Open status, you can use the same connection details replaced with pluggable database name in the connection as below,


i.e only the service name differs from the container database.