Oracle alert、trace、audit等日志文件清理
oracle12C可清理的日志文件路径:
审计日志:cd
O
R
A
C
L
E
B
A
S
E
/
a
d
m
i
n
/
ORACLE_BASE/admin/
ORACLEBASE/admin/ORACLE_SID/adump
eg: cd /u01/app/oracle/admin/orcl/adump – .aud文件
trace日志:
cd
O
R
A
C
L
E
B
A
S
E
/
d
i
a
g
/
r
d
b
m
s
/
ORACLE_BASE/diag/rdbms/
ORACLEBASE/diag/rdbms/ORACLE_SID/orcl1/trace
cd /u01/app/oracle/diag/rdbms/orcl/orcl1/trace –.trc .trm文件
alert日志:
cd /u01/app/oracle/diag/rdbms/orcl/orcl1/alert --**.xml文件
监听日志:
cd $ORACLE_BASE/diag/tnslsnr/NODE_NAME/listener/alert --log_.xml
审计日志:
cd /u01/app/oracle/admin/orcl/adump
–删除3个月前的审计文件:
find ./ -type f -name “.aud" -mtime +91|xargs rm -f
–一次清空所有审计文件
find ./ -type f -name ".aud”|xargs rm-f
–删除7天前的审计文件:
find ./ -mtime +7 -name “*.aud” -type f –delete
trace日志:
cd /u01/app/oracle/diag/rdbms/orcl/orcl1/trace
find -type f -mtime +5 -name “.trc" -delete
find -type f -mtime +5 -name ".trm” -delete
alert日志:
cd /u01/app/oracle/diag/rdbms/orcl/orcl1/alert
查找7天以上的日志并删除
find -type f -mtime +7 -name “.xml" -delete
或
find /u01/app/oracle/diag/rdbms/orcl/orcl1/alert -mtime +7 -name "log_.xml” | xargs rm -f
拓展:
查询数据库的alert日志及trace日志的路径
select * from v$diag_info;
VALUE
1 Diag Trace
/u01/app/oracle/diag/rdbms/orcl/orcl1/trace
1 Diag Alert
/u01/app/oracle/diag/rdbms/orcl/orcl1/alert