Linux 下 Oracle 数据库RMAN备份 0级全备加1级增量备份

1、使用Linux Crontal 定时任务来定时对数据库做备份

每日19点开始0级全备,其他时段每小时做1级增量备份

crontab -l

0 19 * * * nohup /rmanbak/script/backup0-1.sh >/dev/null 2>&1 &

30 8,9,10,11,12,13,14,15,16,17 * * * nohup /rmanbak/script/backup1.sh >/dev/null 2>&1 &


2、0级备份脚本

vi backup0-1.sh

export ORACLE_SID=orcl

export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

/u01/app/oracle/product/19.0.0/dbhome_1/bin/rman cmdfile=/rmanbak/script/level0-1.rman log=/rmanbak/script/level0-1.out

echo `date` >> /rmanbak/script/level_0


vi level0-1.rman

connect target /

run{

allocate channel ch1 type disk format '/rmanbak/data/ynsb_%U.BKU' maxpiecesize=20G;

allocate channel ch2 type disk format '/rmanbak/data/ynsb_%U.BKU' maxpiecesize=20G;

backup incremental level 0 database plus archivelog ;

}

delete noprompt obsolete;

delete noprompt archivelog until time "sysdate-7";

exit


3、1级增量备份脚本

vi backup1.sh

export ORACLE_SID=orcl

export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

/u01/app/oracle/product/19.0.0/dbhome_1/bin/rman cmdfile=/rmanbak/script/level1.rman log=/rmanbak/script/level1.out

echo `date` >> /rmanbak/script/level_1


vi level1.rman

connect target /

run{

allocate channel ch1 type disk format '/rmanbak/data/ynsb_%U.BKU';

allocate channel ch2 type disk format '/rmanbak/data/ynsb_%U.BKU';

backup incremental level 1 database plus archivelog ;

}

exit


上一篇:postfix邮件系统之邮件客户端无法收邮件问题解析


下一篇:The content of elements must consist of well-formed character data or markup解决方法