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

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

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

Oracle ๋„คํŠธ์›Œํฌ ํ†ต์‹  ๋ฐฉ๋ฒ•

 ์™ธ๋ถ€์—์„œ Oracle์„œ๋ฒ„๋ฅผ ํ†ต์‹ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” Listener๋ฅผ ํ†ตํ•ด ํ†ต์‹ ์„ ํ•˜๊ฒŒ๋ฉ๋‹ˆ๋‹ค. Listener๊ฐ€ ํ•ด์ฃผ๋Š” ์ž‘์—…์€ Connection์„ ๋งŒ๋“ค์–ด์ฃผ๋Š” ๊ฒƒ ์ž…๋‹ˆ๋‹ค. ์„œ๋ฒ„ ๊ตฌ์„ฑ ๋ฐฉ์‹์—๋”ฐ๋ผ ์กฐ๊ธˆ ๋‹ค๋ฅด์ง€๋งŒ ๊ธฐ๋ณธ Dedicated Server์—์„œ Connection์ด๋ž€ User Process์™€ Server Process๋ฅผ ์—ฐ๊ฒฐํ•ด์ฃผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ฆ‰, ํ•œ๋ฒˆ ์ธ์ฆ ๋œ ์™ธ๋ถ€์‚ฌ์šฉ์ž๊ฐ€ Oracle Database์—์„œ์˜ ์ž‘์—…์„ ์ง€์ •๋œ Server Process๋ฅผ ํ†ตํ•ด ํ•  ์ˆ˜ ์žˆ๋„๋ก ์—ฐ๊ฒฐํ•ด์ค๋‹ˆ๋‹ค. ์ตœ์ดˆ์˜ ํ•œ๋ฒˆ Connection์ž‘์—…์„ ํ†ตํ•ด ์„ธ์…˜์„ ์ƒ์…ฉํ•ด์ค๋‹ˆ๋‹ค.

 

 

Database์™€์˜ ํ†ต์‹  ๊ตฌ์กฐ๋ฅผ ๋ดค์„๋•Œ ์ง์ ‘ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋กœ ํ†ต์‹ ํ•˜๋Š” 2 Tier ๋ฐฉ์‹์ด ์žˆ๊ณ , ๋Œ€๋ถ€๋ถ„ ์‚ฌ์šฉ๋˜๋Š” ๋ฐฉ์‹์œผ๋กœ App๋ฅผ ํ•œ๋ฒˆ ๊ฑธ์ณ ํ†ต์‹ ํ•˜๋Š” ๋ฐฉ์‹์ธ 3 Tier๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

2 Tier

์ง์ ‘ Database์— ๋ถ™๋Š” ๊ตฌ์กฐ ์ž…๋‹ˆ๋‹ค. ์‰ฝ๊ฒŒ ์ดํ•ดํ•˜์ž๋ฉด Sqlplus๋ฅผ ์ด์šฉํ•ด์„œ ํ„ฐ๋ฏธ๋„์— ๋ช…๋ น์„ ์ง์ ‘ ์ž‘์—…ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

 

3 Tier

๋ช…๋ น์„ ์ง์ ‘ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ Application์„ ํ†ตํ•ด Database์™€ ํ†ต์‹ ํ•ฉ๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๊ฐ€ ์›น์‚ฌ์ดํŠธ์—์„œ ํšŒ์›๊ฐ€์ž…์„ ํ•˜๊ณ  ๊ฐ€์ž… ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„๋•Œ ํ•ด๋‹น ์ •๋ณด๊ฐ€ Database์— ์ €์žฅ๋˜๋“ฏ์ด ๋ช…๋ น์„ ๋ชจ๋ฅด๋”๋ผ๋„ Application์ด Database์™€ ํ†ต์‹ ์ž‘์—…์„ ํ•ด์ค๋‹ˆ๋‹ค.

 

 

Listener ๊ตฌ์„ฑ

Oracle์€ ์ด๋Ÿฌํ•œ ์™ธ๋ถ€ ํ†ต์‹ ์„ Listener๋ฅผ ํ†ตํ•ด์„œ ์ง„ํ–‰ํ•˜๊ณ  $ORACLE_HOME/network/admin/listener.ora๋ผ๋Š” ํŒŒ์ผ์„ ํ†ตํ•ด ๊ด€๋ฆฌ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. Listener๋ฅผ ๊ตฌ์„ฑํ•˜๊ธฐ ์ „์— ๋จผ์ € ๊ธฐ์กด์— ์žˆ๋Š” Listener ์ •๋ณด๋ฅผ ์‚ญ์ œํ•˜๊ณ  listner์˜ ์ƒํƒœ๋ฅผ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

์‹ค์Šต ์ค€๋น„

