RMAN - 常用的備份腳本


0級全庫備份腳本

$ vi BackupFull.sh

BackupFull.sh文件的內容為:

# script .:BackupFull.sh

# creater:leon_lan

# date:2012/7/22

# desc: backup full database datafile in archive with rman

# connect database

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1

Export ORACLE_SID=oms

Export PATH=$ORACLE_HOME/bin:$PATH

Rman target/ << EOF_RMAN

Run{

       Allocate channel c1 type disk;

       Backup incremental level 0 tag ‘db0’ format

       ‘/u01/app/oracle/RmanBackup/db0_%d_%T_%s’ database include current controlfile;

       Delete noprompt obsolete;

       Release channel c1;

}

#end

1級增量備份腳本

$ vi Incr1.sh

Incr1.sh文件的內容為:

# script .:BackupFull.sh

# creater:leon_lan

# date:2012/7/22

# desc: backup full database datafile in archive with rman

# connect database

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1

Export ORACLE_SID=oms

Export PATH=$ORACLE_HOME/bin:$PATH

Rman target/ << EOF_RMAN

Run{

       Allocate channel c1 type disk;

       Backup incremental level 1 tag ‘db1’ format

       ‘/u01/app/oracle/RmanBackup/db1_%d_%T_%s’ database include current controlfile;

       Delete noprompt obsolete;

       Release channel c1;

}

#end

設置自動化執行備份腳本

$ crontab –e

0 1 * * 0 /u01/app/oracle/RmanBackup/BackupFull.sh

>>/u01/app/oracle/RmanBackup/BackupFull.log

0 1 * * 3 /u01/app/oracle/RmanBackup/BackupFull.sh

>>/u01/app/oracle/RmanBackup/BackupFull.log

30 1 * * 1-2 /u01/app/oracle/RmanBackup/Incr1.sh

>>/u01/app/oracle/RmanBackup/Incr.log

30 1 * * 4-6 /u01/app/oracle/RmanBackup/Incr1.sh

>>/u01/app/oracle/RmanBackup/Incr.log

上面的內容的意思是周日和周三凌晨1:00執行0級全庫備份,周一、二、四、五六凌晨1:30執行1級增量備份。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM