您的位置:首页 > 数据库 > Oracle

oracle归档日志的自动清理

2013-10-15 15:48 375 查看
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去调用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: