日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

使用remote_listener實(shí)現(xiàn)數(shù)據(jù)庫與監(jiān)聽器分離 | HelloDML

 玉雪龍山999 2012-02-16

使用remote_listener實(shí)現(xiàn)數(shù)據(jù)庫與監(jiān)聽器分離 | HelloDML

分類: ora-12520 Oracle remote_listener Oracle Oracle RAC 30人閱讀 評(píng)論(0) 收藏 舉報(bào)

使用remote_listener實(shí)現(xiàn)數(shù)據(jù)庫與監(jiān)聽器分離

remote_listener一般用在RAC環(huán)境中,單實(shí)例數(shù)據(jù)庫是否可以使用該參數(shù)呢?如果可以,是否可以讓listener 和數(shù)據(jù)庫放在不同主機(jī)上?
下面我們構(gòu)造一個(gè)環(huán)境來測(cè)試下:
環(huán)境:
數(shù)據(jù)庫在192.168.0.81上(RHEL5)
listener在192.168.0.80上(RHEL5)
client在192.168.0.52上(solaris10)

1,在數(shù)據(jù)庫修改remote_listener參數(shù):
SQL> alter system set service_names=’test’;
SQL> alter system set remote_listener=’test’;
alter system set remote_listener=’test’

*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00119: invalid specification for system parameter REMOTE_LISTENER
ORA-00132: syntax error or unresolved network name ‘test’

 在tnsnames.ora里加入test條目重新運(yùn)行:
vi /u01/app/oracle/product/10.2.3/av_1/network/admin/tnsnames.or

test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.80)(PORT = 1521))
)
)

SQL> alter system set remote_listener=test;
System altered.

SQL> alter system register;
System altered.

然后查看本地listener和遠(yuǎn)程listener已經(jīng)注冊(cè)test服務(wù):
本地:
[oracle@avagent ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 12-DEC-2011 21:02:53
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 – Production
Start Date 09-DEC-2011 19:34:58
Uptime 3 days 1 hr. 27 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/avagent/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=1521)))
Services Summary…
Service “orcl.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “orclXDB.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “test.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
The command completed successfully

遠(yuǎn)程:
[oracle@avserver admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 20:42:33
Copyright (c) 1991, 2006, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.3.0 – Production
Start Date 15-DEC-2011 20:20:03
Uptime 0 days 0 hr. 22 min. 29 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.3/av_1/network/log/listener.log
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=avserver.com)(PORT=1521)))
Services Summary…
Service “PLSExtProc” has 1 instance(s).
Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…
Service “orcl.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “orclXDB.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “test.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
The command completed successfully

通過lsnrctl status ,我們可以發(fā)現(xiàn),數(shù)據(jù)庫已經(jīng)像本地和遠(yuǎn)程的監(jiān)聽注冊(cè)了test服務(wù)。

 
下面我們嘗試使用遠(yuǎn)程監(jiān)聽連接數(shù)據(jù)庫:
首先在遠(yuǎn)程監(jiān)聽所在主機(jī)上添加tnsnames.ora
test=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.80)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)

這時(shí)我們注意到,test的host使用的遠(yuǎn)程監(jiān)聽的ip地址
然后嘗試連接:
[oracle@avserver admin]$ sqlplus system/oracle@test
SQL*Plus: Release 10.2.0.3.0 – Production on Thu Dec 15 20:23:43 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

ERROR:
ORA-12520: TNS:listener could not find available handler for requested type of server

結(jié)果是無法連接,即使遠(yuǎn)程監(jiān)聽已經(jīng)注冊(cè)test服務(wù)
我們?cè)趕olaris再次嘗試連接:
test=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.80)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)
-bash-3.00$ sqlplus system/oracle@test
SQL*Plus: Release 11.2.0.3.0 Production on Thu Dec 15 20:55:21 2011
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12516: TNS:listener could not find available handler with matching protocol stack

雖然錯(cuò)誤號(hào)不一致,但仍然連不進(jìn)去數(shù)據(jù)庫。
使用lsnrctl service命令查看服務(wù)狀態(tài):
[oracle@avserver admin]$ lsnrctl service
LSNRCTL for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 21:07:54
Copyright (c) 1991, 2006, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary…
Service “PLSExtProc” has 1 instance(s).
Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0
LOCAL SERVER
Service “orcl.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:blocked
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))
Service “orclXDB.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Handler(s):
“D000″ established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: avagent.com, pid: 5590>
(ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=34266))
Service “test.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:blocked
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))
The command completed successfully

注意到test.com的狀態(tài)是blocked。
根據(jù)tns錯(cuò)誤號(hào)和服務(wù)狀態(tài)為:blocked。根據(jù)普通情況,我們可以定位到是數(shù)據(jù)庫的local_listener未設(shè)置,
設(shè)置本地local_listener:

