Windows/Linux下Oracle監聽日誌過大無需重啟資料庫服務的處理方法,linuxoracle

來源:互聯網
上載者:User

Windows/Linux下Oracle監聽日誌過大無需重啟資料庫服務的處理方法,linuxoracle
1. Oracle 監聽日誌介紹

        Oracle監聽器記錄檔是一個純文字檔案,它的大小是一直不斷增長的。它通常位於:“$ORACLE_HOME/network/log”目錄下,與sqlnet.log記錄檔處於同一路徑;其預設的檔案名稱為listener.log,對於非預設的監聽器,則產生的記錄檔通常為listenername.log;該檔案預設由監聽器自動建立,當記錄檔丟失時或不存在時,會自動重新建立一個同名的檔案,與alert_<SID>.log檔案類似;該檔案的尺寸會不斷自動成長,當尺寸過大時(超過2G資料庫變慢,超過4G資料庫將可能無法串連)或不便於閱讀時,應考慮將其備份。


2. 查看監聽日誌大小

        不管在Windows環境下,或者Linux環境下均可根據上文中日誌位置或者根據記錄檔名尋找監聽記錄檔大小。


3. 記錄檔的備份和重新命名

        Oracle監聽器在運行時不允許對記錄檔做刪除,重新命名操作,可以設定日誌狀態為ON或OFF來實現啟用或關閉日誌。

        在記錄檔過大的情況下,可使用不停止監聽的情況下對記錄檔重新命名以實現備份。

a) Windows環境下

        C:\> cd D:\oracle\product\10.2.0\db_1\NETWORK\log        --切換到監聽器記錄檔所在目錄             

        D:\oracle\product\10.2.0\db_1\NETWORK\log> lsnrctl set log_status off        --暫停或離線記錄記錄檔        

        D:\oracle\product\10.2.0\db_1\NETWORK\log> rename listener.log listener.old150424         --重新命名記錄檔,一般加上日期

        D:\oracle\product\10.2.0\db_1\NETWORK\log> lsnrctl set log_status on         --聯機監聽器記錄檔,會自動重新建立一個新的記錄檔

b) Unix/Linux環境下

        $lsnrctl  set  log_status  off 

        #mv  listener.log  listener.old150424

        $lsnrctl  set  log_status  on


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.