[20190115]共享服务模式与启动到mount状态.txt
--//当数据库启动到mount状态时是看不到共享服务模式的.测试是否直接使用端口连接数据库.
1.环境:
SYS@book> @ ver
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> startup mount
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
Database mounted.
SYS@book> show parameter dispatchers
NAME TYPE VALUE
----------- ------ -------------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=book,bookXDB)
SYS@book> show parameter service_names
NAME TYPE VALUE
------------- ------ ---------------
service_names string BOOK, BOOKSHARE
$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 16:21:20
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 "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
The command completed successfully
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 16:21:30
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 16:10:13
Uptime 0 days 0 hr. 11 min. 17 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 "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
--//启动没有看到共享服务模式.
2.查询共享模式打开的监听端口,测试是否能连上数据库.
$ ps -ef | egrep "d00[0]|s00[0]"
oracle 51897 1 0 16:10 ? 00:00:00 ora_d000_book
oracle 51899 1 0 16:10 ? 00:00:00 ora_s000_book
--//而实际上在mount状态,s000,d000进程已经启动.
# netstat -tunlp | egrep 'Active|Proto|tnslsnr|book'
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 51849/tnslsnr
tcp 0 0 :::52642 :::* LISTEN 51897/ora_d000_book
udp 0 0 ::1:14493 :::* 51861/ora_pmon_book
udp 0 0 ::1:30118 :::* 51899/ora_s000_book
udp 0 0 ::1:31628 :::* 51897/ora_d000_book
--//进程ora_d000_book(51897),已经打开了52642端口,在监听状态.
d:\>sqlplus sys/oracle@192.168.100.78:52642/book as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 15 16:33:43 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
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
SYS@192.168.100.78:52642/book> select open_mode from v$database ;
OPEN_MODE
--------------------
MOUNTED
--//可以连上数据库.
d:\>sqlplus -s -l sys/oracle@192.168.100.78:52642/bookxdb as sysdba
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
d:\>sqlplus -s -l sys/oracle@192.168.100.78:52642/bookshare as sysdba
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
d:\>sqlplus -s -l sys/oracle@192.168.100.78:52642/book123 as sysdba
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
--//说明仅仅book服务名可以连上.
3.启动到open,继续观察测试:
SYS@book> alter database open ;
Database altered.
$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JAN-2019 16:43:26
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 "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 2 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: xxxxxyyy, pid: 51897>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=52642))
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: 51897>
(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxyyy.com)(PORT=52642))
The command completed successfully
d:\>sqlplus -l sys/oracle@192.168.100.78:52642/book as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 15 16:44:44 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
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
d:\tools\sqltemp>sqlplus -l sys/oracle@192.168.100.78:52642/bookxdb as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 15 16:45:05 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
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
SYS@192.168.100.78:52642/bookxdb> select open_mode from v$database ;
OPEN_MODE
--------------------
READ WRITE
--//这个时候使用book,bookxdb服务名都可以连上.
--//从这里说明看出,从安全角度考虑,配置服务名也许最佳的方法就是不要每个服务名支持两种连接模式.
--//静态注册使用服务名最好也与数据库动态的服务名不同.共享模式的服务名也最好分开配置.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2558415/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/267265/viewspace-2558415/