oracle清除日志


近日發現oracle占用的空間很大,經查,發現是

/u01/app/oracle/diag/rdbms/orcl/orcl/alert 警告日志

/u01/app/oracle/diag/rdbms/orcl/orcl/trace 跟蹤日志

這兩個目錄日志文件太多。占用十幾個G

用adrci清除日志

先確定目錄

SQL> select value from v$diag_info where name ='Diag Alert';

VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/orcl/orcl/alert


SQL> select value from v$diag_info where name ='Diag Trace';

VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/orcl/orcl/trace

 

adrci是操作系統下的oracle命令,可以直接運行adrci

[oracle@dom169 /]$ adrci

ADRCI: Release 12.1.0.2.0 - Production on Sat Apr 16 21:17:04 2022

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u01/app/oracle"
adrci>

 

先查看homepath是不是所要處理的日志目錄

adrci> show home
ADR Homes: 
diag/rdbms/orcl/orcl
adrci> 

如果不是,先設置homepath

adrci> set homepath diag/rdbms/orcl/orcl

清空警告日志,1440是按分鍾算的,就是一天,這是清空一天以前的警告日志

adrci> purge -age 1440 -type alert

清空跟蹤日志,1440是按分鍾算的,就是一天,這是清空一天以前的跟蹤日志

adrci> purge -age 1440 -type trace

 

查看日志保留策略

默認SHORTP_POLICY為720小時(即30天),LONGP_POLICY為8760小時(即365天) 

adrci> show control

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
***************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY         
-------------------- -------------------- -------------------- 
1335663986           720                  8760                 
1 rows fetched

 

LONGP_POLICY is used to purge information that have long life. Default value is 365 days.
This policy is used by :

ALERT
INCIDENT
SWEEP
STAGE
HM

 

SHORTP_POLICY is used to purge the information that have short life. Default value is 30 days.
This policy is used by :

TRACE
CDUMP
UTSCDMP
IPS
 

默認SHORTP_POLICY為720小時(即30天),LONGP_POLICY為8760小時(即365天)

#設置SHORTP_POLICY 15天 LONGP_POLICY 90天

adrci> set control (SHORTP_POLICY = 360) 
adrci> set control (LONGP_POLICY = 2160

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM