当前位置:金沙js333娱乐场 > 网络频道 > rman全库备份脚本金沙js333娱乐场

rman全库备份脚本金沙js333娱乐场

文章作者:网络频道 上传时间:2019-10-16

金沙js333娱乐场 1

   2)以oracle身份执行crontab -e

#!/bin/bash
#edit by hsxiao 2010-03-30

/*

------------清除失效备份--------------------

#!/bin/bash
#this is rman auto full backup script
#Copyright by 21og
#date 2012-03-21
export ORACLE_SID=orcl
export ORACLE_HOME=/opt/oracle/product/10.2/db_1
export ORACLE_BASE=/opt/oracle
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
backtime=`date +"20%y%m%d%H%M%S"`
cd $ORACLE_HOME/bin
rman target / catalog rman/rman log=/opt/oracle/backup/log/backupall_$backtime.log <<EOF
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
crosscheck backup;
sql 'alter system archive log current';
backup database format '/opt/oracle/backup/dbback/db_%d_%T_%U';
sql 'alter system archive log current';
backup archivelog all format '/opt/oracle/backup/logback/arc_%t_%s' delete all input;
backup current controlfile format '/opt/oracle/backup/controlfileback/cntrl_%s_%p_%s';
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of database completed before 'sysdate - 30';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}
EOF
echo "backup complete!"

date
echo 'begin backup database.......'
echo '***********************************************'
export ORACLE_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=HSXIAO
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
rman target / <<EOF
# crosscheck and delete expired or obsolete backup;

       0 0 * * 0 /opt/oracle/backup/script/dbback.sh 2>&1 >/dev/null

date
echo 'begin backup database.......'
echo '***********************************************'
export Oracle_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=HSXIAO
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
rman target / <<EOF
backup database plus archivelog delete all input;
#backup tablespace crawler;
EOF
date
echo '***********************************************'
echo 'end! backup database successfull!'

   1)以root身份编辑cron.allow文件,手动添加oracle用户允许使用cron服务。

RedHat 常用备份脚脚本示例

  启动cron服务 /etc/init.d/cron start

本文由金沙js333娱乐场发布于网络频道,转载请注明出处:rman全库备份脚本金沙js333娱乐场

关键词: