1、rman清理调用脚本
#!/bin/bash
su - oracle -c "/backup/oracle/scripts/rmanclear.sh dbsid " > /dev/null 2>&1
rman清理脚本为/backup/oracle/scripts/rmanclear.sh,dbsid为需要清理数据库实例的sid,将用来传递到rmanclear.sh中的参数。
2、rman清理脚本
#!/bin/bash
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
fi
ORACLE_SID=$1;
export ORACLE_SID=$ORACLE_SID
$ORACLE_HOME/bin/rman log=/users/robin/log/rman.log <<EOF
connect target /
run{
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'sysdate - 1';
}
exit;
EOF
其中$1为调用脚本传递的dbsid的值。
3、定时任务
定时任务可以使用crontab去调用。