linux自動(dòng)運(yùn)行rman增量備份腳本
一、增量備份腳本
0級(jí)備份腳本:紅色部分為自定義的備份文件放置的目錄
#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個(gè)文件
delete noprompt obsolete;
release channel c1;
}
# end
1級(jí)備份腳本
#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個(gè)文件
delete noprompt obsolete;
release channel c1;
}
#end
二、使用linux的crontab設(shè)置自動(dòng)執(zhí)行備份
crontab -e
按Enter后,可以像vi編輯器一樣輸入下面內(nèi)容
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
注:上面意思是把全庫(kù)備份日志寫到/home/oracle/BackupFull.log文件中,而增量備份日志寫到/home/oracle/Incr.log中
周日和周三凌晨1:00執(zhí)行0級(jí)全庫(kù)備份,周一、二、四、五、六凌晨1:30執(zhí)行增量備份
相關(guān)文章
oracle 身份證校驗(yàn)函數(shù)的實(shí)例代碼
這篇文章主要介紹了oracle 身份證校驗(yàn)函數(shù),本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-01-01oracle數(shù)據(jù)庫(kù)定時(shí)任務(wù)dbms_job的用法詳解
這篇文章給大家詳細(xì)介紹了dbms_job的用法,用于安排和管理作業(yè)隊(duì)列,通過(guò)使用作業(yè),可以使ORACLE數(shù)據(jù)庫(kù)定期執(zhí)行特定的任務(wù)。有需要的朋友們可以參考借鑒。2016-09-09oracle創(chuàng)建數(shù)據(jù)庫(kù)和用戶的方法
這篇文章主要介紹了oracle創(chuàng)建數(shù)據(jù)庫(kù)和用戶的方法,mysql和sqlserver創(chuàng)建數(shù)據(jù)庫(kù)可以直接通過(guò)create database “數(shù)據(jù)庫(kù)名”,而oracle創(chuàng)建數(shù)據(jù)庫(kù)要對(duì)應(yīng)一個(gè)用戶,數(shù)據(jù)庫(kù)和用戶一般是一一對(duì)應(yīng)的,下面把oracle創(chuàng)建數(shù)據(jù)庫(kù)和用戶的步驟分享給大家。2015-07-07Oracle Max函數(shù)使用中出現(xiàn)的問(wèn)題
在Oracle Max函數(shù)使用中,會(huì)出現(xiàn)一些問(wèn)題,本文將介紹解決方法,需要的朋友可以了解下2012-11-11oracle 11g導(dǎo)出數(shù)據(jù)時(shí)報(bào)ORA 1455錯(cuò)誤的處理方法
oracle 11g導(dǎo)出數(shù)據(jù)時(shí)報(bào)ORA 1455錯(cuò)誤,原因是由于導(dǎo)出的該用戶的表可能存在空數(shù)據(jù)表,下面是正確的導(dǎo)出步驟2014-08-08在oracle 數(shù)據(jù)庫(kù)查詢的select 查詢字段中關(guān)聯(lián)其他表的方法
在實(shí)際開(kāi)發(fā)過(guò)程中,特別是在做數(shù)據(jù)查詢的時(shí)候,能夠根據(jù)動(dòng)態(tài)生成的sql語(yǔ)句將查詢的結(jié)果轉(zhuǎn)化并返回到業(yè)務(wù)處理邏輯(或頁(yè)面展示出來(lái))能大大的減輕業(yè)務(wù)邏輯的處理復(fù)雜度。2009-08-08