본문 바로가기

Database/Oracle

59 - [Oracle 19C] Creating static listener example

 

1. adding SID_LIST into listener.ora

 

 

[oracle@test admin]$ echo $ORACLE_HOME
/u01/app/oracle/product/19/db_1

 

 

SQL> show parameter instance

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
active_instance_count		     integer
cluster_database_instances	     integer	 1
instance_abort_delay_time	     integer	 0
instance_groups 		     string
instance_mode			     string	 READ-WRITE
instance_name			     string	 orcl    <<<<<<<<<<
instance_number 		     integer	 0
instance_type			     string	 RDBMS
open_links_per_instance 	     integer	 4
parallel_instance_group 	     string

 

 

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



SQL> select global_name from global_name;

GLOBAL_NAME
--------------------------------------------------------------------------------
ORCLPDB.COM

 

 

# add to listener.ora



LISTENER_PDBS =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = test.com)(PORT = 1527))
    )

SID_LIST_LISTENER_PDBS=
(SID_LIST=
  (SID_DESC=
    (GLOBAL_DBNAME=ORCLPDB.COM)
    (SID_NAME=orcl)
    (ORACLE_HOME=/u01/app/oracle/product/19/db_1)
  )
)

 

 

 

 

 

  • "status UNKNOWN" - 

Actually, when you start the default listener using a dynamic registration, you will find the status is ready. But when you have a static listener, you will find the status unknown.

Why?

Because the listener cannot guarantee 100% that this is a valid service. Maybe you have mistake, maybe you put a service that doesn't exist. So that's why you find the status is unknown.

 

 

 

[oracle@test trace]$ sqlplus system/Manager123#@test.com:1527/ORCLPDB.COM

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 30 14:47:05 2023
Version 19.3.0.0.0

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

Last Successful login time: Wed Nov 15 2023 16:38:24 +00:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0



SQL> show con_name

CON_NAME
------------------------------
ORCLPDB



SQL> show parameter local

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
local_listener			     string	 LISTENER_ORCL,LISTENER2
parallel_force_local		     boolean	 FALSE

 

 

 

LISTENER_PDBS =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = test.com)(PORT = 1527))
    )

SID_LIST_LISTENER_PDBS=
(SID_LIST=
  (SID_DESC=
    (GLOBAL_DBNAME=ORCLPDB.COM)
    (SID_NAME=orcl)
    (ORACLE_HOME=/u01/app/oracle/product/19/db_1)
  )

# You can repeatedly add the required PDB by extending the "SID_DESC" section.
  (SID_DESC=
    (GLOBAL_DBNAME=PDB1.COM)
    (SID_NAME=orcl)
    (ORACLE_HOME=/u01/app/oracle/product/19/db_1)
  )

)

 

 

 

[oracle@test trace]$ lsnrctl stop listener_pdbs

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 30-NOV-2023 15:11:59

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test.com)(PORT=1527)))
The command completed successfully




[oracle@test trace]$ lsnrctl start listener_pdbs

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 30-NOV-2023 15:12:22

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

Starting /u01/app/oracle/product/19/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/test/listener_pdbs/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1527)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test.com)(PORT=1527)))
STATUS of the LISTENER
------------------------
Alias                     listener_pdbs
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                30-NOV-2023 15:12:22
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/19/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/test/listener_pdbs/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1527)))
Services Summary...
Service "ORCLPDB.COM" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "PDB1.COM" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

 

 

 

SQL> conn system/Manager123#@test.com:1527/pdb1.com
Connected.


SQL> show con_name

CON_NAME
------------------------------
PDB1




SQL> conn system/Manager123#@test.com:1527/orclpdb.com
Connected.


SQL> show con_name

CON_NAME
------------------------------
ORCLPDB