实例讲解如何更改监听器日志文件的名称

来源:岁月联盟 编辑:zhuzhu 时间:2008-01-28

假如你的数据库的监听器日志出了问题,你可以用set log_file命令重新定位一个日志文件得来解决此问题。

你可以参考以下两个命令:

LSNRCTL> set current_listener <listener name> LSNRCTL> set log_file <sid name>.log

注释:set current_listener命令可以访问非缺省监听器,当你使用set log_file命令更改名称以后,原来有问题的日志文件则可以清除或实现日志重定位:

[oracle@jumper admin]$ lsnrctl LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 10-NOV-2006 16:54:16Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.Welcome to LSNRCTL, type "help" for information.LSNRCTL> set current_listener LISTENER1Current Listener is LISTENER1LSNRCTL> set log_fileParameter Value: a.logConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))LISTENER1 parameter "log_file" set to a.logThe command completed successfullyLSNRCTL> statusConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))STATUS of the LISTENER------------------------Alias                     LISTENER1Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - ProductionStart Date                10-NOV-2006 16:54:12Uptime                    0 days 0 hr. 2 min. 6 secTrace Level               offSecurity                  OFFSNMP                      OFFListener Parameter File   /opt/oracle/product/9.2.0/network/admin/listener.oraListener Log File         /opt/oracle/product/9.2.0/network/log/a.logListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.33.11)(PORT=1521)))Services Summary...Service "PLSExtProc" has 1 instance(s).  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...Service "conner" has 1 instance(s).  Instance "conner", status UNKNOWN, has 1 handler(s) for this service...Service "eygle" has 1 instance(s).  Instance "eygle", status UNKNOWN, has 1 handler(s) for this service...The command completed successfullyLSNRCTL>

假如你需要将这个修改永久化,你可以使用save_config命令来保存。

LSNRCTL> save_configConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))Saved LISTENER1 configuration parameters.Listener Parameter File /opt/oracle/product/9.2.0/network/admin/listener.oraOld Parameter File /opt/oracle/product/9.2.0/network/admin/listener.bakThe command completed successfully

此时,listener.ora文件会被增加以下的记录:

[oracle@jumper oracle]$ tail -5 /opt/oracle/product/9.2.0/network/admin/listener.ora#----ADDED BY TNSLSNR 14-NOV-2006 16:39:12---LOG_FILE_LISTENER1 = a.log#--------------------------------------------