Oracle静态监听注册详解

网上有很多关于oracle 监听静态注册的文章,但大多都是简单说说,并没有详细的例子,这里,将结合linux as4 下的oracle 10gR2.0.1 举一个具体的例子

  1、在 $ORACLE_HOME/network/admin/listener.ora 文件中加入一个静态注册的节点


[oracle@prudent oracle]$ cd $ORACLE_HOME/network/admin

[oracle@prudent admin]$ vi listener.ora

# listener.ora Network Configuration File: /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = /mydatafile2/app/oracle/oracle/product/11.2.0/db_1)

(PROGRAM = extproc)

)

(SID_DESC =

(SID_NAME = ORCL)

(ORACLE_HOME = /mydatafile2/app/oracle/oracle/product/11.2.0/db_1)

(GLOBAL_DBNAME=WOO.COM)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))

(ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))

)

)

  注意这里的GLOBAL_DBNAME=WOO.COM

  SID_NAME=ORCL

  这个SID_NAME 应与你对外提供服务的 $ORACLE_SID 一致

  [oracle@prudent admin]$ echo $ORACLE_SID

  ORCL

  2、配置对应的tnsnames.ora 中的节点


[oracle@prudent admin]$ vi tnsnames.ora

# tnsnames.ora Network Configuration File: /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

ORCL=

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ORCL)

)

)

WOOORCL=

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = WOO.COM)

)

)

[oracle@prudent admin]$ vi tnsnames.ora

# tnsnames.ora Network Configuration File: /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

ORCL=

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ORCL)

)

)

WOOORCL=

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = WOO.COM)

)

)

tnsname WOOORCL 中的 SERVICE_NAME=WOO.COM

  这里的服务名为 WOO.COM 而不是通常的 ORCL,因为在 listener.ora 中已经注册了 WOO.COM,lsnrctl 启动时会监听 WOO.COM ,并对应到 SID_NAME=ORCL 上。3、启动监听和服务


[oracle@prudent oracle]$ cat dbstart

lsnrctl start

sqlplus /nolog <<EOF

connect /as sysdba

startup

EOF

[oracle@prudent oracle]$ ./dbstart

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-FEB-2011 20:11:15

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

Starting /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production

System parameter file is /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora

Log messages written to /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prudent)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                13-FEB-2011 20:11:15

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listener Log File         /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prudent)(PORT=1521)))

Services Summary...

Service "WOO.COM" has 1 instance(s).

Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...

Service "ORCL" has 1 instance(s).

Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 13 20:11:16 2011

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

SQL> Connected to an idle instance.

SQL> ORA-32004: obsolete and/or deprecated parameter(s) specified

ORACLE instance started.

Total System Global Area  461373440 bytes

Fixed Size                  1220000 bytes

Variable Size              75498080 bytes

Database Buffers          381681664 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

  可以看到

  Service "WOO.COM" has 1 instance(s).

  Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...

  正在被监听。

  4、验证该服务可以到达


[oracle@prudent oracle]$ tnsping WOOORCL

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 13-FEB-2011 20:14:59

Copyright (c) 1997, 2005, Oracle.  All rights reserved.

Used parameter files:

/mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = WOO.COM)))

OK (10 msec)

  5、利用静态注册的服务登入oracle


[oracle@prudent oracle]$ sqlplus system@oracleWOOORCL

SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 13 20:17:27 2011

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

Connected to:

Oracle Database 10g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select count(*) from date_log;

COUNT(*)

----------

SQL>

  至此:已验证该静态注册可以成功的被解析,监听,连接。

最新内容请见作者的GitHub页:http://qaseven.github.io/

时间: 2024-11-08 20:39:38

Oracle静态监听注册详解的相关文章

Oracle 静态监听注册详解

Oracle 静态监听注册详解        网上有很多关于oracle 监听静态注册的文章,但大多都是简单说说,并没有详细的例子,这里,将结合linux as4 下的oracle 10gR2.0.1 举一个具体的例子 1.在 $ORACLE_HOME/network/admin/listener.ora 文件中加入一个静态注册的节点 [oracle@prudent oracle]$ cd $ORACLE_HOME/network/admin [oracle@prudent admin]$ vi

