服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > 数据库技术 > Oracle技术 > Oracle开发 > 查看文档

解析:如何正确的更改监听器日志文件名称

如果你的数据库监听器日志出现了问题,你可以用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:16



copyright (c) 1991, 2002, oracle corporation.  all rights reserved.



welcome to lsnrctl, type "help" for information.



lsnrctl> set current_listener listener1
current listener is listener1
lsnrctl> set log_file
parameter value: a.log
connecting to (description=(address=(protocol=ipc)(key=extproc)))
listener1 parameter "log_file" set to a.log
the command completed successfully
lsnrctl> status
connecting to (description=(address=(protocol=ipc)(key=extproc)))
status of the listener
------------------------
alias         listener1
version       tnslsnr for linux: version 9.2.0.4.0 - production
start date    10-nov-2006 16:54:12
uptime        0 days 0 hr. 2 min. 6 sec
trace level   off
security      off
snmp          off
listener parameter file   
/opt/oracle/product/9.2.0/network/admin/listener.ora
listener log file         
/opt/oracle/product/9.2.0/network/log/a.log
listening 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 successfully
lsnrctl>

加入你需要将此修改永久化,你需要使用save_config命令来保存一下:

lsnrctl> save_config
connecting to (description=
(address=(protocol=ipc)(key=extproc)))
saved listener1 configuration parameters.
listener parameter file /opt/oracle/product
/9.2.0/network/admin/listener.ora
old parameter file /opt/oracle/product/9.2.0
/network/admin/listener.bak
the 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
#----------------------------------

扫描关注微信公众号