SQL> alter system set local_listener= ‘(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))’ ;

然后確保本地監(jiān)聽已經(jīng)開啟:
[oracle@avagent ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 12-DEC-2011 22:07:06
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 – Production
Start Date 12-DEC-2011 22:06:57
Uptime 0 days 0 hr. 0 min. 9 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/avagent/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=1521)))
Services Summary…
Service “orcl.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “orclXDB.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “test.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
The command completed successfully
[oracle@avagent ~]$

然后在remote端查看服務(wù)狀態(tài):
[oracle@avserver admin]$ lsnrctl service
LSNRCTL for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 21:21:43
Copyright (c) 1991, 2006, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary…
Service “PLSExtProc” has 1 instance(s).
Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0
LOCAL SERVER
Service “orcl.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:2 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))
Service “orclXDB.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Handler(s):
“D000″ established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: avagent.com, pid: 5590>
(ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=34266))
Service “test.com” has 1 instance(s).
Instance “orcl”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:2 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))
The command completed successfully

發(fā)現(xiàn)此時(shí)test.com的狀態(tài)已經(jīng)變?yōu)閞eady
再次在遠(yuǎn)程listener節(jié)點(diǎn)上嘗試通過remote_listener連接數(shù)據(jù)庫:

[oracle@avserver admin]$ sqlplus system/oracle@test
SQL*Plus: Release 10.2.0.3.0 – Production on Thu Dec 15 21:18:59 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
—————- ————
orcl OPEN

SQL>
再次再solaris上嘗試通過remote_listener連接數(shù)據(jù)庫
-bash-3.00$ sqlplus system/oracle@test
SQL*Plus: Release 11.2.0.3.0 Production on Thu Dec 15 21:19:36 2011
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
—————- ————
orcl OPEN

至此,我們實(shí)現(xiàn)了通過遠(yuǎn)程監(jiān)聽連接數(shù)據(jù)庫的測(cè)試:

限制:
使用remote_listener連接數(shù)據(jù)庫時(shí),本地監(jiān)聽也要狀態(tài)正常。單獨(dú)remote_listener無法連接到數(shù)據(jù)庫,這使得remote_listener的作用非常雞肋,他無法作為一個(gè)獨(dú)立的監(jiān)聽單獨(dú)存在,因?yàn)樗麜?huì)把收到的監(jiān)聽請(qǐng)求發(fā)生給本地監(jiān)聽。因此無法作為容災(zāi)監(jiān)聽器或者負(fù)載均衡監(jiān)聽器。
但remote_listener也有其作用,在remote_listener和數(shù)據(jù)庫之間可以使用防火墻保證網(wǎng)絡(luò)安全。

以上均為個(gè)人總結(jié),并未參考任何oracle note,僅作測(cè)試用途。

問題:
在數(shù)據(jù)庫向遠(yuǎn)程節(jié)點(diǎn)注冊(cè)時(shí),remote的listener.log出現(xiàn)如下報(bào)錯(cuò):
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.80)(PORT=1521)))
15-DEC-2011 21:29:39 * service_register * orcl * 12542
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use

通過查找metalink,找到解決方案:
Listener Fails to Start on Linux, Errors with TNS-12542, Linux Error: 98: Address already in use [ID 301014.1]
在listener.ora使用ip代替主機(jī)名即可。
重新進(jìn)行遠(yuǎn)程節(jié)點(diǎn)注冊(cè),錯(cuò)誤消失:
TNSLSNR for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 21:36:14
Copyright (c) 1991, 2006, Oracle. All rights reserved.
System parameter file is /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.3/av_1/network/log/listener.log
Trace information written to /u01/app/oracle/product/10.2.3/av_1/network/trace/listener.trc
Trace level is currently 0
Started with pid=7219
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.80)(PORT=1521)))
Listener completed notification to CRS on start

TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
WARNING: Subscription for node down event still pending
15-DEC-2011 21:36:14 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=avserver.com)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=169870080)) * status * 0

15-DEC-2011 21:36:45 * service_register * orcl * 0
15-DEC-2011 21:36:54 * service_update * orcl * 0
15-DEC-2011 21:37:00 * service_update * orcl * 0
15-DEC-2011 21:37:09 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test.com)(CID=(PROGRAM=sqlplus)(HOST=avserver.com)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.80)(PORT=33252)) * establish * test.com * 0
但該問題與限制無關(guān)。

本文固定鏈接:http://www./2011/12/%e4%bd%bf%e7%94%a8remote_listener%e5%ae%9e%e7%8e%b0%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%8e%e7%9b%91%e5%90%ac%e5%99%a8%e5%88%86%e7%a6%bb/ | HelloDML

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多