linux自動運行rman增量備份腳本
更新時間:2014年03月14日 16:38:33 作者:
這篇文章主要介紹了linux自動運行rman增量備份腳本,實現(xiàn)周日和周三凌晨1:00執(zhí)行0級全庫備份,周一、二、四、五、六凌晨1:30執(zhí)行增量備份,需要的朋友可以參考下
一、增量備份腳本
0級備份腳本:紅色部分為自定義的備份文件放置的目錄
復(fù)制代碼 代碼如下:
#script.:BackupFull.sh
#creater:xyh
#date:2014-03-08
#desc:backup full database datafile in archive with rman
#connect database
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
rman target/ << EOF_RMAN
run{
allocate channel c1 type disk;
backup incremental level 0 tag 'db0' format
'/home/oracle/RmanBackup/db0_%d_%T_%s' database include current controlfile;
sql 'alter system archive log current';
backup filesperset 5 format '/home/oracle/RmanBackup/cf0_%d_%T_%s' archivelog all delete input;
#filesperset 5表示備份集里面最多包含5個文件
delete noprompt obsolete;
release channel c1;
}
# end
1級備份腳本
復(fù)制代碼 代碼如下:
#script.:Incrl.sh
#creater:xyh
#date:2014-03-08
#desc:backup full database datafile in archive with rman
#connect database
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
rman target/ << EOF_RMAN
run{
allocate channel c1 type disk;
backup incremental level 1 tag 'db1' format
'/home/oracle/RmanBackup/db1_%d_%T_%s' database include current controlfile;
sql 'alter system archive log current';
backup filesperset 5 format '/home/oracle/RmanBackup/cf1_%d_%T_%s' archivelog all delete input;
#filesperset 5表示備份集里面最多包含5個文件
delete noprompt obsolete;
release channel c1;
}
#end
二、使用linux的crontab設(shè)置自動執(zhí)行備份
復(fù)制代碼 代碼如下:
crontab -e
按Enter后,可以像vi編輯器一樣輸入下面內(nèi)容
復(fù)制代碼 代碼如下:
0 1 * * 0 /home/oracle/BackupFull.sh >>/home/oracle/BackupFull.log
0 1 * * 3 /home/oracle/BackupFull.sh >>/home/oracle/BackupFull.log
30 1 * * 1-2 /home/oracle/Incrl.sh >>/home/oracle/Incr.log
30 1 * * 4-6 /home/oracle/Incrl.sh >>/home/oracle/Incr.log
查看crontab內(nèi)容:crontab -l
注:上面意思是把全庫備份日志寫到/home/oracle/BackupFull.log文件中,而增量備份日志寫到/home/oracle/Incr.log中
周日和周三凌晨1:00執(zhí)行0級全庫備份,周一、二、四、五、六凌晨1:30執(zhí)行增量備份
相關(guān)文章
oracle數(shù)據(jù)庫定時任務(wù)dbms_job的用法詳解
這篇文章給大家詳細(xì)介紹了dbms_job的用法,用于安排和管理作業(yè)隊列,通過使用作業(yè),可以使ORACLE數(shù)據(jù)庫定期執(zhí)行特定的任務(wù)。有需要的朋友們可以參考借鑒。2016-09-09oracle創(chuàng)建數(shù)據(jù)庫和用戶的方法
這篇文章主要介紹了oracle創(chuàng)建數(shù)據(jù)庫和用戶的方法,mysql和sqlserver創(chuàng)建數(shù)據(jù)庫可以直接通過create database “數(shù)據(jù)庫名”,而oracle創(chuàng)建數(shù)據(jù)庫要對應(yīng)一個用戶,數(shù)據(jù)庫和用戶一般是一一對應(yīng)的,下面把oracle創(chuàng)建數(shù)據(jù)庫和用戶的步驟分享給大家。2015-07-07Oracle Max函數(shù)使用中出現(xiàn)的問題
在Oracle Max函數(shù)使用中,會出現(xiàn)一些問題,本文將介紹解決方法,需要的朋友可以了解下2012-11-11oracle 11g導(dǎo)出數(shù)據(jù)時報ORA 1455錯誤的處理方法
oracle 11g導(dǎo)出數(shù)據(jù)時報ORA 1455錯誤,原因是由于導(dǎo)出的該用戶的表可能存在空數(shù)據(jù)表,下面是正確的導(dǎo)出步驟2014-08-08在oracle 數(shù)據(jù)庫查詢的select 查詢字段中關(guān)聯(lián)其他表的方法
在實際開發(fā)過程中,特別是在做數(shù)據(jù)查詢的時候,能夠根據(jù)動態(tài)生成的sql語句將查詢的結(jié)果轉(zhuǎn)化并返回到業(yè)務(wù)處理邏輯(或頁面展示出來)能大大的減輕業(yè)務(wù)邏輯的處理復(fù)雜度。2009-08-08