๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
ORACLE/ADMIN

[Oracle] Listener ๋™์  ๋“ฑ๋ก. UNKNOWN๊ณผ READY์˜ ์ฐจ์ด

by ๐ŸŒปโ™š 2020. 7. 11.

-Oracle Listener ๋™์  ๋“ฑ๋ก

 

์‹ค์Šตํ™˜๊ฒฝ

OS : Red Hat Enterprise Linux Server release 6.10
DB : Oracle 11.2.0.1
SID: newdb, PROD(1๊ฐœ ์„œ๋ฒ„์•ˆ 2๊ฐœ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค)
hostname : 601d2fce71dc

Oracle Listener๋ฅผ ๋“ฑ๋กํ•˜๋Š” ๋ฐฉ๋ฒ•์—๋Š” ๋‘๊ฐ€์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋™์ ๋“ฑ๋ก๊ณผ ์ •์ ๋“ฑ๋ก. ์ •์ ๋“ฑ๋ก์€ listener.oraํŒŒ์ผ์— ์ง์ ‘ ์„œ๋น„์Šค๋ฅผ ๋“ฑ๋กํ•ด์ฃผ๋Š” ๋ฐฉ๋ฒ• ์ž…๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์•„๋ž˜ ๋งํฌ๋ฅผ ํ†ตํ•ด ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

 

[Oracle] Listener ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ ์ •์  ๋“ฑ๋ก listener.ora ์ƒ์„ฑ

Oracle ๋„คํŠธ์›Œํฌ ํ†ต์‹  ๋ฐฉ๋ฒ•  ์™ธ๋ถ€์—์„œ Oracle์„œ๋ฒ„๋ฅผ ํ†ต์‹ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” Listener๋ฅผ ํ†ตํ•ด ํ†ต์‹ ์„ ํ•˜๊ฒŒ๋ฉ๋‹ˆ๋‹ค. Listener๊ฐ€ ํ•ด์ฃผ๋Š” ์ž‘์—…์€ Connection์„ ๋งŒ๋“ค์–ด์ฃผ๋Š” ๊ฒƒ ์ž…๋‹ˆ๋‹ค. ์„œ๋ฒ„ ๊ตฌ์„ฑ ๋ฐฉ์‹์—๋”ฐ๋ผ ์กฐ๊ธˆ ๋‹ค๏ฟฝ๏ฟฝ

myjamong.tistory.com

 

์ •์ ๋“ฑ๋ก VS ๋™์  ๋“ฑ๋ก

์ •์  ๋“ฑ๋ก๊ณผ ๋™์  ๋“ฑ๋ก์˜ ๊ฐ€์žฅ ํฐ ์ฐจ์ด๋Š” Oracle Instance๊ฐ€ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์ž๋™์œผ๋กœ ์ธ์‹ ํ•˜๋Š๋ƒ ๋ชปํ•˜๋Š๋ƒ์˜ ์ฐจ์ด์ž…๋‹ˆ๋‹ค. ์ •์  ๋“ฑ๋ก์€ listener.oraํŒŒ์ผ์— ์ง์ ‘ ์„œ๋น„์Šค๋ฅผ ๋“ฑ๋กํ•ด์ฃผ๋Š” ๊ฒƒ์ด๋‹ค. ๋™์  ๋“ฑ๋ก์€ PMON์ด๋ผ๋Š” ํ”„๋กœ์„ธ์Šค๊ฐ€ LREGํ”„๋กœ์„ธ์Šค๋ฅผ ํ†ตํ•ด ๋ฆฌ์Šค๋„ˆ์— ๋“ฑ๋ก ๊ฐ€๋Šฅํ•œ ์„œ๋น„์Šค๋ฅผ ์ž๋™์œผ๋กœ ๋“ฑ๋กํ•ด์ฃผ๋Š” ๊ฒƒ ์ž…๋‹ˆ๋‹ค.

 

listener.ora

LISTENER =
 (DESCRIPTION_LIST =
  (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 601d2fce71dc)(PORT = 1521))
  )
 )

LISTENER1 =
 (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 601d2fce71dc)(PORT = 1522))
 )

SID_LIST_LISTENER1 =
 (SID_LIST =
  (SID_DESC =
   (GLOBAL_DBNAME = newdb)
   (ORACLE_HOME = /opt/oracle/app/product/11.2.0/dbhome_1)
   (SID_NAME = newdb)
  )
  (SID_DESC =
   (GLOBAL_DBNAME = PROD)
   (ORACLE_HOME = /opt/oracle/app/product/11.2.0/dbhome_1)
   (SID_NAME = PROD)
  )
 )

