Oracle DBA之配置静态监听(listener registered statically)

来源:互联网 发布:手机mac咋装office 编辑:程序博客网 时间:2024/05/19 00:43

 (1)listener.ora

 本次实验将配置静态监听到listener L1上,项目SID_LIST_L1为L1的静态监听配置信息:

L1 =  (DESCRIPTION_LIST =    (DESCRIPTION =      (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1522))    )  )SID_LIST_L1 =  (SID_LIST =    (SID_DESC =      (SID_NAME = PLSExtProc)      (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)      (PROGRAM = extproc)    )    (SID_DESC =      (GLOBAL_DBNAME = t01)      (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)      (SID_NAME = t01)    )  )


(2)listener.ora文件编辑好后,使用reload重新读取该配置文件(reload同时也会重新注册动态监听):

RELOAD

Purpose

Use the RELOAD command to reread the listener.ora file. This command enables you to add or change statically configured services without actually stopping the listener.

In addition, the database services, instances, service handlers, and listening endpoints that were dynamically registered with the listener will be unregistered and subsequently registered again.

http://download.oracle.com/docs/cd/A97630_01/network.920/a96581/lsnrctl.htm

LSNRCTL> status正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1522)))LISTENER 的 STATUS------------------------别名                      L1版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production启动日期                  24-7月 -2011 22:14:19正常运行时间              0 天 1 小时 26 分 2 秒跟踪级别                  off安全性                    ON: Local OS AuthenticationSNMP                      OFF监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\l1.log监听端点概要...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1522)))服务摘要..服务 "t02" 包含 1 个例程。  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...服务 "t02XDB" 包含 1 个例程。  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...服务 "t02_XPT" 包含 1 个例程。  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...命令执行成功LSNRCTL> reload正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1522)))命令执行成功LSNRCTL> status正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1522)))LISTENER 的 STATUS------------------------别名                      L1版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production启动日期                  24-7月 -2011 22:14:19正常运行时间              0 天 1 小时 26 分 8 秒跟踪级别                  off安全性                    ON: Local OS AuthenticationSNMP                      OFF监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\l1.log监听端点概要...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1522)))服务摘要..服务 "PLSExtProc" 包含 1 个例程。  例程 "PLSExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...服务 "t01" 包含 1 个例程。  例程 "t01", 状态 UNKNOWN, 包含此服务的 1 个处理程序...命令执行成功


可以看到状态为UNKNOWN的静态监听已经起起来来了,而状态为READY的动态监听由于重新注册存在一定延时,所以还没起起来。
等上一段时间后,我们发现动态监听也起起来了。

LSNRCTL> status正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1522)))LISTENER 的 STATUS------------------------别名                      L1版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production启动日期                  24-7月 -2011 22:14:19正常运行时间              0 天 1 小时 46 分 10 秒跟踪级别                  off安全性                    ON: Local OS AuthenticationSNMP                      OFF监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\l1.log监听端点概要...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1522)))服务摘要..服务 "PLSExtProc" 包含 1 个例程。  例程 "PLSExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...服务 "t01" 包含 1 个例程。  例程 "t01", 状态 UNKNOWN, 包含此服务的 1 个处理程序...服务 "t02" 包含 1 个例程。  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...服务 "t02XDB" 包含 1 个例程。  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...服务 "t02_XPT" 包含 1 个例程。  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...命令执行成功

(3)以scott用户进行测试:

测试的时候报了个ORA-12518的错:

C:\Documents and Settings\Administrator>sqlplus scott/tiger@127.1:1522/t01SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 7月 25 00:01:06 2011Copyright (c) 1982, 2005, Oracle.  All rights reserved.ERROR:ORA-12518: TNS: 监听程序无法分发客户机连接

 

以sys用户登录进去,发现是dispatchers设置有问题:

C:\Documents and Settings\Administrator>set oracle_sid=t01C:\Documents and Settings\Administrator>sqlplus / as sysdbaSQL*Plus: Release 10.2.0.1.0 - Production on 星期一 7月 25 00:05:08 2011Copyright (c) 1982, 2005, Oracle.  All rights reserved.连接到:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsSQL> select status,instance_name from v$instance;STATUS                   INSTANCE_NAME------------------------ --------------------------------OPEN                     t01SQL> show parameter dispatNAME                                 TYPE------------------------------------ ----------------------VALUE------------------------------dispatchers                          string(PROTOCOL=TCP) (SERVICE=t01XDB)max_dispatchers                      integer

重设dispatchers:

SQL> alter system set dispatchers="(PROTOCOL=TCP) (SERVICE=t01XDB)(dispatchers=3)";系统已更改。

(4)以scott用户进行再测试,问题解决:

C:\Documents and Settings\Administrator>sqlplus scott/tiger@127.1:1522/t01SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 7月 25 00:10:21 2011Copyright (c) 1982, 2005, Oracle.  All rights reserved.连接到:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsSQL>

(5)总结

配置静态监听需要先在listener.ora文件中配置一条SID_LIST_listenername的条目,然后需要用reload重新读取配置文件,碰到“监听程序无法分发客户机连接”的错误时,需要设置dispatchers参数。

Ref:

http://www.51testing.com/?uid-117986-action-viewspace-itemid-197431

http://download.oracle.com/docs/cd/A97630_01/network.920/a96581/lsnrctl.htm

http://download.oracle.com/docs/cd/B13789_01/network.101/b10775/listenercfg.htm

原创粉丝点击