[20190115]共享服務模式與啟動到mount狀態.txt

lfree發表於2019-01-15

[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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章