listener.oraํŒŒ์ผ์„ ์œ„์™€ ๊ฐ™์ด ๊ตฌ์„ฑํ•ด๋ดค์Šต๋‹ˆ๋‹ค. ์šฐ์„  2๊ฐœ์˜ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์‹คํ–‰์‹œํ‚ค๊ณ  ์ƒํƒœ๋ฅผ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

 

[oracle@601d2fce71dc ~]$ lsnrctl start
[oracle@601d2fce71dc ~]$ lsnrctl start listener1

๊ฐ๊ฐ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. start ๋ช…๋ น ๋’ค์— ๋ฆฌ์Šค๋„ˆ ๋ช…์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์œผ๋ฉด LISTENER๋ผ๋Š” default ๋ช…์นญ์˜ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์‹คํ–‰ํ•ด์ค๋‹ˆ๋‹ค.

 

[oracle@601d2fce71dc ~]$ lsnrctl ser

LISTENER ๋ฆฌ์Šค๋„ˆ์˜ ์„œ๋น„์Šค๋ฅผ ํ™•์ธํ•ด์ค๋‹ˆ๋‹ค. ๊ฐ๊ฐ ์„œ๋น„์Šค์˜ ์ƒํƒœ๊ฐ€ READY๋กœ ๋ณด์—ฌ์ง‘๋‹ˆ๋‹ค.

 

[oracle@601d2fce71dc ~]$ lsnrctl ser listener1

LISTENER1 ๋ฆฌ์Šค๋„ˆ์˜ ์„œ๋น„์Šค๋ฅผ ํ™•์ธํ•ด์ค๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” UNKNOWN์ด๋ผ๋Š” ์ƒํƒœ๊ฐ’์ด ๋ณด์—ฌ์ง‘๋‹ˆ๋‹ค. ์–ด๋–ค ์ฐจ์ด๋ฅผ ๊ฐ–๊ณ  ์žˆ๋Š”์ง€ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

 

UNKNOWN VS READY

์šฐ์„  listener.oraํŒŒ์ผ์— ๋“ฑ๋ก๋˜์–ด ์žˆ๋Š” ์ •๋ณด๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด LISTENER ๋ฆฌ์Šค๋„ˆ๋Š” LISTENER1 ๋ฆฌ์Šค๋„ˆ์™€ ๋‹ค๋ฅด๊ฒŒ ์„œ๋น„์Šค๋ฅผ ๋“ฑ๋กํ•˜์ง€๋„ ์•Š์•˜๋Š”๋ฐ ์„œ๋ฒ„์Šค์˜ ์ƒํƒœ๊ฐ€ ๋ณด์—ฌ์ง€๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฐ”๋กœ ๋™์  ๋“ฑ๋ก๊ณผ ์ •์  ๋“ฑ๋ก์˜ ํ‘œ์‹œ๋ฅผ UNKNOWN๊ณผ READY๋กœ ํ•œ๊ฒƒ ๋ฟ์ž…๋‹ˆ๋‹ค. UNKNOWN์ด๋ผ๊ณ ํ•ด์„œ ์ž‘๋™์ด ์•ˆํ•˜๊ฑฐ๋‚˜ ๊ทธ๋Ÿฐ ๊ฒƒ์ด ์•„๋‹ˆ๊ณ  ๋‹จ์ง€ ๊ตฌ๋ถ„์„ ์œ„ํ•œ ํ‘œ์‹œ์ผ ๋ฟ์ž…๋‹ˆ๋‹ค.

 

 

๋™์ ๋“ฑ๋ก

๊ทธ๋Ÿผ ๋™์  ๋“ฑ๋ก์ด ์–ด๋–ป๊ฒŒ ๊ตฌ์„ฑ๋˜๋Š” ๊ฒƒ์ธ์ง€ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

๋™์  ๋“ฑ๋ก์€ PMON์ด๋ผ๋Š” ํ”„๋กœ์„ธ์Šค๊ฐ€ LREG๋ผ๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ํ†ตํ•ด ์ž๋™์œผ๋กœ ๋ฆฌ์Šค๋„ˆ์— ์„œ๋น„์Šค๋ฅผ ๋“ฑ๋กํ•ด์ค๋‹ˆ๋‹ค. ์„œ๋น„์Šค๋ฅผ ์–ด๋–ค ๋ฆฌ์Šค๋„ˆ์— ๋“ฑ๋กํ•ด์ค˜์•ผํ• ์ง€๋Š” local_listener ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํ†ตํ•ด ๊ด€๋ฆฌ๊ฐ€ ๋˜์–ด์ง‘๋‹ˆ๋‹ค.

 

