Oracle监听的静态注册和动态注册

静态注册:经过解析listene.ora文件数据库

动态注册:由PMON进程动态注册至监听中oracle

在没有listener.ora配置文件的状况下,若是启动监听,则监听为动态注册。用图形化netca建立的监听,默认也为动态注册tcp

1.静态注册工具

listener.ora文件,监听的配置文件,静态注册读取该文件,动态注册,没必要要this

能够经过netca工具建立,也能够手动编辑。典型的listener.ora文件内容:spa

LISTENER_PHAMR =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = phamrdb1-vip)(PORT = 1521))
  )xml

 

SID_LIST_LISTENER_PHALR =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = phalr)
      (ORACLE_HOME = /oracle/product/11.2.0)
      (SID_NAME = phalr)
    )
  )进程

listener.ora文件两大模块:ip

LISTENER模块:监听名字、链接协议、监听主机、监听端口等基本配置信息ci

SID_LIST_LISTENER模块:配置监听的静态注册特性,包含数据库服务名、ORACLE_HOME、实例名等信息。

注意:SID_NAME,就是数据库实例名,在Linux环境大小写敏感

GLOBAL_DBNAME就是数据库服务名,能够省略,默认和SID_NAME保持一致,也能够不一致。

ORACLE_HOME,默认和$ORACLE_HOME环境变量保持一致。Windows,该参数无效,取自注册表。

静态注册,监听不知道实例的具体状态,因此监听启动之初查看实例信息,其状态信息显示为UNKNOWN.例如:

oracle@phamrdb1: /home/oracle> lsnrctl status LISTENER_PHAMR

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-NOV-2016 17:17:37

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=phamrdb1-vip)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_PHAMR
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                01-OCT-2016 14:12:51
Uptime                    47 days 3 hr. 4 min. 45 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/product/11.2.0/network/admin/listener.ora
Listener Log File         /oracle/diag/tnslsnr/phamrdb1/listener_phamr/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.178.1.64)(PORT=1521)))
Services Summary...
Service "phamr" has 1 instance(s).     监听状态中的服务名
  Instance "phamr", status UNKNOWN, has 1 handler(s) for this service...  监听状态中的实例名
The command completed successfully

2,动态注册
在动态注册监听的环境中,listener.ora文件能够不包括当前数据库的实例信息,因此这个文件没必要要。

实例启动时,会由Oracle PMON进程将数据库实例信息动态注册至监听上。

当Oracle实例关闭时,会再次由PMON进程自动从监听里面撤销当前实例信息。

因此,要实现动态注册,数据库的实例至少要处于nomount状态

监听动态注册时的实例状态:来自PMON进程动态注册时的实例状态,通常有3种状态:READY、BLOCKED和RESTRICED

READY:表示数据库实例已经处于mount或者open状态,能够接受客户端链接

BLOCKED:表示数据库实例还处于nomount状态或者该实例类型为ASM实例,不接受客户端链接,若是这时候客户端去连

               接数据库会报ora-12528错误

RESTRICED:表示数据库处于RESTRICED模式,不接受普通权限的远程客户端链接,若是这时候客户端去链接数据库会报

                  ora-12526错误

oracle@fsdata: /oracle/product/11.2.0/network/admin> lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-NOV-2016 16:01:43

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                17-NOV-2016 15:57:23
Uptime                    0 days 0 hr. 4 min. 19 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/diag/tnslsnr/fsdata/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fsdata)(PORT=1521)))
Services Summary...
Service "FSDATA" has 1 instance(s).
  Instance "FSDATA", status READY, has 1 handler(s) for this service...
Service "FSDATAXDB" has 1 instance(s).
  Instance "FSDATA", status READY, has 1 handler(s) for this service...
The command completed successfully

oracle@fsdata: /oracle/product/11.2.0/network/admin> lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-NOV-2016 15:58:47

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                17-NOV-2016 15:57:23
Uptime                    0 days 0 hr. 1 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/diag/tnslsnr/fsdata/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fsdata)(PORT=1521)))
Services Summary...
Service "FSDATA" has 1 instance(s).
  Instance "FSDATA", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

实例既能够动态注册,同时静态注册,状态分别显示为READYUNKNOWN

oracle@fsdata: /oracle/product/11.2.0/network/admin> lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-NOV-2016 17:50:14

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=fsdata)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                17-NOV-2016 15:57:23
Uptime                    0 days 1 hr. 52 min. 50 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/product/11.2.0/network/admin/listener.ora
Listener Log File         /oracle/diag/tnslsnr/fsdata/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fsdata)(PORT=1521)))
Services Summary...
Service "FSDATA" has 2 instance(s).
  Instance "FSDATA", status UNKNOWN, has 1 handler(s) for this service...
  Instance "FSDATA", status READY, has 1 handler(s) for this service...
Service "FSDATAXDB" has 1 instance(s).
  Instance "FSDATA", status READY, has 1 handler(s) for this service...
The command completed successfully

3.监听的经常使用命令

lsnrctl start [listener_name]

lsnrctl stop [listener_name]

lsnrctl status [listener_name]

lsnrctl service [listener_name]

lsnrctl reload [listener_name]

4.监听的别名

监听默认名字是LISTENER,能够配置别名

oracle@fsdata: /dump> ps -ef | grep tnslsnr | grep  -v grep
oracle   29598     1  0 15:57 ?        00:00:00 /oracle/product/11.2.0/bin/tnslsnr LISTENER -inherit

oracle@phamrdb1: /home/oracle> ps -ef | grep tnslsnr| grep -v grep oracle   38300     1  0 Oct01 ?        06:21:54 /oracle/product/11.2.0/bin/tnslsnr LISTENER_PHAMR –inherit

相关文章
相关标签/搜索