監聽日誌檔案的管理

還不算暈發表於2013-12-06

1.到listener裡面,檢視對應的log_file和log_status

[oracle@bys3 log]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-DEC-2013 10:27:11
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> show log_file
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
LISTENER parameter "log_file" set to /u01/diag/tnslsnr/bys3/listener/alert/log.xml
The command completed successfully
LSNRCTL> show log_status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
LISTENER parameter "log_status" set to ON
The command completed successfully

2.先去監聽日誌的目錄裡面並檢視大小

從監聽裡用show log_file得出日誌檔案的地址  ---測試機沒怎麼用依然有8M大小的日誌
[oracle@bys3 alert]$ du -sh log.xml
8.0M    log.xml

3.現在可以關閉listener log

LSNRCTL> set log_status off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
LISTENER parameter "log_statu".  Try "help"

4.然後mv以前的日誌檔案

[oracle@bys3 alert]$ mv log.xml log.xmla

5.再開啟listerer log

LSNRCTL> set log_status on
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
LISTENER parameter "log_status" set to ON
The command completed successfully
LSNRCTL> show log_file
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
LISTENER parameter "log_file" set to /u01/diag/tnslsnr/bys3/listener/alert/log.xml
The command completed successfully

6.檢視日誌檔案已經自動生成了,原來的日誌檔案就可以慢慢處置了。

[oracle@bys3 alert]$ ls
log.xml  log.xmla

相關文章