oracle 监听注册分析

===========================

今天先占个位,这几天在整理监听的内容,容后贴详细内容!

1.动态注册1521端口

动态注册监听是由PMON进程在实例启动后通过service_name及默认的1521端口注册的,

执行lsnrctl start,观察结果

[oracle@ocmdb admin]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 27-FEB-2014 00:21:37

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

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/ocmdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocmdb)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                27-FEB-2014 00:21:37
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/ocmdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocmdb)(PORT=1521)))
The listener supports no services
The command completed successfully
命令执行成功,

通过lsnrctl status 查看监听状态,动态注册监听需要等60s才能看到,或者手工注册(alter system register)

[oracle@ocmdb admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 27-FEB-2014 00:24:05

Copyright (c) 1991, 2011, 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.3.0 - Production
Start Date                27-FEB-2014 00:21:37
Uptime                    0 days 0 hr. 2 min. 28 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/ocmdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocmdb)(PORT=1521)))
Services Summary...
Service "ocm" has 1 instance(s).
  Instance "ocm", status READY, has 1 handler(s) for this service...
Service "ocmXDB" has 1 instance(s).
  Instance "ocm", status READY, has 1 handler(s) for this service...
The command completed successfully

在这里我们可以看到Service "ocm" has 1 instance(s),其中ocm其实就是

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      ocm
service_names=ocm,这个参数可以为多个。

SQL> alter system set service_names='a,b,c';

System altered.

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      a,b,c
重新reload监听,并查看其状态

[oracle@ocmdb admin]$ lsnrctl reload

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 27-FEB-2014 00:36:08

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle@ocmdb admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 27-FEB-2014 00:36:12

Copyright (c) 1991, 2011, 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.3.0 - Production
Start Date                27-FEB-2014 00:30:34
Uptime                    0 days 0 hr. 5 min. 37 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/ocmdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocmdb)(PORT=1521)))
Services Summary...
Service "a" has 1 instance(s).
  Instance "ocm", status READY, has 1 handler(s) for this service...
Service "b" has 1 instance(s).
  Instance "ocm", status READY, has 1 handler(s) for this service...
Service "c" has 1 instance(s).
  Instance "ocm", status READY, has 1 handler(s) for this service...
Service "ocm" has 1 instance(s).
  Instance "ocm", status READY, has 1 handler(s) for this service...
Service "ocmXDB" has 1 instance(s).
  Instance "ocm", status READY, has 1 handler(s) for this service...
The command completed successfully

客户端tnsnames文件中a的配置。

a =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.49.131)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = a)
    )
  )

C:\Windows\system32>sqlplus system/oracle@a

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 27 14:29:00 2014

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>


2.静态注册

静态注册时,我们可以选择1521端口,也可以选择其他端口。在这里我们选择1522端口进行试验

首先我们在/u01/app/oracle/product/11.2.0/dbhome_1/network/admin目录 ,配置一个listener.ora文件,

[oracle@ocmdb admin]$ vi listener.ora 

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ocm)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = ocm)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ocmdb)(PORT = 1522))
)
)

~
保存退出后,启动监听

LSNRCTL> start
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/ocmdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocmdb)(PORT=1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ocmdb)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                27-FEB-2014 01:39:52
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/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/ocmdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocmdb)(PORT=1522)))
Services Summary...
Service "ocm" has 1 instance(s).
  Instance "ocm", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

由于目前采用的是非1521端口,所以数据库不会去动态注册监听,故我们看到的就只有一个UNKNOWN的监听。

C:\Windows\system32>sqlplus system/oracle@ocm

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 27 14:56:12 2014

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>



3.动态注册非1521端口


====未完,待续===




 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值