[20161227]開啟多個監聽埠.txt
[20161227]開啟多個監聽埠.txt
--安全等保的需求,需要在1臺資料庫開啟2個監聽埠,並且還不能是1521預設埠.看了一些文件,做一些記錄.
--參考連線:http://blog.itpub.net/267265/viewspace-2083455/
1.環境:
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
--設定開啟2個埠,15210,15211.
2.修改listener.ora如下:
--注:先stop監聽,再修改.
$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
#SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = book)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = book)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15210))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15210))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15211))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15211))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
--重啟監聽就ok了.
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 27-DEC-2016 08:31:36
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=15210)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 27-DEC-2016 08:29:33
Uptime 0 days 0 hr. 2 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/gxqyydg4/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=15210)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=15210)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=15211)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=15211)))
Services Summary...
Service "book" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
~~~~~~~~~~~~~~~~~~~UNKBOWN 說明是靜態監聽.
The command completed successfully
--使用ezconnect連線測試: sqlplus scott/book@192.168.100.78:15211/book ,透過.
# lsof -i -P -n | grep 1521| grep LISTEN
tnslsnr 1997 oracle 8u IPv4 21318788 0t0 TCP 127.0.0.1:15210 (LISTEN)
tnslsnr 1997 oracle 11u IPv4 21318790 0t0 TCP 192.168.100.78:15210 (LISTEN)
tnslsnr 1997 oracle 12u IPv4 21318791 0t0 TCP 127.0.0.1:15211 (LISTEN)
tnslsnr 1997 oracle 13u IPv4 21318792 0t0 TCP 192.168.100.78:15211 (LISTEN)
--這樣最簡單的.但是需要配置靜態監聽.如果註解前面的靜態監聽呢?
3.無靜態監聽:
$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
#SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF
# SID_LIST_LISTENER =
# (SID_LIST =
# (SID_DESC =
# (SDU=32767)
# (GLOBAL_DBNAME = book)
# (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
# (SID_NAME = book)
# )
# )
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15210))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15210))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15211))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15211))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
--重啟監聽.
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 27-DEC-2016 08:44:48
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=15210)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 27-DEC-2016 08:43:16
Uptime 0 days 0 hr. 1 min. 32 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/gxqyydg4/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=15210)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=15210)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=15211)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=15211)))
The listener supports no services
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The command completed successfully
--注意後面2行,The listener supports no services.即使你執行alter system register ;也一樣,因為預設是註冊1521埠.而服務端
--沒有開放1521埠,無效.這個時候就需要修改引數local_listener.
4.修改引數local_listener:
--有2種方式:一種直接寫入spfile中,這樣寫入內容稍微長一點:
alter system set local_listener="(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15210)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15210)) (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15211)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15211)))" scope=memory;
--我遇到如下提示:
*
ERROR at line 1:
ORA-00972: identifier is too long
--先不註冊127.0.0.1地址看看.
alter system set local_listener="(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15210))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15211))
)" scope=memory;
$ oerr ora 972
00972, 00000, "identifier is too long"
// *Cause: An identifier with more than 30 characters was specified.
// *Action: Specify at most 30 characters.
--昏限制30個字元.我寫成如下:
SYS@book> alter system set local_listener="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=15210))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=15211)))" scope=memory;
System altered.
--我的測試寫成1行,裡面沒有空格就ok了.但是也超過30個字元限制啊,寫成如下也報錯.
alter system set local_listener="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=15210))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=15210))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=15211))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=15211)))" scope=memory;
SYS@book> show parameter local_listener
NAME TYPE VALUE
-------------- ------ ----------------------------------------------------------------------------------------------------
local_listener string (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=15210))(ADDRESS=(PROTOCOL=TCP)(HOST=1
92.168.100.78)(PORT=15211)))
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 27-DEC-2016 09:03:06
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=15210)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 27-DEC-2016 08:48:33
Uptime 0 days 0 hr. 14 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/gxqyydg4/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=15210)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=15210)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=15211)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=15211)))
Services Summary...
Service "book" has 1 instance(s).
Instance "book", status READY, has 2 handler(s) for this service...
~~~~~~~~~~~~~~=> READ 表示動態監聽註冊.
Service "bookXDB" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
The command completed successfully
--可以發現現在動態註冊ok.實際上還有另外的修改方式把以上內容寫入tnsnames.ora檔案中.看下面的測試.
5.修改引數local_listener:
--在tnsnames.ora檔案加入如下內容:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15210))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15210))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 15211))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 15211))
)
)
--LISTENER 可以換自己喜歡的名字.
SYS@book> alter system set local_listener="LISTENER" scope=memory;
System altered.
--使用ezconnect連線測試: sqlplus scott/book@192.168.100.78:15211/book ,透過.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2131425/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 監聽配置多個埠Oracle
- nginx 80埠監聽多個域名Nginx
- wriesharek同時監聽多個埠
- 如何配置多個監聽器不同埠
- ORACLE 動態註冊,靜態註冊,多個監聽,一個監聽多個埠配置Oracle
- Sqlserver重啟alwayson監聽埠SQLServer
- [20160418]修改oracle監聽埠.txtOracle
- Tomcat內配置多個webapps監聽不同埠TomcatWebAPP
- npmscript命令同時開啟多個監聽服務concurrentlyNPM
- [20130422]修改oracle監聽埠.txtOracle
- Oracle啟動兩個監聽Oracle
- Windows server 防火牆開放oracle監聽埠WindowsServer防火牆Oracle
- 初始化監聽埠
- 【Oracle】修改oracle監聽埠Oracle
- samba程序與監聽埠Samba
- 資料庫開啟監聽資料庫
- oracle監聽開啟trace fileOracle
- oracle 多個例項監聽不到Oracle
- 【LISTENER】一個資料庫配置兩個監聽埠號資料庫
- 同一Server上兩個資料庫例項共用listener.ora ,監聽多個埠Server資料庫
- 服務端配置一個多埠號(如1521/1526)監聽器服務端
- oracle 多個例項安裝監聽Oracle
- windows10怎麼檢視監聽埠_windows10檢視監聽埠的方法Windows
- 12C RAC 修改監聽埠
- oracle rac scan監聽更改埠號Oracle
- Oracle 建立非1521埠監聽Oracle
- 【Oracle】修改scan監聽器埠號Oracle
- Oracle 11g 修改監聽埠Oracle
- Tomcat監聽443埠的方法Tomcat
- 如何更改oracle監聽器的埠Oracle
- zabbix-agent啟動之後10050埠未監聽
- oracle 監聽重啟Oracle
- iOS-OC-監聽藍芽是否開啟(開啟狀態)iOS藍芽
- 使用java程式,監聽tcp協議埠JavaTCP協議
- shell埠監聽異常郵箱告警
- Oracle 修改預設監聽埠故障分析Oracle
- oracle之 單例項監聽修改埠Oracle單例
- 【監聽】配置服務端靜態(動態)監聽/修改監聽埠及引數local_listener作用服務端