oracle静态监听和动态监听

oracle静态监听和动态监听  一.什么是注册? 注册就是将数据库作为一个服务注册到监听程序.客户端不需要知道数据库名和实例名,只需要知道该数据库对外提供的服务名 就可以申请连接到数据库.这个服务名可能与实例名一样,也有可能不一样. 在数据库服务器启动过程中,数据库服务器会向监听程序注册相应的服务(无论何时启动一个数据库,默认地都有两条信息注册 到监听器中:数据库服务器对应的实例和服务.) 相当于是这样:在数据库服务器和客户端之间有一监听程序(Listener),在监听程序中,会记录相应数据库

Javascript添加监听与删除监听用法详解

 js中事件监听就是利用addEventListener来绑定一个事件,这个用法在jquery中非常常用并且简单,但在原生js中比较复杂,这里整理了addEventListener事件各方法的测试与例子供大家参考学习. 在前两天做播放器的时候添加监听后删除监听遇到了一点麻烦,删不掉,后来看了一下才发现,参数需要完全对应,什么叫完全对应呢,换句话说: 代码如下: $('.video')[0].addEventListener('timeupdate', currentTimeHandler, tr

[20160513]Restrict Session与静态监听.txt

[20160513]Restrict Session与静态监听.txt --给同事讲解动静态监听时,一次测试,当执行后alter system enable restricted session;发现远程用户依旧可以登录,检查发现是静态 --监听注册搞的鬼,做一个记录.并且把各种情况做一个总结: 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER --------------------

Oracle静态注册与动态注册详解_oracle

一.概述: Oracle的注册就是将数据库作为一个服务注册到监听程序.客户端不需要知道数据库名和实例名,只需要知道该数据库对外提供的服务名就可以申请连接到这个数据库.这个服务名可能与实例名一样,也有可能不一样. 在数据库服务器启动过程中,数据库服务器会向监听程序注册相应的服务(无论何时启动一个数据库,默认地都有两条信息注册到监听器中:数据库服务器对应的实例和服务.) 相当于是这样:在数据库服务器和客户端之间有一监听程序(Listener),在监听程序中,会记录相应数据库对应的服务名(一个数据库可

Oracle中静态监听导致的ORA-12523错误

今天配置完共享服务器模式之后发现登录过程中报错ORA-12523,排查错误之后发现是静态监听惹的祸. 本机之上有两个监听,一个静态监听1521端口,一个动态监听1526端口. LISTENER= (DESCRIPTION=  (ADDRESS_LIST=    (ADDRESS=(PROTOCOL=tcp)(HOST=jp)(PORT=1521))    (ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))) LSNR2= (DESCRIPTION=  (ADDRESS_

【oracle】动态监听与静态监听

本机客户端以sysdba身份登陆oracle数据库后 用shutdown immediate成功的关闭了数据库. 可是startup的时候,却提示 ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 查看listener.ora配置文件后,发现配置的动态监听. 动态监听会时时反应数据库的状态 依赖pmon进程的动态注册,而不像静态监听需要加载listener.ora文件的sid_list_listener部分.之所以无法再启动数据库,是由于数据库关闭后,监听器已经注销了此

【DATAGUARD】DATAGUARD 与 静态监听

在Oracle DATAGUARD实验中必须要用到静态监听,否则很严重(例子前面创建dg的过程中有遇到) 静态监听指实例启动时读取listener.ora配置文件,将实例和服务注册到监听程序.无论何时启动一个数据库,默认都有两条信息注册到监听器中:实例和服务 SID_LIST_LISTENER = (SID_LIST =   (SID_DESC =     (GLOBAL_DBNAME = Oranet)     (SID_NAME = yangdb)   ) ) LISTENER =   (D

配置静态监听解决ORA-12514错误的案例(转)

今天做Linux下DG配置的时候,遇到一个现象,tnsname.ora文件配置都正常,tnsping也正常,监听也正常,但是仍然报ORA-12514错误:   SQL> set lin 130 pages 130  SQL> select dest_id,error from v$archive_dest;      DEST_ID ERROR ---------- ----------------------------------------------------------------