Listener and TNS entry of PDB database for connectivity in Oracle

Listener and TNS entry of PDB database for connectivity in Oracle

1. Check the status of listener in CDB Environment
Run the lsnrctl status command and got the following information.

lsnrctl status
..........................
..........................
Service "XE" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "xepdb1" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully

2. In above example show the instance name is XE and PDB name DB is used as Service “xepdb1”.
On listener reload after pdb created, we didn’t find any entry related to PDB then we need to manually add in listener.
NETMGR is utility used for making entry in Listener, we have to specify the three field:
1. Global DB Name: Name of the DB
2. Oracle home directory : Path of the Oracle home
3. SID: Instance name i.e “xe” in our example

For adding a new entry of PDB database in listener, we need to use the following link:
Manually Register in Listener

3. Now we need to create an entry in tnsnames.ora file for connectivity to PDB database.
NETCA utlitiy is used for making entry in tnsnames.ora file. You have to give SERVICE NAME and HOSTNAME.

You can put manually entry in tnsnames.ora

-- Go to location
Cd %ORACLE_HOME%\network\admin

--Make new TNS entry as shown in example:

PDB1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = NODE1.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pdb1)
)
)

Advertisements