Search code examples
oraclelistenercentos7oracle19cpluggable-database

How to Register Pluggable Database(PDB) with new created LISTENER


I am working with Oracle 19c in centos 7. After Oracle installation, i created new Container Database(CDB) with Plugguble Database(PDB) using DBCA.

I am working with port number=1522

[oracle@ol8-19 ~]$ lsnrctl start LISTENER_TST

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 17-AUG-2020 16:02:02

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

Starting /opt/Oracle19c/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /opt/Oracle19c/network/admin/listener.ora
Log messages written to /opt/oraclebase19c/diag/tnslsnr/ol8-19/listener_tst/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ol8-19.localdomain)(PORT=1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ol8-19.localdomain)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_TST
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                17-AUG-2020 16:02:02
Uptime                    0 days 0 hr. 0 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/Oracle19c/network/admin/listener.ora
Listener Log File         /opt/oraclebase19c/diag/tnslsnr/ol8-19/listener_tst/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ol8-19.localdomain)(PORT=1522)))
The listener supports no services
The command completed successfully

This is my Listener.ora file.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

LISTENER_TST =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol8-19.localdomain)(PORT = 1522))
    )
  )

This is my tnsnames.ora file.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = ol8-19.localdomain)(PORT = 1521))


LISTENER_ABC =
  (ADDRESS = (PROTOCOL = TCP)(HOST = ol8-19.localdomain)(PORT = 1522))

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol8-19.localdomain)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

ABC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ol8-19.localdomain)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ABC)
    )
  )

My pluggable Database name is PDB. How can i Register PDB with my listener with port 1522??


Solution

  • Connect to an idle instance and startup the instance

    [oracle@ol8-19 ~]$ sqlplus / as sysdba
    
    SQL> startup;
    

    change container to that pluggable database

    SQL> alter session set container=pdb;
    Session altered.
    

    and open it

    SQL> alter pluggable database pdb open;
    

    Now, you set local_listener

    SQL> alter system set local_listener='(address=(protocol=tcp)(host=ol8-19.localdomain)
    (port=1522))' scope=spfile;
    
    System altered.
    

    and issue the following command in order to register the service immediately

    SQL> alter system register;
    
    System altered.
    

    and restart pluggable database

    SQL> alter pluggable database pdb close immediate;
    
    SQL> alter pluggable database pdb open;
    
    SQL> exit;
    

    then start listener

    [oracle@ol8-19 ~]$ lsnrctl start
    

    and recheck listener's current status

    [oracle@ol8-19 ~]$ lsnrctl status
    

    which should start within a half minute.