[20211013]測試遠端監聽補充.txt

lfree發表於2021-10-13

[20211013]測試遠端監聽補充.txt

--//昨天做了遠端監聽的測試,今天本想看看SECURE_REGISTER_LISTENER= (TCP),是否限制這個功能.
--//在測試前我遇到無法登入的情況.

1.測試環境。

--//資料庫在192.168.100.78 sid=book,監聽埠1521 版本11.2.0.4
--//監聽伺服器在192.168.100.33     ,監聽埠1521 版本10.2.0.4。
--//兩臺機器監聽同時啟動。

2.測試:
d:\>sqlplus -s -l scott/book@192.168.100.33:1521/book
ERROR:
ORA-12545: Connect failed because target host or object does not exist
SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

--//我自己檢查沒有問題,突然想起我昨天做的測試
--//http://blog.itpub.net/267265/viewspace-2795454/=>[20211012]sqlnet.ora USE_DEDICATED_SERVER=on.txt
--//我已經註解了USE_DEDICATED_SERVER=on.

--//我馬上取消註解,發現ok.
d:\notes\2021>echo @ ver1 | sqlplus -s -l scott/book@192.168.100.33:1521/book
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

--//這才想起來我昨天修改了引數dispatchers:
SYS@book> show parameter dispatchers
NAME        TYPE   VALUE
----------- ------ -------------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=book,bookXDB)

--//這樣導致book支援兩種模式 shared ,DEDICATED.使用ezconnect 預設不指明優先使用共享模式.
--//很明顯遠端監聽的方式不支援共享模式:

--//註解客戶端的sqlnet.ora檔案中的USE_DEDICATED_SERVER=on.

d:\notes\2021>sqlplus -s -l scott/book@192.168.100.33:1521/book
ERROR:
ORA-12545: Connect failed because target host or object does not exist
SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

--//我必須明確指明採用DEDICATED模式連線:
d:\notes\2021>echo @ver1 | sqlplus -s -l scott/book@192.168.100.33:1521/book:DEDICATED
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

--//在192.168.100.33上執行:
$ lsnrctl service

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 13-OCT-2021 10:10:36

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:11 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(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 2 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:11 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1521)))
      "D000" established:8 refused:0 current:4 max:1022 state:ready
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         DISPATCHER <machine: gxqyydg4, pid: 47703>
         (ADDRESS=(PROTOCOL=tcp)(HOST=gxqyydg4.com)(PORT=3012))
Service "bookXDB" has 1 instance(s).
  Instance "book", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:8 refused:0 current:4 max:1022 state:ready
         DISPATCHER <machine: gxqyydg4, pid: 47703>
         (ADDRESS=(PROTOCOL=tcp)(HOST=gxqyydg4.com)(PORT=3012))
Service "icare" has 1 instance(s).
  Instance "icaredg", 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: icaredg, pid: 23483>
         (ADDRESS=(PROTOCOL=tcp)(HOST=icaredg)(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

--//共享模式是註冊的.很明顯無法透過遠端監聽實現這個功能.
--//執行如下直接訪問埠.
d:\>sqlplus  scott/book@192.168.100.78:3012/book

SCOTT@192.168.100.78:3012/book> @ spid
       SID    SERIAL# PROCESS                  SERVER    SPID                     PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- -------------------- ------- ---------- --------------------------------------------------
       281         15 8512:8764                SHARED    47705                     20          1 alter system kill session '281,15' immediate;


3.關於SECURE_REGISTER_LISTENER=(TCP)限制我一直無法實現.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2795654/,如需轉載,請註明出處,否則將追究法律責任。

相關文章