[20190115]關於共享服務與專用模式.txt
[20190115]關於共享服務與專用模式.txt
--//前幾天看https://www.cnblogs.com/kerrycode/p/10252951.html的連結,原來許多不理解的問題一下理解了.
--//關於配置共享服務的問題,最好使用單獨的服務名,不要一個服務名支援兩種模式,這樣很容易出現一些怪問題.
--//我在這方面吃了許多苦頭.
--//有一些配置網路連線串,選擇預設連線模式,這樣就沒有SERVER = SHARED,SERVER = DEDICATED這些內容.
--//而如果服務名支援兩種模式,在沒有明確配置的情況下,優先選擇共享模式.
--//另外共享服務模式關閉直接路徑讀,非同步IO,支援並行模式.參考連結:
http://blog.itpub.net/267265/viewspace-2151928/
http://blog.itpub.net/267265/viewspace-2151913/
http://blog.itpub.net/267265/viewspace-2130292/
--//如何區分這些服務支援那些模式,哪一些是靜態註冊的服務我自己也是很混亂的.透過我測試環境說明.
1.環境:
SCOTT@book> @ 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
--//首先關閉資料庫重啟監聽.
--//我的監聽檔案配置如下:
$ grep -v "^#" listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = booK123)
(ARGV0=myapp0)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME=book)
)
)
SID_LIST_LISTENERz =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = booK123)
(ARGV0=myapp0)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME=book)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(ARGV0=LLLLLL)(HOST = 0.0.0.0)(PORT = 1521)(ARGV0=KKKKK))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
LISTENERz =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SECURE_REGISTER_LISTENER = (TCP)
ADR_BASE_LISTENER = /u01/app/oracle
DIAG_ADR_ENABLED_LISTENER=OFF
USE_NS_PROBES_FOR_DCD=true
INBOUND_CONNECT_TIMEOUT_LISTENER=10
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 11:01:46
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(ARGV0=LLLLLL)(HOST=0.0.0.0)(PORT=1521)(ARGV0=KKKKK)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 15-JAN-2019 10:52:18
Uptime 0 days 0 hr. 9 min. 28 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/product/11.2.0.4/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
--//有1個服務booK123,這是1個靜態註冊服務名,狀態UNKNOWN.因為靜態註冊服務名根本不知道例項名為book的資料庫是否存在.
$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 11:02:11
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(ARGV0=LLLLLL)(HOST=0.0.0.0)(PORT=1521)(ARGV0=KKKKK)))
Services Summary...
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
The command completed successfully
--//這個服務名僅僅支援DEDICATED模式.
--//實際上這個時候是透過透過服務名book123遠端連線資料庫的.
d:\>sqlplus sys@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=book123))) as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 15 11:12:45 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.
--//注意一點這樣寫連線串裡面不能有空格.這樣可以實現遠端啟動資料庫.這也是為什麼配置dg要求配置靜態註冊服務名的主要原因.
--//注:如果連線串裡面有空格,要使用雙引號,避免作為引數解析.
2.啟動資料庫(nomount):
SYS@book> startup nomount
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
Redo Buffers 7487488 bytes
--//nomount僅僅啟動例項.
SYS@book> show parameter service_name
NAME TYPE VALUE
------------- ------ ---------------
service_names string BOOK, BOOKSHARE
SYS@book> show parameter dispatchers
NAME TYPE VALUE
----------- ------ -------------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=book,bookXDB)
$ lsnrctl status
....
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status BLOCKED, has 1 handler(s) for this service...
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Service "book" has 1 instance(s).
Instance "book", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
$ lsnrctl services
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status BLOCKED, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:2 refused:0
LOCAL SERVER
Service "book" has 1 instance(s).
Instance "book", status BLOCKED, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
--//增加2個服務名,BOOKSHARE,book,狀態是BLOCKED.因為這個時候資料庫還沒有到mount狀態.
--//注意這個時候並沒有啟動共享服務book,bookxdb.雖然s000,d000程式已經啟動.
$ ps -ef | egrep 's00[0]|d00[0]'
oracle 49808 1 0 11:16 ? 00:00:00 ora_d000_book
oracle 49810 1 0 11:16 ? 00:00:00 ora_s000_book
--//這個時候遠端客戶端無法使用服務名BOOKSHARE,book.不過有一個方法繞過.加入(UR=A),這個相當於一個後門.
d:\>sqlplus sys@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(UR=A)(SERVICE_NAME=book))) as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 15 11:18:54 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
--//這樣寫sqlplus sys@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(UR=A)(SERVICE_NAME=bookshare))) as sysdba
--//不寫(UR=A)報如下錯誤.
--//ORA-12528: TNS:listener: all appropriate instances are blocking new connections
3.啟動資料庫(mount):
SYS@book> alter database mount ;
Database altered.
$ lsnrctl status
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 1 instance(s).
Instance "book", 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...
The command completed successfully
$ lsnrctl service
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 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:3 refused:0 state:ready
LOCAL SERVER
The command completed successfully
--//與nomount狀態很相似,僅僅服務名BOOKSHARE,book,狀態是READY.也就是這個時候遠端客戶端可以連線資料庫,連線串可以不用
--//(UR=A),當然限制sys使用者.因為資料庫還沒有起來.
--//並且3個服務BOOKSHARE,book,booK123僅僅支援專用服務模式.
d:\> sqlplus sys@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=book))) as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 15 11:29:11 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
--//sqlplus sys@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bookshare))) as sysdba
--//一樣ok.
4.啟動資料庫(open):
SYS@book> alter database open ;
Database altered.
$ lsnrctl status
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Service "book" has 1 instance(s).
Instance "book", status READY, has 2 handler(s) for this service...
Service "bookXDB" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
The command completed successfully
--//服務名增加了bookXDB.
$ lsnrctl services
..
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:6 refused:0 state:ready
LOCAL SERVER
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:4 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:6 refused:0 state:ready
LOCAL SERVER
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
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: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
The command completed successfully
--//可以注意一個細節,bookxdb僅僅支援共享服務模式.而book服務名增加了共享服務模式.
5.繼續測試:
SYS@book> alter system set dispatchers='(PROTOCOL=TCP) (SERVICE=bookXDB,bookz,book123)' scope=memory;
System altered.
SYS@book> alter system register ;
System altered.
--//給共享伺服器模式增加bookz,book123服務名.並且取消了服務名book的共享服務模式.
$ lsnrctl service
..
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:6 refused:0 state:ready
LOCAL SERVER
Service "booK123" has 2 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:4 refused:0
LOCAL SERVER
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: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
Service "book" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:6 refused:0 state:ready
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCAL SERVER
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: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
Service "bookz" 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: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
The command completed successfully
--//可以發現服務名book123,bookz增加支援共享服務模式,而服務名book的共享服務模式被取消了,僅僅支援專用連線模式.
SYS@book> alter system set dispatchers='(PROTOCOL=TCP) (SERVICE=bookXDB)' scope=memory;
System altered.
$ lsnrctl status
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 2 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Instance "book", status READY, has 0 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 "bookz" has 1 instance(s).
Instance "book", status READY, has 0 handler(s) for this service...
The command completed successfully
--//注意看book123服務名現在出現兩種狀態,status=UNKNOWN,READY.實際上我已經取消了book123的共享服務模式,但是
--//這樣操作無法刪除book123動態註冊的服務名,包括bookz也一樣.
--//注意對應的handler(s)=0.
$ lsnrctl service
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:6 refused:0 state:ready
LOCAL SERVER
Service "booK123" has 2 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:4 refused:0
LOCAL SERVER
Instance "book", status READY, has 0 handler(s) for this service...
Service "book" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:6 refused:0 state:ready
LOCAL SERVER
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: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
Service "bookz" has 1 instance(s).
Instance "book", status READY, has 0 handler(s) for this service...
--//可以發現當前僅僅bookxdb支援共享服務模式.其它服務名支援專用服務模式(除了bookz服務名).
--//另外可以發現bookz服務還存在,但是2種模式都不支援.視乎oracle無法刪除bookz這個服務.
--//bookz 對應的handler(s)=0.
SYS@book> exec dbms_service.stop_service('bookz');
BEGIN dbms_service.stop_service('bookz'); END;
*
ERROR at line 1:
ORA-44311: service bookz not running
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_SERVICE", line 466
ORA-06512: at "SYS.DBMS_SERVICE", line 400
ORA-06512: at line 1
SYS@book> alter system set service_names=BOOK,BOOKSHARE,bookz scope=memory;
System altered.
$ lsnrctl status
..
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 2 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Instance "book", status READY, has 0 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...
The command completed successfully
SYS@book> alter system set service_names=BOOK,BOOKSHARE scope=memory;
System altered.
$ lsnrctl status
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 2 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Instance "book", status READY, has 0 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...
The command completed successfully
$ lsnrctl services
...
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
LOCAL SERVER
Service "booK123" has 2 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:4 refused:0
LOCAL SERVER
Instance "book", status READY, has 0 handler(s) for this service...
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
LOCAL SERVER
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: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
The command completed successfully
--//這樣才能刪除bookz服務名.
SYS@book> alter system set service_names=BOOK,BOOKSHARE,book123 scope=memory;
System altered.
SYS@book> alter system set service_names=BOOK,BOOKSHARE scope=memory;
System altered.
$ lsnrctl status
...
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 1 instance(s).
Instance "book", 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...
The command completed successfully
--//服務名book123的動態註冊才會刪除.
6.再啟動一個監聽服務名看看.
--//我前面的監聽配置還配置了一個監聽服務名LISTENERz.預設如果你啟動監聽服務執行lsnrctl start,啟動的是預設的
--//listener監聽.我以前遇到一個問題就是對方配置一個特殊監聽服務名,導致我執行lsnrctl start,client段無法連線資料庫.
$ grep -v "^#" listener.ora
...
SID_LIST_LISTENERz =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = booK123)
(ARGV0=myapp0)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME=book)
)
)
..
LISTENERz =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
$ netstat -nap | grep :1521 | grep tn[s]
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 49554/tnslsnr
tcp 0 0 192.168.100.78:1521 192.168.100.78:22140 ESTABLISHED 49554/tnslsnr
$ lsnrctl start listenerz
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 12:12:30
Copyright (c) 1991, 2013, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
--//無法啟動.
$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 12:12:55
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(ARGV0=LLLLLL)(HOST=0.0.0.0)(PORT=1521)(ARGV0=KKKKK)))
The command completed successfully
$ lsnrctl start listenerz
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 12:13:00
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0.4/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.4/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/xxxxxyyy/listenerz/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listenerz
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 15-JAN-2019 12:13:00
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.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/xxxxxyyy/listenerz/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
$ lsnrctl services listenerz
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 12:17:22
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1522)))
Services Summary...
Service "booK123" has 1 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
The command completed successfully
$ netstat -nap | grep :1522 | grep tn[s]
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 192.168.100.78:1522 0.0.0.0:* LISTEN 50219/tnslsnr
tcp 0 0 127.0.0.1:1522 0.0.0.0:* LISTEN 50219/tnslsnr
--//可以發現其它服務名book,bookshare沒有動態註冊成功.因為pmon程式預設註冊使用1521埠.
$ ps -ef | grep pmo[n]
oracle 49772 1 0 11:16 ? 00:00:02 ora_pmon_book
$ strace -f -p 49772 -e network
Process 49772 attached - interrupt to quit
getsockopt(0, SOL_SOCKET, SO_SNDBUF, 0x7fffedf9fabc, 0x7fffedf9fab8) = -1 ENOTSOCK (Socket operation on non-socket)
getsockopt(0, SOL_SOCKET, SO_RCVBUF, 0x7fffedf9fabc, 0x7fffedf9fab8) = -1 ENOTSOCK (Socket operation on non-socket)
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 10
connect(10, {sa_family=AF_INET, sin_port=htons(1521), sin_addr=inet_addr("192.168.100.78")}, 16) = -1 EINPROGRESS (Operation now in progress)
getsockopt(10, SOL_SOCKET, SO_SNDBUF, [-1298728016444112896], [4]) = 0
getsockopt(10, SOL_SOCKET, SO_RCVBUF, [-1298728016444041900], [4]) = 0
getsockname(10, {sa_family=AF_INET, sin_port=htons(25054), sin_addr=inet_addr("192.168.100.78")}, [16]) = 0
^CProcess 49772 detached
--//因為啟動監聽使用1522,無法動態註冊成功.必須修改引數local_listener.參考連結:
--//http://blog.itpub.net/267265/viewspace-2083455/=>[20160418]修改oracle監聽埠.txt
SYS@book> alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1522))' scope=memory ;
System altered.
SYS@book> alter system register;
System altered.
$ strace -f -p 49772 -e network
Process 49772 attached - interrupt to quit
getsockopt(0, SOL_SOCKET, SO_SNDBUF, 0x7fffedf9fabc, 0x7fffedf9fab8) = -1 ENOTSOCK (Socket operation on non-socket)
getsockopt(0, SOL_SOCKET, SO_RCVBUF, 0x7fffedf9fabc, 0x7fffedf9fab8) = -1 ENOTSOCK (Socket operation on non-socket)
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 10
connect(10, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("192.168.100.78")}, 16) = -1 EINPROGRESS (Operation now in progress)
getsockopt(10, SOL_SOCKET, SO_SNDBUF, [-1298728016444077260], [4]) = 0
getsockopt(10, SOL_SOCKET, SO_RCVBUF, [-1298728016443998016], [4]) = 0
getsockname(10, {sa_family=AF_INET, sin_port=htons(3098), sin_addr=inet_addr("192.168.100.78")}, [16]) = 0
^CProcess 49772 detached
SYS@book> show parameter service
NAME TYPE VALUE
------------- ------ ---------------
service_names string BOOK, BOOKSHARE
SYS@book> show parameter dispatchers
NAME TYPE VALUE
----------- ------ --------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=bookXDB)
$ lsnrctl status listenerz
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 15:34:46
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listenerz
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 15-JAN-2019 15:32:05
Uptime 0 days 0 hr. 2 min. 40 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/xxxxxyyy/listenerz/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 1 instance(s).
Instance "book", 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...
The command completed successfully
$ lsnrctl services listenerz
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 14:58:50
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1522)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
LOCAL SERVER
Service "booK123" has 1 instance(s).
Instance "book", 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
LOCAL SERVER
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: xxxxxyyy, pid: 49808>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=26919))
The command completed successfully
--//這裡僅僅看到127.0.0.1的IP.,不過遠端能正常登入資料庫.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2558389/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20190115]共享服務模式與啟動到mount狀態.txt模式
- [20161212]ezconnect與共享服務模式.txt模式
- [20190306]共享服務模式與SDU.txt模式
- [20160830]使用共享服務模式的弊端.txt模式
- [20180316]非同步IO和共享服務模式.txt非同步模式
- [20180316]共享服務模式和直接路徑讀.txt模式
- win10如何關閉共享服務_win10共享服務怎麼開啟Win10
- 檔案共享服務
- [20200218]連線串與專用模式.txt模式
- FTP檔案共享服務FTP
- 求助:關於應用設計模式設計模式
- 共享服務-FTP基礎(一)FTP
- 網路檔案共享服務
- 關於複雜任務與異常處理的設計模式探討!設計模式
- 【web服務】耗時任務基於API與worker模式WebAPI模式
- 關於用設計模式代替if else的迷惑設計模式
- 關於Decorator模式模式
- 關於Template模式模式
- 關於《java與模式》一書中工廠方法模式的異議?Java模式
- 如何實現Samba檔案共享服務Samba
- redhat7 配置檔案共享服務Redhat
- 【openEuler系列】部署檔案共享服務SambaSamba
- 《NFS檔案共享服務的搭建》RHELNFS
- 部署YUM倉庫及NFS共享服務NFS
- 關於應用整合:同步與非同步通訊模式之間的比較非同步模式
- oracle asm normal redundancy 模式運用於專案中OracleASMORM模式
- 《關於微服務》微服務
- 關於微服務微服務
- 關於單例模式單例模式
- 關於門面模式模式
- 關於設計模式設計模式
- 關於非同步方法中的巨集任務與微任務非同步
- postgresql與oracle關於事務定義的描述SQLOracle
- 關於多例模式-from單例模式模式單例
- 關於Adapter模式和Decorator模式APT模式
- [20170309]關於線上日誌與歸檔1.txt
- [20170309]關於線上日誌與歸檔2.txt
- [20170310]關於線上日誌與歸檔3.txt