Oracle用户删除审计文件自动化脚本
csharp
复制代码
$(ORACLE)
vi oracle_auto_trace_del.sh
#!/bin/bash
#ORACLE
cd /opt/oracle/app/oracle/admin/SID(数据库实例名)/adump
find . -type f -name "*.aud" -mtime +10 |xargs rm -rf
$(ORACLE)
crontab -e
1 1 * * 1 sh /home/oracle/oracle_auto_trace_del.sh >>/home/oracle/1.log
grid用户下
csharp
复制代码
$(GRID)
vi grid_auto_trace_del.sh
#!/bin/bash
#GI
cd /opt/oracle/app/grid/diag/tnslsnr/HOSTNAME(主机名)/asmnet1lsnr_asm/alert
find . -type f -name "log_*.xml" -mtime +10 |xargs rm -f
cd /opt/oracle/app/grid/diag/tnslsnr/HOSTNAME(主机名)/asmnet1lsnr_asm/trace
find . -type f -name "asmnet1lsnr_asm_*.log" -mtime +10 |xargs rm -f
cd /opt/oracle/app/grid/diag/tnslsnr/HOSTNAME(主机名)/listener/alert
find . -type f -name "log_*.xml" -mtime +10 |xargs rm -f
cd /opt/oracle/app/grid/diag/tnslsnr/HOSTNAME(主机名)/listener/trace
find . -type f -name "listener_*.log" -mtime +10 |xargs rm -f
cd /opt/oracle/app/grid/diag/tnslsnr/HOSTNAME(主机名)/listener_scan1/trace
find . -type f -name "listener_scan1_*.log" -mtime +10 |xargs rm -f
cd /opt/oracle/app/grid/diag/tnslsnr/HOSTNAME(主机名)/listener_scan1/alert
find . -type f -name "log_*.xml" -mtime +10 |xargs rm -f
csharp
复制代码
$(GRID)
crontab -e
1 1 * * 1 sh /home/grid/grid_auto_trace_del.sh >>/home/grid/1.log