ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle监听【非1521端口】动态注册

oracle监听【非1521端口】动态注册

原创 Linux操作系统 作者:jx_yu 时间:2012-08-03 11:33:13 0 删除 编辑
动态注册
             Oracle9i起实例使用动态服务注册来通知监听程序有关其数据库服务的信息。
             服务注册依赖PMON 进程向监听程序注册实例信息 注册间隔为1分钟左右
             手动注册命令 alter system register;
             无需在listener.ora 文件中设置任何信息 此文件可以不存在,如下:
]$ rm -rf listener.ora
]$ lsnrctl start
....
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1521)))
The listener supports no services
The command completed successfully
]$ sql scott/scott@ora10g
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 2 15:59:20 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor

Enter user-name:
]$  因为没有注册 所以不能连接
手动注册一次
SQL> alter system register;
System altered.
SQL>
]$ sql scott/scott@ora10g
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 2 15:59:42 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> 连接成功
 
 
------------------------------------------------------------------------------

注意:

如果listener.ora中定义了监听端口(非1521)
此时还想使用动态注册 需要设置local_listener参数[连接描述符]


如:

]$ lsnrctl start
......
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1522)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

 此时手动注册无效  PMON默认只能注册默认端口1521

SQL> alter system register;
System altered.
SQL>
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1522)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

修改参数local_listener 后注册成功

SQL> alter system set local_listener=‘DBSM’;
--local_listener的值一定要在tnsname.ora中设置
System altered.
SQL> alter system register;
System altered.
SQL>

 ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 03-AUG-2012 11:33:38
Copyright (c) 1991, 2007, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1522)))
.....................
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "dbsm" has 1 instance(s).
  Instance "dbsm", status READY, has 1 handler(s) for this service...
Service "dbsmXDB" has 1 instance(s).
  Instance "dbsm", status READY, has 1 handler(s) for this service...
Service "dbsm_XPT" has 1 instance(s).
  Instance "dbsm", status READY, has 1 handler(s) for this service...
The command completed successfully
 

local_listener的值一定要在tnsname.ora中设置 否则报错

~]$ cat /oracle/ora10/product/10.2.0/db_1/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: /oracle/ora10/product/10.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

DBSM =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = sdw0)(PORT = 1522))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = dbsm)

    )

  )

 

EXTPROC_CONNECTION_DATA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )

    (CONNECT_DATA =

      (SID = PLSExtProc)

      (PRESENTATION = RO)

    )

  )

 

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27000195/viewspace-739735/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-05-23

  • 博文量
    80
  • 访问量
    876947