Technical posts/Oracle

Oracle LISTENER Dynamic_registration / 리스너에 불필요한 인스턴스 등록방지

ODB 2015. 1. 7. 15:26

Oracle LISTENER Dynamic_registration / 리스너에 불필요한 인스턴스 등록방지


한서버에 오라클 인스턴스를 2개이상 설치를 하는 경우

각자 리스너를 구성하고 각자의 포트에 맞게 운영을 하는데 상대방 인스턴스 정보가

다른쪽 리스너에 자동등록이 되어버리는 경우가 발생했다


사용자 편의를 위해 dynamic_registration이라는 옵션으로 PMON에서 정보를 줘 리스너에 현 인스턴스를 자동등록 하지만 두개 이상의 인스턴스가 한서버에 있는경우 신경이 쓰인다;;


예를 들어 리스너를 띄우고 'The listener supports no services' 메시지가 나오면 

sqlplus로 접속 alter system register 하면 리스너에 인스턴스가 보이는 경우가 있는데


PMON이 리스너에 현재 구동중인 인스턴스정보를 주기 때문에 리스너에 SID가 등록되어 뜨는데 dynamic_registration이 활성화 되어 그렇다



실제 사례를 보도록 하자


[/oracle/product/11g/network/admin]$ lsn


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-JAN-2015 14:08:17


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=AP_01)(PORT=1521)))

STATUS of the LISTENER

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

Alias                     lsn_APP1

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                07-JAN-2015 14:06:47

Uptime                    0 days 0 hr. 1 min. 29 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/product/11g/network/admin/listener.ora

Listener Log File         /oracle/diag/tnslsnr/AP_01/lsn_APP1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=AP_01)(PORT=1521)))

Services Summary...

Service "APP2" has 1 instance(s).

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

Service "APP1" has 1 instance(s).

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

The command completed successfully




[/APP2/oracle]$ lsnrctl status lsn_APP2


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-JAN-2015 14:40:19


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=AP_01)(PORT=1522)))

STATUS of the LISTENER

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

Alias                     lsn_APP2

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                07-JAN-2015 14:07:49

Uptime                    0 days 0 hr. 32 min. 29 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /APP2/oracle/product/11g/network/admin/listener.ora

Listener Log File         /APP2/oracle/diag/tnslsnr/AP_01/lsn_APP2/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=AP_01)(PORT=1522)))

Services Summary...

Service "APP2" has 1 instance(s).

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

Service "APP1DRXDB" has 1 instance(s).

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

Service "APP1" has 1 instance(s).

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

The command completed successfully 


결과를 보자


AP_01서버에


APP1, APP2 인스턴스가 있고 각각 1521, 1522 포트를 쓰는데


각자 리스너가 있지만 상대방 인스턴스 정보가 등록이 되어있다;;


그말인 즉슨 1522포트를 이용해서 APP1 디비가 접속이 가능하다... 의도한 바가 아닌데..




결과에 강조한 READY를 보면 알수 있는건 '자동으로 등록된 SID의 정보' 라는 것이다


APP1쪽 리스너에는 APP2가 dynamic_registration에 의해 자동등록되어 READY라고 뜨고


APP2쪽 리스너에는 APP1이 dynamic_registration에 의해 자동등록되어 READY라고 뜬다



자 

APP1 리스너는 APP1인스턴스 정보만

APP2 리스너는 APP2인스턴스 정보만

표시하기 위해서는 dynamic_registration 을 꺼줘야 하는데

listener.ora파일 하단에 dynamic_registration=off 를 추가하고 저장한다



이후 리스너는



LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-JAN-2015 15:10:38


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=AP_01)(PORT=1521)))

STATUS of the LISTENER

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

Alias                     lsn_APP1

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                07-JAN-2015 14:42:39

Uptime                    0 days 0 hr. 27 min. 58 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/product/11g/network/admin/listener.ora

Listener Log File         /oracle/diag/tnslsnr/AP_01/lsn_APP1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=AP_01)(PORT=1521)))

Services Summary...

Service "APP1" has 1 instance(s).

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

The command completed successfully



LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-JAN-2015 15:10:31


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=AP_01)(PORT=1522)))

STATUS of the LISTENER

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

Alias                     lsn_APP2

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                07-JAN-2015 14:40:34

Uptime                    0 days 0 hr. 29 min. 57 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /APP2/oracle/product/11g/network/admin/listener.ora

Listener Log File         /APP2/oracle/diag/tnslsnr/AP_01/lsn_APP2/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=AP_01)(PORT=1522)))

Services Summary...

Service "APP2" has 1 instance(s).

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

The command completed successfully 



dynamic_registration은 사용하지 않아 깔끔하게 등록된 내용만 표시한다



http://docs.oracle.com/cd/B12037_01/network.101/b10775/listenercfg.htm


보면 dynamic registartion은 service registration이라고 부른다


Service registration은

http://docs.oracle.com/cd/B12037_01/network.101/b10775/glossary.htm#i434241


a feature by which the pmon process automatically registers information with a listener

직: 기술이다 / pmon process 으로부터/ 자동으로 등록하는 정보 / 리스너를 

의 : pmon process의 기술중 하나로 리스너에 자동으로 정보를 등록한다


항목들은

service names for each running instance of the database

instance names of the database

service handlers available for each instance

dispatcher, instance, and node load information


항목들을 보면 왜 APP1 리스너에 APP2가 와서 접속해달라고 방긋 웃었는지 알수 있다


편의를 위해서 만들었지만 때론 불편하게 만드는 기술이다


dynamic_registration