#!/bin/bash
#delete aud
for i in $(ps -ef|grep ora_smon|grep -v grep|awk '{print $NF}'|cut -c 10-)
do
find /u01/app/oracle/admin/$i/adump -name "*.aud" -mtime 7 -exec rm -rf {} ;
解释:
取出实例名:
ps -ef|grep ora_smon|grep -v grep|awk '{print $NF}'|cut -c 10-
删除7天前的文件:
find /u01/app/oracle/admin/$i/adump -name "*.aud" -mtime 7 -exec rm -rf {} ;