Oraclr归档日志清理脚本1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#!/bin/bash
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
fi
#set env
echo "Oracle home:"$ORACLE_HOME
echo "Oracle SID:"$ORACLE_SID
$ORACLE_HOME/bin/rman target sys/oracle@rac log=/oracle/logs/rman.log <<EOF
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'sysdate - 5';
exit;
EOF
正式环境1
2
3
4
5
6
7
8
9!/bin/bash
#Author wang.t
#date 2017-9-1
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1
$ORACLE_HOME/bin/rman target / log=/data/backup/logs/rman.log << EOF
crosscheck archivelog all;
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-15';
exit;
EOF
mkdir -p /data/backup/logs/