【rman,1】經典的增量備份案例,rman增量備份案例

來源:互聯網
上載者:User

【rman,1】經典的增量備份案例,rman增量備份案例
一.備份策略:
1.星期天晚上      -level 0 backup performed(全備份)2.星期一晚上      -level 2 backup performed3.星期二晚上      -level 2 backup performed4.星期三晚上      -level 1 backup performed5.星期四晚上      -level 2 backup performed6.星期五晚上      -level 2 backup performed7.星期六晚上      -level 2 backup performed 如果星期二需要恢複的話,只需要1+2,如果星期四需要恢複的話,只需要1+4,如果星期五需要恢複的話,只需要1+4+5,如果星期六需要恢複的話,只需要1+4+5+6. 自動備份:備份指令碼+crontab bakl0 bakl1 bakl2
二.執行的指令碼:
1.執行指令碼:rman target / msglog=bakl0.log cmdfile=bakl0 (/表示需要串連的目標資料庫,msglog表示記錄檔,cmdfile表示的是指令檔)rman target / msglog=bakl1.log cmdfile=bakl1rman target / msglog=bakl2.log cmdfile=bakl2執行個體:rman target system/oracle@ora10g(/) msglog=/u01/rmanbak/bakl1.log cmdfile=/u01/rmanbak/bakl0
完整的命令:/u01/oracle/product/10.2.0/bin/rman target system/oracle@ora10g(/) msglog=/u01/rmanbak/bakl1.log cmdfile=/u01/rmanbak/bakl0
2.編寫rman備份指令碼: 0級備份指令碼:
把備份指令碼放到/u01/rmanbak/script目錄下面,vi bakl0,bakl0的內容為:run{    allocate channel cha1 type disk;    backup    incremental level  0    format '/home/oracle/rmanbackup/inc0_%u_%T'(u表示唯一的ID,大T是日期,小t是時間)    tag monday_inc0 //標籤可以順便起,沒關係    database plus archivelog delete input;    release channel cha1;    }1級備份指令碼:run{    allocate channel cha1 type disk;    backup    incremental level  1    format '/home/oracle/rmanbackup/inc1_%u_%T'(u表示唯一的ID,大T是日期,小t是時間)    tag monday_inc1 //標籤可以順便起,沒關係    database plus archivelog delete input;    release channel cha1;    }
2級備份指令碼:  run{    allocate channel cha1 type disk;    backup    incremental level  2    format '/home/oracle/rmanbackup/inc2_%u_%T'(u表示唯一的ID,大T是日期,小t是時間)    tag monday_inc2 //標籤可以順便起,沒關係    database plus archivelog delete input;    release channel cha1;    }
3.編寫調用rman指令碼的shell指令碼:
調用0備份的shell指令碼 rmanbak0.sh為:#!/bin/bashsource /home/oracle/.bash_profile/u01/app/oracle/11.2.0/db_home_1/bin/rman target / nocatalog cmdfile=/home/oracle/script/bakl0  msglog=/home/oracle/bakl0.log
調用1備份的shell指令碼 rmanbak0.sh為:#!/bin/bashsource /home/oracle/.bash_profile/u01/app/oracle/11.2.0/db_home_1/bin/rman target / nocatalog cmdfile=/home/oracle/script/bakl1  msglog=/home/oracle/bakl0.log調用2備份的shell指令碼 rmanbak0.sh為:#!/bin/bashsource /home/oracle/.bash_profile/u01/app/oracle/11.2.0/db_home_1/bin/rman target / nocatalog cmdfile=/home/oracle/script/bakl2  msglog=/home/oracle/bakl0.log 4.編寫Linux定時任務執行自動備份[root@gc2 ~]#crontab -e -u oracle(該命令的意思是編輯oracle使用者的定時執行(-e,edit -u oracle,oracle使用者))分  時  日 月 星期(0代表星期天)45 23  *  *    0    /home/oracle/script/rmanbak0.sh(星期天的23:45會以oracle使用者的身份來執行命令)45 23  *  *    1    /home/oracle/script/rmanbak2.sh45 23  *  *    2    /home/oracle/script/rmanbak2.sh45 23  *  *    3    /home/oracle/script/rmanbak1.sh45 23  *  *    4    /home/oracle/script/rmanbak2.sh45 23  *  *    5    /home/oracle/script/rmanbak2.sh45 23  *  *    6    /home/oracle/script/rmanbak2.sh

或者(用於測試):使用oracle使用者添加例行任務:crontab -e新開啟的視窗中添加一下內容:0 24 * * * /home/oracle/bin/rmanbak0.sh(*/3 * * * * /home/oracle/bin/rmanbak0.sh)注,括弧內的可以是做測試的時候用的,每三分鐘執行一次備份,例為每天淩晨24點執行備份
 #然後啟動crontab ,啟動crontab的命令:[root@gc2 ~]# service crond restartStopping crond: [  OK  ]Starting crond: [  OK  ]#監控定時任務是否執行[root@gc2 ~]# tail -f /var/log/cron
Mar 10 21:28:04 gc2 crond[4435]: (CRON) STARTUP (V5.0)Mar 10 21:30:01 gc2 crond[4445]: (root) CMD (/usr/lib/sa/sa1 1 1)Mar 10 21:39:08 gc2 crond[4486]: (CRON) STARTUP (V5.0)

ORACLE rman增量備份中的備份分級是為何?比如什1級備份2級備份的

先說增量備份,分差異和累積兩種
總的來說就是先備份一次,然後以後備份就只備份改變過的資料
0級備份就是全備,可以做級增量備份的基礎
增量備份的level1是從上次0或者1至今的變化,而level2是從上傳備份至今的增量,0,1,2都可以
累積備份的level1是從上次0至今的累積變化,而level2是從上傳0或者1至今的累積增量,包括期間2都可以
 
問一個RMAN增量備份的問題

rman是把資料備份到檔案系統。
要做鏡像系統,推薦使用DATAGRID,可基本做到即時備份,比rman適合。
你可以百度一下 “[三思筆記]一步一步學DataGuard”,裡面有具體操作
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.