1

I'm running two 12c R2 databases on linux oracle 7.9 I've installed the first database (CDB) and also a listener and both of them were running fine. Then, I've installed another 12c R2 database (CDB2) on the same system.

These are my instances:

CDB
CDB2

The problem is that if I want to startup only the second database(CDB2), and then the listener, when running lsnrctl status LISTENER it says: The listener supports no services

If I startup the first database after that (CDB), the listener comes to life saying that it supports both of the services (CDB and CDB2).

So, it only support CDB2 if I also startup CDB. If I startup only CDB2, it does not support it.

But, after I started CDB and after listener started supporting both services, if i shutdown CDB, the listener is still supporting CDB2.

So, as a summary: If i startup CDB2 and then the listener, the listener does not support any services. If I startup CDB after, the listener supports both dbs. If I shutdown CDB after, the listener supports only CDB2 which is what i want in the first place.

First step:

[oracle@oel7 ~]$ ps -ef | grep pmon
oracle    4350  2463  0 20:56 pts/0    00:00:00 grep --color=auto pmon
[oracle@oel7 ~]$ ps -ef | grep tns
root        37     2  0 20:37 ?        00:00:00 [netns]
oracle    4458  2463  0 20:57 pts/0    00:00:00 grep --color=auto tns
[oracle@oel7 ~]$

Starting CDB2 & listener:

[oracle@oel7 ~]$ ps -ef | grep pmon
oracle    2547     1  0 20:41 ?        00:00:00 ora_pmon_CDB2
oracle    4498  2463  0 20:58 pts/0    00:00:00 grep --color=auto pmon
[oracle@oel7 ~]$
[oracle@oel7 ~]$ ps -ef | grep tns
root        37     2  0 20:37 ?        00:00:00 [netns]
oracle    4537     1  0 20:58 ?        00:00:00 /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr LISTENER -inherit
oracle    4563  2463  0 20:59 pts/0    00:00:00 grep --color=auto tns
[oracle@oel7 ~]$

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                21-JAN-2021 20:42:01
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/               listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oel7/listener/alert/log.x               ml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel7.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

After starting CDB:

[oracle@oel7 dbhome_1]$ ps -ef | grep pmon
oracle    2351     1  0 20:41 ?        00:00:00 ora_pmon_CDB
oracle    2547     1  0 20:41 ?        00:00:00 ora_pmon_CDB2
oracle    4814  2463  0 21:02 pts/0    00:00:00 grep --color=auto pmon
[oracle@oel7 dbhome_1]$

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                21-JAN-2021 20:42:01
Uptime                    0 days 0 hr. 0 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/               listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oel7/listener/alert/log.x               ml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel7.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oel7.localdomain)(PORT=5500))(Secur               ity=(my_wallet_directory=/u01/app/oracle/admin/CDB/xdb_wallet))(Presentation=HTT               P)(Session=RAW))
Services Summary...
Service "CDB.localdomain" has 1 instance(s).
  Instance "CDB", status READY, has 1 handler(s) for this service...
Service "CDB2" has 1 instance(s).
  Instance "CDB2", status READY, has 1 handler(s) for this service...
Service "CDB2XDB" has 1 instance(s).
  Instance "CDB2", status READY, has 1 handler(s) for this service...
Service "CDBXDB.localdomain" has 1 instance(s).
  Instance "CDB", status READY, has 1 handler(s) for this service...
Service "b8c025790af43eafe0536f64a8c04644.localdomain" has 1 instance(s).
  Instance "CDB", status READY, has 1 handler(s) for this service...
Service "cdbpdb1.localdomain" has 1 instance(s).
  Instance "CDB", status READY, has 1 handler(s) for this service...
The command completed successfully

After shutdown of CDB and only CDB2 running:

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                21-JAN-2021 20:58:52
Uptime                    0 days 0 hr. 4 min. 55 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oel7/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel7.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "CDB2" has 1 instance(s).
  Instance "CDB2", status READY, has 1 handler(s) for this service...
Service "CDB2XDB" has 1 instance(s).
  Instance "CDB2", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oel7 dbhome_1]$

And also, even if i stop and start again the listener (having only CDB2 running - closing CDB), it is working as it should be:

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                21-JAN-2021 20:58:52
Uptime                    0 days 0 hr. 4 min. 55 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oel7/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel7.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "CDB2" has 1 instance(s).
  Instance "CDB2", status READY, has 1 handler(s) for this service...
Service "CDB2XDB" has 1 instance(s).
  Instance "CDB2", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oel7 dbhome_1]$
 

Both database have the same Oracle Home in:/u01/app/oracle/product/12.2.0/dbhome_1

Network files:

[oracle@oel7 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

[oracle@oel7 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
   
LISTENER_CDB =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))
    
CDB2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB2)
    )
  )

CDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB.localdomain)
    )
  )

What is the problem? Why the listener does not support the second database (CDB2) from the first time and I have to startup also the first database (CDB) in order for it to support both of them?

Thanks.

2 Answers 2

1

Completely normal behaviour. If a database was already running and the listener is started after that, the database will not be registered in the listener immediately, it can take several seconds until the database registers itself.

Just give it some time. If you do not want to wait, log in to CDB2 and force a registration by:

alter system register; 

By the time you do that, it may happen automatically as well.

0

the main database process called pmon (process manager) in oracle is also responsible for registering services to the listener automatically every 60 seconds.

you can also do it manually with

    alter system register;

but overall it is recommended to have two separate listeners defined for each database in the listener.ora file. you have only one. also every listener you define in listener.ora must be also defined in the tnsnames.ora file on the database server for the pmon in the database to recognize it. you only registered LISTENER.

try to have your listener.ora file to be something like

      LISTENER_CDB1 =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.example.com)(PORT = 1521))
  )
)
      LISTENER_CDB2 =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.example.com)(PORT = 1521))
  )
)

and your tnsnames.ora file something like this:

        LISTENER_CDB1 =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))
        LISTENER_CDB2 =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))

CDB2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB2)
    )
  )

CDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB)
    )
  )

you can and should manage individual listeners with lsnrctl. example:

    lsnrctl LISTENER_CDB1 START   

or

    lsnrctl LISTENER_CDB1 STATUS
     
       
        
    
    
    
1
  • 1
    No, no, no and no. Listener registration is handled by LREG process starting in 12c, not PMON. One listener can serve multiple databases just fine. What you proposed here will not work: 2 seperate listeners can not listen on the same address and port. And tnsnames.ora is not required on the database server. Commented Jan 25, 2021 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.