OS : OEL 5.4
DB : Oracle 12.1.0.2
SID: newdb, PROD(1๊ฐœ ์„œ๋ฒ„์•ˆ 2๊ฐœ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค)
hostname : host01
[newdb@host01 ~]$ cd $ORACLE_HOME/network/admin
[newdb@host01 admin]$ ls
listener.ora  samples  shrept.lst  sqlnet.ora  tnsnames.ora
[newdb@host01 admin]$ rm *
rm: cannot remove `samples': Is a directory
[newdb@host01 admin]$ ls
samples
[newdb@host01 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 09-JUL-2020 14:52:19

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

listener.ora ํŒŒ์ผ๋งŒ ์ง€์›Œ๋„ ๋˜์ง€๋งŒ ์•ž์œผ๋กœ์˜ ์‹ค์Šต์„ ์œ„ํ•ด ํ•ด๋‹น ๊ฒฝ๋กœ์˜ ๋ชจ๋“  ํŒŒ์ผ์„ ์ง€์šฐ๊ณ  ์ง„ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค. lsnrctl ๋ช…๋ น์„ ์‚ฌ์šฉํ•ด์„œ listener์ •๋ณด๊ฐ€ ์—†๋‹ค๋ฉด ์‹ค์Šต ์ค€๋น„๋Š” ์™„๋ฃŒ๋œ ๊ฒƒ ์ž…๋‹ˆ๋‹ค.

 

1. Oracle Net Manager ์‚ฌ์šฉ

๋ชฉํ‘œ
-LISTENER1 ์ด๋ฆ„์˜ ๋ฆฌ์Šค๋„ˆ๋ฅผ ๊ตฌ์ถ•
-newdb ๋“ฑ๋ก
-PROD ๋“ฑ๋ก
-13000 ํฌํŠธ ์‚ฌ์šฉ
[newdb@host01 admin]$ netmgr

netmgr ๋ช…๋ น์„ ์‚ฌ์šฉํ•ด์„œ Oracle Net Manager ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

GUI ๋ชจ๋“œ์—์„œ ์‹คํ–‰๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. Local์— "+" ๊ธฐํ˜ธ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

 

๋ฆฌ์Šค๋„ˆ์˜ ์ด๋ฆ„์„ LISTENER1์œผ๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

 

 

์ƒ๋‹จ์— Select box์—์„œ Listening Location์„ ์„ ํƒํ•˜๊ณ  ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. ํฌํŠธ๋Š” 13000์œผ๋กœ ์ง€์ •ํ•˜๊ณ  Host์— IP ํ˜น์€ OS์— ๋“ฑ๋ก๋œ host๋ช… ํ˜น์€ ๋„๋ฉ”์ธ๋ช…์œผ๋กœ๋„ ์ž…๋ ฅ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

 

newdb@host01 admin]$ vi /etc/hosts

Host๋ช…๊ณผ ๊ด€๋ จ๋œ ๋‚ด์šฉ์€ ์œ„ ๊ฒฝ๋กœ์—์„œ ํ™•์ธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ์„œ๋ฒ„๋Š” host01์ด๋ผ๋Š” host๋ช…์นญ์œผ๋กœ ์ง€์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

์ƒ๋‹จ Selectbox์—์„œ Database Services๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ์ •๋ณด๋“ค์„ ํ™•์ธํ•˜๊ณ  ์ž…๋ ฅํ•˜๊ณ  newdb์˜ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ด์ค๋‹ˆ๋‹ค. Oracle Home Directory๋Š” ์ด๋ฏธ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋กœ ์ง€์ •๋˜์–ด ์žˆ์–ด ๊ฒฝ๋กœ์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ๋ฏธ๋ฆฌ ์ž…๋ ฅ๋˜์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค.

 

Add Database ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ์ด๋ฒˆ์—๋Š” PROD์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ด์ค๋‹ˆ๋‹ค. ์ด์ œ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ๋ชจ๋‘ ์ž…๋ ฅํ–ˆ์œผ๋‹ˆ ์ขŒ์ธก ์ƒ๋‹จ์— File - Save Network Configuration์„ ํด๋ฆญ ํ•˜์—ฌ ์ €์žฅํ•ด์ค๋‹ˆ๋‹ค.

 

[newdb@host01 ~]$ cd $ORACLE_HOME/network/admin
[newdb@host01 admin]$ ls
listener.ora  samples
[newdb@host01 admin]$ vi listener.ora

์„ค์ • ์ž‘์—…์„ ๋๋‚ฌ์œผ๋‹ˆ listener.oraํŒŒ์ผ์„ ํ™•์ธํ•˜์—ฌ ์ž…๋ ฅํ•œ ์ •๋ณด๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธํ•ด์ฃผ๊ณ  listener๋ฅผ ์‹คํ–‰ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

[newdb@host01 ~]$ lsnrctl start listener1

๋ฆฌ์Šค๋„ˆ ์‹คํ–‰ ๋ช…๋ น์€ lsnrctl start <๋ฆฌ์Šค๋„ˆ๋ช…> ํ˜•์‹์œผ๋กœ ์‹คํ–‰๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๋ฆฌ์Šค๋„ˆ๋ช…์„ ์ œ์™ธํ•˜๋ฉด default ๋ฆฌ์Šค๋„ˆ์ธ LISTENER๋ผ๋Š” ๋ช…์นญ์˜ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์‹คํ–‰ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. default ๋ฆฌ์Šค๋„ˆ์— ๋Œ€ํ•œ ์„ค๋ช…์€ ์ถ”ํ›„ ๋‹ค๋ฅธ ๊ธ€์—์„œ ์ง„ํ–‰ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์‹ค์Šต๋Œ€๋กœ listener1์ด๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ํฌํŠธ 13000๋ฒˆ PROD์™€ newdb์— ๋Œ€ํ•œ instance์ •๋ณด๊ฐ€ ๋“ฑ๋ก๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น status๊ฐ€ UNKNOWN์œผ๋กœ ๋œจ๋Š” ๊ฒƒ์€ ์ •์ ๋“ฑ๋ก์„ ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ์ถ”ํ›„ ๋‹ค๋ฅธ ๊ธ€์—์„œ ๋‹ค๋ฃจ๊ฒ ์Šต๋‹ˆ๋‹ค.

 

 

2.  Oracle Net Configuration Assistant ์‚ฌ์šฉ

Oracle Net Manager๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ Instance๋“ฑ๋ก์„ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

๋ชฉํ‘œ
-LISTENER2 ์ด๋ฆ„์˜ ๋ฆฌ์Šค๋„ˆ๋ฅผ ๊ตฌ์ถ•
-13010 ํฌํŠธ ์‚ฌ์šฉ
[oracle@host01 ~]$ netca

Listener configuration ์ฒดํฌํ•ฉ๋‹ˆ๋‹ค.

 

๋ฆฌ์Šค๋„ˆ ์ถ”๊ฐ€ ์ž‘์—…์„ ์œ„ํ•ด Add ์ฒดํฌ

 

LISTENER2๋ผ๋Š” ๋ช…์นญ์œผ๋กœ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

 

TCP ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

 

ํฌํŠธ๋Š” 13010๋ฒˆ์œผ๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

 

๋ฆฌ์Šค๋„ˆ๋Š” ๋”์ด์ƒ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š์„ ๊ฒƒ ์ด๊ธฐ ๋•Œ๋ฌธ์— NO.

 

LISTENER2๋ฅผ ๋ฐ”๋กœ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

 

์„ค์ •์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด์ œ listener.ora ํŒŒ์ผ์„ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

[newdb@host01 ~]$ cd $ORACLE_HOME/network/admin
[newdb@host01 admin]$ vi listener.ora

 LISTENER2์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ๋“ฑ๋ก๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. SID_LIST_LISTENER1์˜ ์ •๋ณด์ฒ˜๋Ÿผ ๋ฆฌ์Šค๋„ˆ์— ๋“ฑ๋กํ•˜๋Š” ์„œ๋น„์Šค๋ฅผ ๊ธฐ์žฌํ•ด์ฃผ๋Š” ๊ฒƒ์ด ์ •์  ๋“ฑ๋ก์ž…๋‹ˆ๋‹ค.

 

[newdb@host01 admin]$ lsnrctl status listener2

๋ฆฌ์Šค๋„ˆ์— ๋Œ€ํ•œ ์ƒํƒœ๋ฅผ ํ™•์ธํ•ด๋ณด์ง€๋งŒ ๋“ฑ๋ก๋œ ์„œ๋น„์Šค๊ฐ€ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์„œ๋น„์Šค์— ๋Œ€ํ•œ ์ •๋ณด๋Š” ๋‚˜์˜ค์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์•„๋ฌด๋Ÿฐ ์„œ๋น„์Šค๋„ ๋“ฑ๋กํ•˜์ง€ ์•Š๊ณ  ๋ฆฌ์Šค๋„ˆ๋งŒ ์ƒ์„ฑ๋œ๋‹ค๋ฉด ์•„๋ฌด๋Ÿฐ ํ•„์š”๊ฐ€ ์—†๋Š” ๋ฆฌ์Šค๋„ˆ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, ์ด๋ ‡๊ฒŒ ์„œ๋น„์Šค๋ฅผ ๋“ฑ๋กํ•˜์ง€ ์•Š์€ ๋ฆฌ์Šค๋„ˆ์—๊ฒŒ๋„ ์„œ๋น„์Šค๋ฅผ ์ž๋™์œผ๋กœ ๋“ฑ๋กํ•˜๋Š” ๋™์  ๋“ฑ๋ก ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋™์  ๋“ฑ๋ก์€ ์•„๋ž˜ ๋งํฌ๋ฅผ ํ†ตํ•ด ์ง„ํ–‰ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

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

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๋ฅผ ๋“ฑ..

myjamong.tistory.com

 

 

๋Œ“๊ธ€