Sample listener.ora and tnsnames.ora entries for CDB and PDB for oracle 19c

 

 Environment details:-

Hostname

gg1.soumya.com

Server IP

192.168.0.110

DB Version

19.3.0

Container DB SID

TESTCDB

PDB1 SID

TESTPDB1

PDB2 SID

TESTPDB2

ORACLE_HOME

/u01/app/oracle/product/19.0.0/dbhome_1

 

vi $ORACLE_HOME/network/admin/listener.ora

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = gg1.soumya.com)(PORT = 1521))

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = TESTDB)

      (SID_NAME = TESTDB)

    )

    (SID_DESC =

      (GLOBAL_DBNAME = TESTPDB1)

      (SID_NAME = TESTPDB1)

    )

    (SID_DESC =

      (GLOBAL_DBNAME = TESTPDB2)

      (SID_NAME = TESTPDB2)

  )

 )

 

 

 

 

vi $ORACLE_HOME/network/admin/tnsnames.ora

 

TESTCDB =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = gg1.soumya.com)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = TESTCDB)

    )

  )

TESTPDB1 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = gg1.soumya.com)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = TESTPDB1)

    )

  )

TESTPDB2 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = gg1.soumya.com)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = TESTPDB2)

    )

  )

 

 

 

Verify Listener status

[oracle@gg1 admin]$ lsnrctl status LISTENER

 

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 26-DEC-2020 20:19:14

 

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gg1.soumya.com)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production

Start Date                26-DEC-2020 19:57:29

Uptime                    0 days 0 hr. 21 min. 45 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/gg1/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gg1.soumya.com)(PORT=1521)))

Services Summary...

Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).

  Instance "testdb", status READY, has 1 handler(s) for this service...

Service "TESTDB" has 2 instance(s).

  Instance "TESTDB", status UNKNOWN, has 1 handler(s) for this service...

  Instance "testdb", status READY, has 1 handler(s) for this service...

Service "TESTPDB1" has 2 instance(s).

  Instance "TESTPDB1", status UNKNOWN, has 1 handler(s) for this service...

  Instance "testdb", status READY, has 1 handler(s) for this service...

Service "TESTPDB2" has 2 instance(s).

  Instance "TESTPDB2", status UNKNOWN, has 1 handler(s) for this service...

  Instance "testdb", status READY, has 1 handler(s) for this service...

Service "b74ddd0efa7a8c6ae0536e00a8c0a6b5" has 1 instance(s).

  Instance "testdb", status READY, has 1 handler(s) for this service...

Service "b74de34fad898e5fe0536e00a8c0203a" has 1 instance(s).

  Instance "testdb", status READY, has 1 handler(s) for this service...

Service "testdbXDB" has 1 instance(s).

  Instance "testdb", status READY, has 1 handler(s) for this service...

The command completed successfully

 

Verify tns entries

[oracle@gg1 admin]$ tnsping testcdb

 

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 26-DEC-2020 20:20:44

 Copyright (c) 1997, 2019, Oracle.  All rights reserved.

 Used parameter files: 

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = gg1.soumya.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TESTCDB)))

OK (0 msec)

 

[oracle@gg1 admin]$ tnsping testpdb1

 TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 26-DEC-2020 20:20:49

 Copyright (c) 1997, 2019, Oracle.  All rights reserved.

 Used parameter files:

  

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = gg1.soumya.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TESTPDB1)))

OK (0 msec)

 

 

1 comment: