




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、1 全數(shù)據(jù)庫的完全恢復(fù) run allocate channel c11 type disk; allocate channel c12 type disk; allocate channel c21 type 'sbt_tape' allocate channel c22 type 'sbt_tape' restore co
2、ntrolfile; alter database mount; restore database; recover database;
3、60; sql "alter database open" release channel c11; release channel c12; release channel c21; release channel c22;
4、160; 恢復(fù)步驟如下:$ svrmgrlsvrmgr> connect internalsvrmgr> startup nomount$ rmanprod recdbs.rcv >>rec.log &$ tail f rec.log # 觀察日志 使用以上以上的全備份可以對數(shù)據(jù)庫進(jìn)行全庫的恢復(fù),并可以在恢復(fù)腳本中直接實現(xiàn)數(shù)據(jù)庫歸檔日志的應(yīng)用,將數(shù)據(jù)庫自動恢復(fù)到最近的日志記錄的狀態(tài)。 注意:恢復(fù)時如果有需要應(yīng)用很多歸檔日志,則應(yīng)用該日志時時間會
5、比較長,一定要耐心等待。全恢復(fù)日志如下: RMAN-00569: =error message stack follows=RMAN-00554: initialization of internal recovery manager package failedRMAN-04005: error from target database: ORA-01034: ORACLE not available RMAN-06005: connected to target database: FJTESTRMAN-06008: connected to r
6、ecovery catalog database RMAN> run2> 3> allocate channel c11 type disk;4> allocate channel c12 type disk;5> allocate channel c21 type 'sbt_tape'6> allocate channel c22 type 'sbt_tape'7> restore data
7、base;8> recover database;9> sql "alter database open"10> release channel c11;11> release channel c12;12> release channel c21;13> release channel c22;14> 15> RMAN-03022: compiling command: alloca
8、teRMAN-03023: executing command: allocateRMAN-08030: allocated channel: c11RMAN-08500: channel c11: sid=13 devtype=DISK RMAN-03022: compiling command: allocateRMAN-03023: executing command: allocateRMAN-08030: allocated channel: c12RMAN-08500: channel c12: sid=14 devtype=DISK RMAN-03022: c
9、ompiling command: allocateRMAN-03023: executing command: allocateRMAN-08030: allocated channel: c21RMAN-08500: channel c21: sid=15 devtype=SBT_TAPE RMAN-03022: compiling command: allocateRMAN-03023: executing command: allocateRMAN-08030: allocated channel: c22RMAN-08500: channel c22: sid=17 dev
10、type=SBT_TAPE RMAN-03022: compiling command: set RMAN-03022: compiling command: restoreRMAN-03025: performing implicit partial resync of recovery catalogRMAN-03023: executing command: partial resyncRMAN-08003: starting partial resync of recovery catalogRMAN-08005: partial resync complete
11、160;RMAN-03022: compiling command: IRESTORERMAN-03023: executing command: IRESTORERMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=28 set_stamp=402253457RMAN-08016: channel c22: starting datafile backupset restoreRMAN-08502: set_count=29 set_stamp=402253577RMAN-08019
12、: channel c21: restoring datafile 1RMAN-08509: destination for restore of datafile 1: /dev/vx/rdsk/datadg/system01RMAN-08019: channel c22: restoring datafile 3RMAN-08509: destination for restore of datafile 3: /dev/vx/rdsk/datadg/tempaRMAN-08019: channel c21: restoring datafile 2RMAN-08509: destinat
13、ion for restore of datafile 2: /dev/vx/rdsk/datadg/rbsaRMAN-08019: channel c22: restoring datafile 16RMAN-08509: destination for restore of datafile 16: /dev/vx/rdsk/datadg/t3s200n1RMAN-08023: channel c21: restored backup piece 1RMAN-08511: piece handle=dbf_28_402253457_1 params=NULLRMAN-08024: chan
14、nel c21: restore completeRMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=31 set_stamp=402253614RMAN-08019: channel c21: restoring datafile 4RMAN-08509: destination for restore of datafile 4: /dev/vx/rdsk/datadg/toolsRMAN-08019: channel c21: restoring datafile 7RMAN-
15、08509: destination for restore of datafile 7: /dev/vx/rdsk/datadg/tempbRMAN-08023: channel c22: restored backup piece 1RMAN-08511: piece handle=dbf_29_402253577_1 params=NULLRMAN-08024: channel c22: restore completeRMAN-08016: channel c22: starting datafile backupset restoreRMAN-08502: set_count=32
16、set_stamp=402253679RMAN-08019: channel c22: restoring datafile 5RMAN-08509: destination for restore of datafile 5: /dev/vx/rdsk/datadg/usersRMAN-08019: channel c22: restoring datafile 13RMAN-08509: destination for restore of datafile 13: /dev/vx/rdsk/datadg/t3s1n1RMAN-08023: channel c21: restored ba
17、ckup piece 1RMAN-08511: piece handle=dbf_31_402253614_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=30 set_stamp=402253614RMAN-08019: channel c21: restoring datafile 6RMAN-08509: destination for restore of data
18、file 6: /dev/vx/rdsk/datadg/rbsbRMAN-08019: channel c21: restoring datafile 17RMAN-08509: destination for restore of datafile 17: /dev/vx/rdsk/datadg/t2s200n8RMAN-08023: channel c21: restored backup piece 1RMAN-08511: piece handle=dbf_30_402253614_1 params=NULLRMAN-08024: channel c21: restore comple
19、teRMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=26 set_stamp=402253457RMAN-08019: channel c21: restoring datafile 8RMAN-08509: destination for restore of datafile 8: /dev/vx/rdsk/datadg/system02RMAN-08019: channel c21: restoring datafile 10RMAN-08509: destination
20、for restore of datafile 10: /dev/vx/rdsk/datadg/t3s500n2RMAN-08023: channel c22: restored backup piece 1RMAN-08511: piece handle=dbf_32_402253679_1 params=NULLRMAN-08024: channel c22: restore completeRMAN-08016: channel c22: starting datafile backupset restoreRMAN-08502: set_count=25 set_stamp=40225
21、3457RMAN-08023: channel c21: restored backup piece 1RMAN-08511: piece handle=dbf_26_402253457_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08016: channel c21: starting datafile backupset restoreRMAN-08502: set_count=27 set_stamp=402253457RMAN-08019: channel c22: restoring datafile 9RMA
22、N-08509: destination for restore of datafile 9: /dev/vx/rdsk/datadg/t2s500n2RMAN-08019: channel c21: restoring datafile 11RMAN-08509: destination for restore of datafile 11: /dev/vx/rdsk/datadg/t2s500n10RMAN-08019: channel c22: restoring datafile 12RMAN-08509: destination for restore of datafile 12:
23、 /dev/vx/rdsk/datadg/t3s500n1RMAN-08019: channel c21: restoring datafile 14RMAN-08509: destination for restore of datafile 14: /dev/vx/rdsk/datadg/t2s200n10RMAN-08023: channel c22: restored backup piece 1RMAN-08511: piece handle=dbf_25_402253457_1 params=NULLRMAN-08024: channel c22: restore complete
24、RMAN-08016: channel c22: starting datafile backupset restoreRMAN-08502: set_count=33 set_stamp=402253726RMAN-08019: channel c22: restoring datafile 15RMAN-08509: destination for restore of datafile 15: /dev/vx/rdsk/datadg/t2s1n1RMAN-08023: channel c21: restored backup piece 1RMAN-08511: piece handle
25、=dbf_27_402253457_1 params=NULLRMAN-08024: channel c21: restore completeRMAN-08023: channel c22: restored backup piece 1RMAN-08511: piece handle=dbf_33_402253726_1 params=NULLRMAN-08024: channel c22: restore completeRMAN-03023: executing command: partial resyncRMAN-08003: starting partial resync of
26、recovery catalogRMAN-08005: partial resync complete RMAN-03022: compiling command: recover RMAN-03022: compiling command: recover(1) RMAN-03022: compiling command: recover(2) RMAN-03022: compiling command: recover(3)RMAN-03023: executing command: recover(3)RMAN-08054: starting me
27、dia recoveryRMAN-08515: archivelog filename=/archlog/arch2_1.log thread=2 sequence=1RMAN-08515: archivelog filename=/archlog/arch1_1.log thread=1 sequence=1RMAN-08515: archivelog filename=/archlog/arch2_2.log thread=2 sequence=2RMAN-08515: archivelog filename=/archlog/arch2_3.log thread=2 sequence=3
28、RMAN-08515: archivelog filename=/archlog/arch2_4.log thread=2 sequence=4RMAN-08515: archivelog filename=/archlog/arch1_2.log thread=1 sequence=2RMAN-08515: archivelog filename=/archlog/arch2_5.log thread=2 sequence=5RMAN-08515: archivelog filename=/archlog/arch2_6.log thread=2 sequence=6RMAN-08515:
29、archivelog filename=/archlog/arch1_3.log thread=1 sequence=3RMAN-08515: archivelog filename=/archlog/arch2_7.log thread=2 sequence=7RMAN-08515: archivelog filename=/archlog/arch2_8.log thread=2 sequence=8RMAN-08515: archivelog filename=/archlog/arch2_9.log thread=2 sequence=9RMAN-08055: media recove
30、ry complete RMAN-03022: compiling command: recover(4) RMAN-03022: compiling command: sqlRMAN-06162: sql statement: alter database openRMAN-03023: executing command: sqlRMAN-03026: error recovery releasing channel resourcesRMAN-08031: released channel: c12RMAN-08031: released channel: c11RM
31、AN-08031: released channel: c21RMAN-08031: released channel: c22 Recovery Manager complete.以下將不注明恢復(fù)日志。2 表空間的恢復(fù)run allocate channel c11 type disk; allocate channel c12 type disk; allocate channel c21 type 'sbt_tape'
32、 allocate channel c22 type 'sbt_tape' sql "alter tablespace test_tbs1 offline immediate" # 使表空間離線 restore tablespace test_tbs1;
33、; # 物理恢復(fù)表空間 recover tablespace test_tbs1; # 邏輯恢復(fù)表空間(應(yīng)用日志) sql "alter tablespace test_tbs1 online" &
34、#160; # 使表空間在線 release channel c11; release channel c12; release channel c21; release channel c22; 表空間恢復(fù)分為離線
35、和在線兩種,數(shù)據(jù)庫在線時,如果某表空間發(fā)生損壞,可以進(jìn)行在線的表空間恢復(fù),該任務(wù)不會影響數(shù)據(jù)庫其他表空間的正常運(yùn)行。 當(dāng)系統(tǒng)表空間損壞,導(dǎo)致數(shù)據(jù)庫不能正常運(yùn)行,因此需離線恢復(fù)系統(tǒng)表空間。測試步驟如下:在線恢復(fù)某應(yīng)用表空間a) 破壞某表空間數(shù)據(jù)文件$ cd /dev/vx/rdsk/datadg$ dd if=data01 of=data02 bs=10kb) 對該數(shù)據(jù)文件進(jìn)行操作svrmgr> alter system check datafiles;svrmgr> sele
36、ct file#,status,error from v$datafile_header如果發(fā)現(xiàn)錯誤,則該數(shù)據(jù)庫文件已經(jīng)被損壞。c) 恢復(fù)該表空間svrmgr> alter tablespace test_tbs1 offline;$ rmanprod rectbs.rcv >> rec2.log &svrmgr> select file#,status,error from v$datafile_header在使用上命令查看恢復(fù)情況,如果所有的數(shù)據(jù)文件狀態(tài)都為“online”,即表明本恢復(fù)成功。3 系統(tǒng)表空間的恢復(fù)(數(shù)據(jù)文件
37、的恢復(fù)情況): run allocate channel c11 type disk; allocate channel c12 type disk; allocate channel c21 type 'sbt_tape' allocate channel c22 type 'sbt_tape' restore tablespace s
38、ystem; recover tablespace system; sql "alter database open" release channel c11; release channel c12; release channel c21; release channel c22;
39、60; 在對系統(tǒng)表空間進(jìn)行恢復(fù)時,由于數(shù)據(jù)庫系統(tǒng)運(yùn)行已經(jīng)不正常,因此必須使OPS某線程(本例中為test-host2上線程2)在mount狀態(tài),然后執(zhí)行以上恢復(fù)腳本。 步驟如下: $ svrmgr> startup mount; $ rmanprod rectbs.rcv >>rec2.log恢復(fù)日志與在線恢復(fù)表空間基本相同。 4 全庫物理恢復(fù),邏輯恢復(fù)至某時刻run allocate channel c11 type disk;
40、160; allocate channel c12 type disk; allocate channel c21 type 'sbt_tape' allocate channel c22 type 'sbt_tape' restore database; # 執(zhí)行數(shù)據(jù)庫全庫的物理恢復(fù) set until time 'Jul 05 2000 11:00:00' recover database
41、; # 執(zhí)行數(shù)據(jù)庫全庫的邏輯恢復(fù),恢復(fù)到該時刻的狀態(tài) sql "alter database open" release channel c11; release channel c12; release channel c21; release channel c22; 按時間點恢復(fù)的情況使用于:數(shù)據(jù)庫發(fā)生邏輯錯誤,例如在7月6日發(fā)生了邏輯錯誤,即表中有了錯誤的內(nèi)容而非數(shù)據(jù)庫系統(tǒng)故障
42、,需要恢復(fù)到7月5日11:00的狀態(tài)。 5 物理恢復(fù)至某時間點,然后邏輯恢復(fù)到該時刻:run allocate channel c11 type disk; allocate channel c12 type disk; allocate channel c21 type 'sbt_tape' allocate channel c22 type 'sbt_tape' set until time 'Jul 05 2000 11:00:00' restore data
43、base; # 執(zhí)行數(shù)據(jù)庫全庫的物理恢復(fù),恢復(fù)到2000/07/05 11:00 recover database; # 執(zhí)行數(shù)據(jù)庫全庫的邏輯恢復(fù),恢復(fù)到2000/07/05 11:00 sql "alter database open" # 打開數(shù)據(jù)庫 release channel c11;
44、0; release channel c12; release channel c21; release channel c22; 按時間點恢復(fù)的情況使用于: 使用當(dāng)前時間的備份版本不可用,必須使用前一次的備份版本進(jìn)行恢復(fù),例如在7月6日備份的磁帶發(fā)現(xiàn)故障,即磁帶中有了錯誤塊,并且數(shù)據(jù)庫系統(tǒng)發(fā)生故障,需馬上恢復(fù)到正常運(yùn)行狀態(tài),本例中即實現(xiàn)了恢復(fù)至7月5日11:00的狀態(tài)。 6 按LOGSEQ的恢復(fù)到某日志,然后邏輯恢復(fù)到當(dāng)前時刻run allocate channel c11 type disk; a
45、llocate channel c12 type disk; allocate channel c21 type 'sbt_tape' allocate channel c22 type 'sbt_tape' set until logseq 10 thread 2; restore database; set until time 'SYSDATE' recover database; sql "alter database open"
46、60; release channel c11; release channel c12; release channel c21; release channel c22; 使用如上腳本可用于將數(shù)據(jù)庫恢復(fù)到應(yīng)用某一個日志,恢復(fù)到某一日志與恢復(fù)到某時間點的結(jié)果基本相同,應(yīng)用場合也基本相同。 7 數(shù)據(jù)文件恢復(fù)到另外一個數(shù)據(jù)文件的恢復(fù)run allocate channel c11 type disk; allocate channel c12 type disk; allocate channel c21 type 'sbt_tape' allocate channel c22 type 'sbt_tape' sql “alter tablespace test_tbs1 offline immediate”; set newname f
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025屆青海省西寧市名校英語七下期中檢測模擬試題含答案
- 辦事公道考試試題及答案
- 安全自救知識試題及答案
- 安全試題及答案文庫
- 安全生產(chǎn)知識考試試題及答案
- 2025年農(nóng)村一二三產(chǎn)業(yè)融合發(fā)展的農(nóng)村養(yǎng)老產(chǎn)業(yè)發(fā)展趨勢與政策建議報告
- 安全監(jiān)理員考試試題及答案
- 數(shù)字貨幣應(yīng)用對2025年貨幣政策傳導(dǎo)機(jī)制影響下的金融風(fēng)險防控策略報告
- 2025年虛擬偶像產(chǎn)業(yè)市場競爭力報告:文化影響力與娛樂產(chǎn)業(yè)的融合發(fā)展
- 農(nóng)業(yè)廢棄物堆肥處理技術(shù)對土壤改良效果評估報告
- 醫(yī)療器械行業(yè)市場部人員崗位職責(zé)
- (中醫(yī)內(nèi)科)高級、副高級職稱考試模擬試題及答案
- 跌倒墜床原因分析預(yù)防措施
- 部編版小學(xué)道德與法治三年級下冊期末質(zhì)量檢測試卷【含答案】5套
- 弱電施工安全技術(shù)交底
- DB21T 3354-2020 遼寧省綠色建筑設(shè)計標(biāo)準(zhǔn)
- (完整版)重大危險源清單及辨識表
- 安全生產(chǎn)知識應(yīng)知應(yīng)會
- 08S305-小型潛水泵選用及安裝圖集
- 體育器材采購設(shè)備清單
- 二手車鑒定評估報告書最終
評論
0/150
提交評論