보통은 하나의 DB에 하나의 리스너를 사용합니다.
하지만 여러가지 이유로 예를 들면 다른 포트로 접속하는 리스너를 추가하여 사용하는 경우가 있습니다.
여기서는 동일한 DB에 리스너를 추가하는 방법을 정리하였습니다.
listener.ora 파일 수정
1555 포트를 사용하는 LISTENER2 리스너 관련 구문을 추가해 주세요
[oracle@vm161 admin]$ cat listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.161)(PORT = 1521))
)
)
SID_LIST_LISTENER2 =
(SID_LIST =
(SID_DESC =
(SID_NAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
)
)
LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.161)(PORT = 1555))
)
)
LISTENER2 리스너 기동
[oracle@vm161 admin]$ lsnrctl start listener2
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 27-APR-2016 22:28:20
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/vm161/listener2/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.80.161)(PORT=1555)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.80.161)(PORT=1555)))
STATUS of the LISTENER
------------------------
Alias listener2
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 27-APR-2016 22:28:20
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/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/vm161/listener2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.80.161)(PORT=1555)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
접속 테스트
tnsnames.ora 파일에 정보 추가하고 접속 테스트 진행해 보겠습니다
vm1(기존 리스너) 및 vm1(신규 리스너) 접속 테스트
VM1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.161)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
VM2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.161)(PORT = 1555))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
-- vm1 접속 : LISTENER
>sqlplus scott/tiger@vm1
SQL*Plus: Release 11.2.0.1.0 Production on 수 4월 27 22:24:02 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
다음에 접속됨:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
SQL>
-- vm2 접속 : LISTENER2
>sqlplus scott/tiger@vm2
SQL*Plus: Release 11.2.0.1.0 Production on 수 4월 27 22:28:36 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
다음에 접속됨:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
SQL>
댓글 쓰기