oracle警告日志\跟踪日志磁盘空间清理
问题现象:
通过查看排查到alert和tarce占用大量磁盘空间
警告日志
- /u01/app/oracle/diag/rdbms/orcl/orcl/alert
跟踪日志
- /u01/app/oracle/diag/rdbms/orcl/orcl/trace
解决方案:
用adrci清除日志
确定目录
[root@pre-oracle ~]# su - oracle[oracle@pre-oracle ~]$ sqlplus / as sysdbaSQL> select value from v$diag_info where name ='Diag Alert'; VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/orcl/orcl/alertSQL> select value from v$diag_info where name ='Diag Trace';VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/orcl/orcl/trace
查看homepath是不是所要处理的日志目录
[oracle@pre-oracle ~]$ adrci
adrci> show home
ADR Homes:
diag/rdbms/orcl/orcl
diag/tnslsnr/pre-oracle/listener
设置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 controlADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1335663986 720 8760 2023-07-27 13:32:48.960183 +08:00 2023-08-21 13:14:39.919035 +08:00 2023-08-22 14:28:00.198280 +08:00 1 2 80 1 2023-07-27 13:32:48.960183 +08:00
1 rows fetchedadrci>