Oracle 静态监听注册详解

Oracle 静态监听注册详解


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

[sql]  view plain  copy
 print ?
  1. [oracle@prudent oracle]$ cd $ORACLE_HOME/network/admin  
  2. [oracle@prudent admin]$ vi listener.ora  
  3. # listener.ora Network Configuration File: /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora  
  4. # Generated by Oracle configuration tools.  
  5. SID_LIST_LISTENER =  
  6.   (SID_LIST =  
  7.     (SID_DESC =  
  8.       (SID_NAME = PLSExtProc)  
  9.       (ORACLE_HOME = /mydatafile2/app/oracle/oracle/product/11.2.0/db_1)  
  10.       (PROGRAM = extproc)  
  11.     )  
  12.     (SID_DESC =  
  13.       (SID_NAME = ORCL)  
  14.       (ORACLE_HOME = /mydatafile2/app/oracle/oracle/product/11.2.0/db_1)  
  15.       (GLOBAL_DBNAME=WOO.COM)  
  16.     )  
  17.   )  
  18. LISTENER =  
  19.   (DESCRIPTION_LIST =  
  20.     (DESCRIPTION =  
  21.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))  
  22.       (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))  
  23.     )  
  24.   )  
注意 这里的GLOBAL_DBNAME=WOO.COM
SID_NAME=ORCL 
这个SID_NAME 应与你对外提供服务的 $ORACLE_SID 一致

[plain]  view plain  copy
 print ?
  1. [oracle@prudent admin]$ echo $ORACLE_SID  
  2.  ORCL  
 2、配置对应的tnsnames.ora 中的节点

[sql]  view plain  copy
 print ?
  1. [oracle@prudent admin]$ vi tnsnames.ora  
  2. # tnsnames.ora Network Configuration File: /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora  
  3. # Generated by Oracle configuration tools.  
  4. ORCL=  
  5.   (DESCRIPTION =  
  6.     (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))  
  7.     (CONNECT_DATA =  
  8.       (SERVER = DEDICATED)  
  9.       (SERVICE_NAME = ORCL)  
  10.     )  
  11.   )  
  12.   
  13. WOOORCL=  
  14.   (DESCRIPTION =  
  15.     (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))  
  16.     (CONNECT_DATA =  
  17.       (SERVER = DEDICATED)  
  18.       (SERVICE_NAME = WOO.COM)  
  19.     )  
  20.   )  

tnsname WOOORCL 中的 SERVICE_NAME=WOO.COM

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

3、启动监听和服务

[sql]  view plain  copy
 print ?
  1. [oracle@prudent oracle]$ cat dbstart  
  2. lsnrctl start  
  3. sqlplus /nolog <<EOF  
  4. connect /as sysdba  
  5. startup  
  6. EOF  
  7. [oracle@prudent oracle]$ ./dbstart  
  8. LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-FEB-2011 20:11:15  
  9. Copyright (c) 1991, 2005, Oracle.  All rights reserved.  
  10. Starting /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...  
  11. TNSLSNR for Linux: Version 11.2.0.1.0 - Production  
  12. System parameter file is /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora  
  13. Log messages written to /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/log/listener.log  
  14. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))  
  15. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prudent)(PORT=1521)))  
  16. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))  
  17. STATUS of the LISTENER  
  18. ------------------------  
  19. Alias                     LISTENER  
  20. Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production  
  21. Start Date                13-FEB-2011 20:11:15  
  22. Uptime                    0 days 0 hr. 0 min. 0 sec  
  23. Trace Level               off  
  24. Security                  ONLocal OS Authentication  
  25. SNMP                      OFF  
  26. Listener Parameter File   /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora  
  27. Listener Log File         /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/log/listener.log  
  28. Listening Endpoints Summary...  
  29.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))  
  30.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prudent)(PORT=1521)))  
  31. Services Summary...  
  32. Service "WOO.COM" has 1 instance(s).  
  33.   Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...  
  34. Service "ORCL" has 1 instance(s).  
  35.   Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...  
  36. Service "PLSExtProc" has 1 instance(s).  
  37.   Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...  
  38. The command completed successfully  
  39. SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 13 20:11:16 2011  
  40. Copyright (c) 1982, 2005, Oracle.  All rights reserved.  
  41. SQL> Connected to an idle instance.  
  42. SQL> ORA-32004: obsolete and/or deprecated parameter(s) specified  
  43. ORACLE instance started.  
  44. Total System Global Area  461373440 bytes  
  45. Fixed Size                  1220000 bytes  
  46. Variable Size              75498080 bytes  
  47. Database Buffers          381681664 bytes  
  48. Redo Buffers                2973696 bytes  
  49. Database mounted.  
  50. Database opened.  
  51. SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 11.2.0.1.0 - Production  
  52. 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、验证该服务可以到达

[sql]  view plain  copy
 print ?
  1. [oracle@prudent oracle]$ tnsping WOOORCL  
  2. TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 13-FEB-2011 20:14:59  
  3. Copyright (c) 1997, 2005, Oracle.  All rights reserved.  
  4. Used parameter files:  
  5. /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora  
  6.   
  7. Used TNSNAMES adapter to resolve the alias  
  8. Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = WOO.COM)))  
  9. OK (10 msec)  
5、利用静态注册的服务登入oracle

[sql]  view plain  copy
 print ?
  1. [oracle@prudent oracle]$ sqlplus system/oracle@WOOORCL  
  2. SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 13 20:17:27 2011  
  3. Copyright (c) 1982, 2005, Oracle.  All rights reserved.  
  4.   
  5. Connected to:  
  6. Oracle Database 10g Enterprise Edition Release 11.2.0.1.0 - Production  
  7. With the Partitioning, OLAP and Data Mining options  
  8. SQL> select count(*) from date_log;  
  9.   COUNT(*)  
  10. ----------  
  11. SQL>  

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

文章转载:http://blog.csdn.net/wuweilong/article/details/39695359

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值