[20211012]测试远程监听.txt --//测试一下Remote Listener这种模式是否可行,实际上网络许多链接讲不可行,我自己也在7月份看了许多链接,尝试N久,不成功. --//放假再次重复看了许多链接,上班再次测试终于成功!!没有实际的意义,仅仅为了学习。 --//另外我记忆里好像是一个安全缺陷,检索许久也没有找到相关链接。 1.测试环境。 --//数据库在192.168.100.78 sid=book,监听端口1521 版本11.2.0.4 --//监听服务器在192.168.100.33 ,监听端口1521 版本10.2.0.4。 --//两台机器监听同时启动。 2.建立远程监听: --//192.168.100.78上执行: SCOTT@book> @ ver BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production SYS@book> @ hide remote_listener NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE ISSES ISSYS_MOD --------------- --------------- ------------- ------------- ------------ ----- --------- remote_listener remote listener TRUE FALSE IMMEDIATE SYS@book> show parameter service NAME TYPE VALUE ------------- ------ --------------- service_names string BOOK, BOOKSHARE SYS@book> ALTER SYSTEM SET REMOTE_LISTENER="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.33)(PORT=1521)))" scope=memory; System altered. SYS@book> alter system register; System altered. 3.在192.168.100.33观察: --//192.168.100.33上执行: $ lsnrctl status LISTENER LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 12-OCT-2021 08:33:06 Copyright (c) 1991, 2007, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.33)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production Start Date 12-OCT-2021 08:30:51 Uptime 0 days 0 hr. 2 min. 15 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.33)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0))) Services Summary... Service "BOOKSHARE" has 1 instance(s). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instance "book", status READY, has 1 handler(s) for this service... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "book" has 1 instance(s). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instance "book", status READY, has 1 handler(s) for this service... Service "bookXDB" has 1 instance(s). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instance "book", status READY, has 1 handler(s) for this service... Service "iiiii" has 1 instance(s). Instance "iiiiidg", status UNKNOWN, has 1 handler(s) for this service... Service "test" has 1 instance(s). Instance "test", status READY, has 1 handler(s) for this service... Service "testXDB" has 1 instance(s). Instance "test", status READY, has 1 handler(s) for this service... Service "test_XPT" has 1 instance(s). Instance "test", status READY, has 1 handler(s) for this service... The command completed successfully --//已经看到100.78的服务名. $ lsnrctl service LISTENER LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 12-OCT-2021 08:34:54 Copyright (c) 1991, 2007, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.33)(PORT=1521))) Services Summary... Service "BOOKSHARE" has 1 instance(s). Instance "book", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready REMOTE SERVER ~~~~~~~~~~~~~~~~~~~~~~ (ADDRESS=(PROTOCOL=TCP)(HOST=ppppdg4)(PORT=1521)) 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 "book" has 1 instance(s). Instance "book", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready REMOTE SERVER ~~~~~~~~~~~~~~~~~~~~~~~~ (ADDRESS=(PROTOCOL=TCP)(HOST=ppppdg4)(PORT=1521)) Service "bookXDB" has 1 instance(s). Instance "book", status READY, has 1 handler(s) for this service... Handler(s): "D000" established:0 refused:0 current:0 max:1022 state:ready DISPATCHER <machine: ppppdg4, pid: 47168> (ADDRESS=(PROTOCOL=tcp)(HOST=ppppdg4.com)(PORT=57181)) Service "iiiii" has 1 instance(s). Instance "iiiiidg", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 LOCAL SERVER Service "test" has 1 instance(s). Instance "test", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "testXDB" has 1 instance(s). Instance "test", status READY, has 1 handler(s) for this service... Handler(s): "D000" established:0 refused:0 current:0 max:1022 state:ready DISPATCHER <machine: iiiiidg, pid: 23483> (ADDRESS=(PROTOCOL=tcp)(HOST=iiiiidg)(PORT=19254)) Service "test_XPT" has 1 instance(s). Instance "test", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER The command completed successfully --//也看到远程的服务. 4.开始测试: --//在其他客户端执行: d:\>sqlplus -s -l scott/book@192.168.100.33:1521/book @ ver1 ERROR: ORA-12545: Connect failed because target host or object does not exist SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus --//不行. --//192.168.100.78上执行: SYS@book> alter system set local_listener="(DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1521)))" scope=memory; System altered. d:\>echo @ver | sqlplus -s -l scott/book@192.168.100.33:1521/book BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production --//OK,通过192.168.100.33的监听服务器连接了192.168.100.78的数据库book. d:\>d:\tools\linux\usr\local\wbin\echo -n "select * from v$instance\n@prxx" | sqlplus -s -l scott/book@192.168.100.33:1521/book ============================== INSTANCE_NUMBER : 1 INSTANCE_NAME : book HOST_NAME : ppppdg4 VERSION : 11.2.0.4.0 STARTUP_TIME : 2021-10-12 08:32:18 STATUS : OPEN PARALLEL : NO THREAD# : 1 ARCHIVER : STARTED LOG_SWITCH_WAIT : LOGINS : ALLOWED SHUTDOWN_PENDING : NO DATABASE_STATUS : ACTIVE INSTANCE_ROLE : PRIMARY_INSTANCE ACTIVE_STATE : NORMAL BLOCKED : NO PL/SQL procedure successfully completed. d:\>d:\tools\linux\usr\local\wbin\echo -n "select * from v$instance\n@prxx" | sqlplus -s -l scott/btbtms@192.168.100.33:1521/test ============================== INSTANCE_NUMBER : 1 INSTANCE_NAME : test HOST_NAME : iiiiidg VERSION : 10.2.0.4.0 STARTUP_TIME : 2021-10-11 11:20:21 STATUS : OPEN PARALLEL : NO THREAD# : 1 ARCHIVER : STARTED LOG_SWITCH_WAIT : LOGINS : ALLOWED SHUTDOWN_PENDING : NO DATABASE_STATUS : ACTIVE INSTANCE_ROLE : PRIMARY_INSTANCE ACTIVE_STATE : NORMAL BLOCKED : NO PL/SQL procedure successfully completed. --//连上192.168.100.33的数据库也是ok的. 5.实际上我个人的感觉与rac的方式类似. --//在我结束测试时,我发现我在192.168.100.78的listener.ora文件有一行. #SECURE_REGISTER_LISTENER= (TCP) --//我估计当时这个就是限制远程注册的问题,估计当时我做过类似测试然后注解了.时间太久,记不住了. --//我检索SECURE_REGISTER_LISTENER= (TCP),发现如下链接: https://www.oracle.com/security-alerts/alert-cve-2012-1675.html https://blog.csdn.net/brj880719/article/details/53158507 --//这样如果在192.168.100.33的listener.ora文件中上加入: SECURE_REGISTER_LISTENER= (TCP) --//就可以限制远程注册监听.但我的测试无效,不知道为什么? --//我在192.168.100.78listener.ora文件中上加入: SECURE_REGISTER_LISTENER= (TCP) --//并且两边监听我都重启了还是无效. --//实际上没有意思,因为如果在192.168.100.78上停止监听,就无法连上数据库了.因为还是要转到本地监听上来. --//192.168.100.78上执行: $ lsnrctl stop LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-OCT-2021 09:03:53 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521))) The command completed successfully --//在其他客户端执行: d:\>echo select * from v$instance ; | sqlplus -s -l scott/book@192.168.100.33:1521/book ERROR: ORA-12516: TNS:listener could not find available handler with matching protocol stack SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus --//记录一下tcpdump的情况: --//192.168.100.33上执行: # tcpdump -i eth0 host 192.168.98.6 and not port 22 -nnn -vvv 09:19:55.025273 IP (tos 0x0, ttl 198, id 28733, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.98.6.53911 > 192.168.100.33.1521: S, cksum 0x583a (correct), 3273750722:3273750722(0) win 8192 <mss 1460,nop,wscale 2,sackOK,timestamp 357344 0> 09:19:55.025316 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.100.33.1521 > 192.168.98.6.53911: S, cksum 0xd45c (correct), 2905775146:2905775146(0) ack 3273750723 win 5792 <mss 1460,sackOK,timestamp 3900857159 357344,nop,wscale 7> 09:19:55.027141 IP (tos 0x0, ttl 198, id 28734, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.98.6.53911 > 192.168.100.33.1521: ., cksum 0xd8bc (correct), 1:1(0) ack 1 win 16652 <nop,nop,timestamp 357344 3900857159> 09:19:55.027802 IP (tos 0x0, ttl 198, id 28735, offset 0, flags [DF], proto: TCP (6), length: 330) 192.168.98.6.53911 > 192.168.100.33.1521: P 1:279(278) ack 1 win 16652 <nop,nop,timestamp 357344 3900857159> 09:19:55.027833 IP (tos 0x0, ttl 64, id 51042, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.33.1521 > 192.168.98.6.53911: ., cksum 0x187b (correct), 1:1(0) ack 279 win 54 <nop,nop,timestamp 3900857161 357344> 09:19:55.028046 IP (tos 0x0, ttl 64, id 51043, offset 0, flags [DF], proto: TCP (6), length: 62) 192.168.100.33.1521 > 192.168.98.6.53911: P, cksum 0x121f (correct), 1:11(10) ack 279 win 54 <nop,nop,timestamp 3900857162 357344> 09:19:55.028079 IP (tos 0x0, ttl 64, id 51044, offset 0, flags [DF], proto: TCP (6), length: 379) 192.168.100.33.1521 > 192.168.98.6.53911: P 11:338(327) ack 279 win 54 <nop,nop,timestamp 3900857162 357344> 09:19:55.028096 IP (tos 0x0, ttl 64, id 51045, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.33.1521 > 192.168.98.6.53911: F, cksum 0x1728 (correct), 338:338(0) ack 279 win 54 <nop,nop,timestamp 3900857162 357344> 09:19:55.029280 IP (tos 0x0, ttl 198, id 28737, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.98.6.53911 > 192.168.100.33.1521: ., cksum 0xd6a7 (correct), 279:279(0) ack 338 win 16567 <nop,nop,timestamp 357344 3900857162> 09:19:55.029339 IP (tos 0x0, ttl 198, id 28738, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.98.6.53911 > 192.168.100.33.1521: ., cksum 0xd6a6 (correct), 279:279(0) ack 339 win 16567 <nop,nop,timestamp 357344 3900857162> 09:19:55.029353 IP (tos 0x0, ttl 198, id 28739, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.98.6.53911 > 192.168.100.33.1521: F, cksum 0xd6a5 (correct), 279:279(0) ack 339 win 16567 <nop,nop,timestamp 357344 3900857162> 09:19:55.029366 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.33.1521 > 192.168.98.6.53911: ., cksum 0x1726 (correct), 339:339(0) ack 280 win 54 <nop,nop,timestamp 3900857163 357344> # tcpdump -i eth0 host 192.168.98.6 and not port 22 and not port 1522 -nnn -vvv tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 09:19:55.022505 IP (tos 0x0, ttl 198, id 28741, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.98.6.53912 > 192.168.100.78.1521: S, cksum 0x2c50 (correct), 2881010663:2881010663(0) win 8192 <mss 1460,nop,wscale 2,sackOK,timestamp 357344 0> 09:19:55.022660 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.100.78.1521 > 192.168.98.6.53912: S, cksum 0x47d4 (incorrect (-> 0xe013), 444229427:444229427(0) ack 2881010664 win 14480 <mss 1460,sackOK,timestamp 3872377624 357344,nop,wscale 7> 09:19:55.024420 IP (tos 0x0, ttl 198, id 28744, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.98.6.53912 > 192.168.100.78.1521: ., cksum 0x0663 (correct), 1:1(0) ack 1 win 16652 <nop,nop,timestamp 357345 3872377624> 09:19:55.024522 IP (tos 0x0, ttl 198, id 28745, offset 0, flags [DF], proto: TCP (6), length: 122) 192.168.98.6.53912 > 192.168.100.78.1521: P 1:71(70) ack 1 win 16652 <nop,nop,timestamp 357345 3872377624> 09:19:55.024533 IP (tos 0x0, ttl 64, id 44078, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.98.6.53912: ., cksum 0x47cc (incorrect (-> 0x46b5), 1:1(0) ack 71 win 114 <nop,nop,timestamp 3872377626 357345> 09:19:55.024683 IP (tos 0x0, ttl 198, id 28746, offset 0, flags [DF], proto: TCP (6), length: 308) 192.168.98.6.53912 > 192.168.100.78.1521: P 71:327(256) ack 1 win 16652 <nop,nop,timestamp 357345 3872377624> 09:19:55.024692 IP (tos 0x0, ttl 64, id 44079, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.98.6.53912: ., cksum 0x47cc (incorrect (-> 0x45ad), 1:1(0) ack 327 win 122 <nop,nop,timestamp 3872377626 357345> 09:19:55.048613 IP (tos 0x0, ttl 64, id 44080, offset 0, flags [DF], proto: TCP (6), length: 60) 192.168.100.78.1521 > 192.168.98.6.53912: P, cksum 0x47d4 (incorrect (-> 0x3a79), 1:9(8) ack 327 win 122 <nop,nop,timestamp 3872377650 357345> 09:19:55.049265 IP (tos 0x0, ttl 198, id 28749, offset 0, flags [DF], proto: TCP (6), length: 122) 192.168.98.6.53912 > 192.168.100.78.1521: P 327:397(70) ack 9 win 16650 <nop,nop,timestamp 357347 3872377650> 09:19:55.049367 IP (tos 0x0, ttl 198, id 28750, offset 0, flags [DF], proto: TCP (6), length: 308) 192.168.98.6.53912 > 192.168.100.78.1521: P 397:653(256) ack 9 win 16650 <nop,nop,timestamp 357347 3872377650> 09:19:55.049408 IP (tos 0x0, ttl 64, id 44081, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.98.6.53912: ., cksum 0x47cc (incorrect (-> 0x443c), 9:9(0) ack 653 win 130 <nop,nop,timestamp 3872377651 357347> 09:19:55.049461 IP (tos 0x0, ttl 64, id 44082, offset 0, flags [DF], proto: TCP (6), length: 84) 192.168.100.78.1521 > 192.168.98.6.53912: P 9:41(32) ack 653 win 130 <nop,nop,timestamp 3872377651 357347> 09:19:55.050654 IP (tos 0x0, ttl 198, id 28752, offset 0, flags [DF], proto: TCP (6), length: 228) 192.168.98.6.53912 > 192.168.100.78.1521: P 653:829(176) ack 41 win 16642 <nop,nop,timestamp 357347 3872377651> 09:19:55.050899 IP (tos 0x0, ttl 64, id 44083, offset 0, flags [DF], proto: TCP (6), length: 179) 192.168.100.78.1521 > 192.168.98.6.53912: P 41:168(127) ack 829 win 139 <nop,nop,timestamp 3872377652 357347> 09:19:55.068381 IP (tos 0x0, ttl 198, id 28754, offset 0, flags [DF], proto: TCP (6), length: 87) 192.168.98.6.53912 > 192.168.100.78.1521: P 829:864(35) ack 168 win 16610 <nop,nop,timestamp 357349 3872377652> 09:19:55.068553 IP (tos 0x0, ttl 64, id 44084, offset 0, flags [DF], proto: TCP (6), length: 270) 192.168.100.78.1521 > 192.168.98.6.53912: P 168:386(218) ack 864 win 139 <nop,nop,timestamp 3872377670 357349> 09:19:55.070468 IP (tos 0x0, ttl 198, id 28757, offset 0, flags [DF], proto: TCP (6), length: 1500) 192.168.98.6.53912 > 192.168.100.78.1521: . 864:2312(1448) ack 386 win 16555 <nop,nop,timestamp 357349 3872377670> 09:19:55.070561 IP (tos 0x0, ttl 198, id 28758, offset 0, flags [DF], proto: TCP (6), length: 1666) 192.168.98.6.53912 > 192.168.100.78.1521: P 2312:3926(1614) ack 386 win 16555 <nop,nop,timestamp 357349 3872377670> 09:19:55.070597 IP (tos 0x0, ttl 64, id 44085, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.98.6.53912: ., cksum 0x47cc (incorrect (-> 0x35aa), 386:386(0) ack 3926 win 187 <nop,nop,timestamp 3872377672 357349> 09:19:55.071435 IP (tos 0x0, ttl 64, id 44086, offset 0, flags [DF], proto: TCP (6), length: 1500) 192.168.100.78.1521 > 192.168.98.6.53912: . 386:1834(1448) ack 3926 win 187 <nop,nop,timestamp 3872377673 357349> 09:19:55.071447 IP (tos 0x0, ttl 64, id 44087, offset 0, flags [DF], proto: TCP (6), length: 1104) 192.168.100.78.1521 > 192.168.98.6.53912: P 1834:2886(1052) ack 3926 win 187 <nop,nop,timestamp 3872377673 357349> 09:19:55.077711 IP (tos 0x0, ttl 198, id 28761, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.98.6.53912 > 192.168.100.78.1521: ., cksum 0xeb92 (correct), 3926:3926(0) ack 2886 win 16652 <nop,nop,timestamp 357350 3872377673> 09:19:55.077866 IP (tos 0x0, ttl 198, id 28762, offset 0, flags [DF], proto: TCP (6), length: 299) 192.168.98.6.53912 > 192.168.100.78.1521: P 3926:4173(247) ack 2886 win 16652 <nop,nop,timestamp 357350 3872377673> 09:19:55.079765 IP (tos 0x0, ttl 64, id 44088, offset 0, flags [DF], proto: TCP (6), length: 372) 192.168.100.78.1521 > 192.168.98.6.53912: P 2886:3206(320) ack 4173 win 209 <nop,nop,timestamp 3872377681 357350> 09:19:55.084628 IP (tos 0x0, ttl 198, id 28766, offset 0, flags [DF], proto: TCP (6), length: 234) 192.168.98.6.53912 > 192.168.100.78.1521: P 5621:5803(182) ack 3206 win 16572 <nop,nop,timestamp 357351 3872377681> 09:19:55.084649 IP (tos 0x0, ttl 198, id 28765, offset 0, flags [DF], proto: TCP (6), length: 1500) 192.168.98.6.53912 > 192.168.100.78.1521: . 4173:5621(1448) ack 3206 win 16572 <nop,nop,timestamp 357351 3872377681> 09:19:55.084673 IP (tos 0x0, ttl 64, id 44089, offset 0, flags [DF], proto: TCP (6), length: 64) 192.168.100.78.1521 > 192.168.98.6.53912: ., cksum 0x47d8 (incorrect (-> 0xf791), 3206:3206(0) ack 4173 win 209 <nop,nop,timestamp 3872377686 357350,nop,nop,sack 1 {5621:5803}>
[20211012]测试远程监听.txt
来源:这里教程网
时间:2026-03-03 17:01:42
作者:
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- RAC11g搭建-centos7+openfiler+multipath+udev
- ORACLE 11g rac for linux升级到19c后台进程Space Manager:slave idle wait过多
- 荣耀手机反弹的法门
荣耀手机反弹的法门
26-03-03 - oracle19c安装 单实例 系统centos7 非cdb
oracle19c安装 单实例 系统centos7 非cdb
26-03-03 - 字节跳动再启音乐梦
字节跳动再启音乐梦
26-03-03 - 【SQL】Oracle SQL处理的流程
【SQL】Oracle SQL处理的流程
26-03-03 - 【SQL】Oracle SQL共享池检查
【SQL】Oracle SQL共享池检查
26-03-03 - Oracle 21C下载和安装
Oracle 21C下载和安装
26-03-03 - oracle11g安装 单实例 系统centos7
oracle11g安装 单实例 系统centos7
26-03-03 - Oracle 19c- 19.8应用32242453补丁
Oracle 19c- 19.8应用32242453补丁
26-03-03