local_listener parameter

SYS@newdb> show parameter local_listener

local_listener์˜ default ๊ฐ’์€ "" ์ž…๋‹ˆ๋‹ค. ์ด๋Ÿด๋•Œ๋Š” "LISTENER"์ด๋ผ๋Š” ๋ช…์นญ์˜ ๋ฆฌ์Šค๋„ˆ์— ๋™์  ๋“ฑ๋กํ•˜๊ฒ ๋‹ค๋Š” ๋œป์ž…๋‹ˆ๋‹ค. newdb๋ง๊ณ  PROD SID๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋„ ๊ธฐ๋ณธ local_listener๊ฐ’์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด LISTENER ๋ฆฌ์Šค๋„ˆ์˜ ์„œ๋น„์Šค ์ƒํƒœ๋ฅผ ๋ดค์„๋•Œ listener.oraํŒŒ์ผ์— ์„œ๋น„์Šค๋ฅผ ๋“ฑ๋กํ•˜์ง€ ์•Š์•˜์–ด๋„ ๋™์  ์„œ๋น„์Šค ์ •๋ณด๊ฐ€ ์žˆ์—ˆ๊ณ  READY๋กœ ํ‘œ์‹œ๋˜์–ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

 

๋ฐ˜๋ฉด, LISTENER1์˜ ๊ฒฝ์šฐ ์ง์ ‘ listener.ora ํŒŒ์ผ์— SID_LIST์— ๊ธฐ์žฌํ•˜์—ฌ ์ •์  ๋“ฑ๋ก๋˜์–ด ์žˆ์—ˆ๋˜ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿผ local_listener์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๋ณ€๊ฒฝํ•ด์„œ LISTENER1์— ๋™์  ๋“ฑ๋ก์ž‘์—…์„ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

LISTENER1์— newdb ๋™์  ๋“ฑ๋ก

SYS@newdb> alter system set local_listener='(description=(address=(protocol=tcp)(host=601d2fce71dc)(port=1522)))';

local_listener ํŒŒ๋ผ๋ฏธํ„ฐ์— ์ง์ ‘ description์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ด์ค๋‹ˆ๋‹ค.

 

[oracle@601d2fce71dc ~]$ lsnrctl ser listener1

LISTENER1 ๋ฆฌ์Šค๋„ˆ์˜ ์„œ๋น„์Šค๋ฅผ ํ™•์ธํ•ด๋ณด๋‹ˆ newdb๊ฐ€ READY๋กœ ๋˜์–ด์žˆ๋Š” ์„œ๋น„์Šค ํ•˜๋‚˜ ๋” ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ •์ ๋“ฑ๋ก๊ณผ ๋™์  ๋“ฑ๋ก์€ ๋ณ„๊ฐœ๋กœ ์„œ๋น„์Šค์— ๋ชจ๋‘ ๋“ฑ๋ก ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

 

[oracle@601d2fce71dc ~]$ lsnrctl ser

๋ฐ˜๋ฉด LISTENER์˜ ์„œ๋น„์Šค๋ฅผ ํ™•์ธํ•ด๋ณด๋‹ˆ newdb๋กœ ์žˆ์—ˆ๋˜ ์„œ๋น„์Šค๊ฐ€ ์‚ฌ๋ผ์ง„๊ฒƒ์„ ํ™•์ธ๋ฉ๋‹ˆ๋‹ค. local_listener ํŒŒ๋ผ๋ฏธํ„ฐ์— ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ๋˜์—ˆ๋˜ ์ •๋ณด๊ฐ€ ์ˆ˜์ •๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์‚ฌ๋ผ์กŒ์Šต๋‹ˆ๋‹ค. ๋ณต์ˆ˜ ๋“ฑ๋กํ•˜๋ฉด ์—ฌ๋Ÿฌ ๋ฆฌ์Šค๋„ˆ์— ๋™์  ๋“ฑ๋ก์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

 

SYS@newdb> alter system set local_listener=
'(description=(address=(protocol=tcp)(host=601d2fce71dc)(port=1522)))'
,'(description=(address=(protocol=tcp)(host=601d2fce71dc)(port=1521)))';  

","๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์—ฌ๋Ÿฌ๊ฐœ์˜ ๋ฆฌ์Šค๋„ˆ์— ํ•ด๋‹น ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋™์ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

[oracle@601d2fce71dc ~]$ lsnrctl ser

์ด์ „๊ณผ ๊ฐ™์ด ๋‘๊ฐœ์˜ ๋ฆฌ์Šค๋„ˆ๊ฐ€ ๋“ฑ๋ก๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

๋Œ“๊ธ€