ITPub博客

首页 > 数据库 > Oracle > [20190115]关于共享服务与专用模式.txt

[20190115]关于共享服务与专用模式.txt

原创 Oracle 作者:lfree 时间:2019-01-15 16:07:52 1 删除 编辑

[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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2852
  • 访问量
    6641169