日常维护中误删除了监听日志,但监听还能正常工作。由于监听日志是个文本文件。照着原来的日志名新建了一个日志文件。但发现始终没有日志写到新建的监听文件中。后来先关闭监听写日志的功能,再打开监听写日志功能后。监听日志可以正常被写入。
/home/oracle/db/network/log$ls -l
total 1869008
-rw-r----- 1 oracle dba 0 Dec 10 2010 listener.log
-rw-r----- 1 oracle dba 956835614 Jun 20 09:22 listener_db01.log
-rw-r----- 1 oracle dba 37053 Jun 17 14:42 sqlnet.log
1.本想清空监听日志listener_db01.log
/home/oracle/db/network/log$>listener*.log
2.由于误操作创建了listener*.log
/home/oracle/db/network/log$ls -l
total 1869096
-rw-r--r-- 1 oracle dba 0 Jun 20 09:22 listener*.log
-rw-r----- 1 oracle dba 0 Dec 10 2010 listener.log
-rw-r----- 1 oracle dba 956881115 Jun 20 09:23 listener_db01.log
-rw-r----- 1 oracle dba 37053 Jun 17 14:42 sqlnet.log
3.在发现这个错误后使用rm删除了这个listener*.log,不幸的是把所有以listener开头的log文件都删除了。
/home/oracle/db/network/log$rm listener*.log
/home/oracle/db/network/log$ls -l
total 80
-rw-r----- 1 oracle dba 37053 Jun 17 14:42 sqlnet.log
/home/oracle/db/network/log$vi listener_db01.log
4.过了一会,发现监听日志文件中没有内容,尝试远程连接这个库可以成功连接。但依旧没有日志。
/home/oracle/db/network/log$ls -l
total 0
-rw-r----- 1 oracle dba 0 Jun 20 09:29 listener_db01.log
-rw-r----- 1 oracle dba 0 Jun 20 09:29 sqlnet.log
5.先关闭监听写日志的功能
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> set log_status off
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
LISTENER parameter "log_status" set to OFF
The command completed successfully
LSNRCTL> save_config
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Saved LISTENER_db01 configuration parameters.
Listener Parameter File /home/oracle/db/network/admin/listener.ora
Old Parameter File /home/oracle/db/network/admin/listener.bak
The command completed successfully
6.在打开监听写日志的功能
LSNRCTL> set log_status on
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
LISTENER parameter "log_status" set to ON
The command completed successfully
LSNRCTL> save_config
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Saved LISTENER_db01 configuration parameters.
Listener Parameter File /home/oracle/db/network/admin/listener.ora
Old Parameter File /home/oracle/db/network/admin/listener.bak
The command completed successfully
7.监听日志可以正常写
/home/oracle/db/network/log$ls -l
total 16
-rw-r----- 1 oracle dba 4566 Jun 20 09:45 listener_db01.log
-rw-r----- 1 oracle dba 0 Jun 20 09:29 sqlnet.log