歸檔的備份之delete all input
說明:
作業系統:oracle_linux_5.6_32
資料庫:oracle_11.2.0.3 單例項
問題:
我一直有個問題,用delete in put這個命令的時候,備份的時候順便備份歸檔瞭然後刪掉了
原來目錄下的歸檔,但是如果下次我們恢復的時候,需要歸檔怎麼辦,原來的位置下沒有
歸檔了,oracle會自動應用剛剛備份的歸檔嗎。
實驗步驟如下:
(1)
檢視錶zsx中有多少條資料
SQL> select * from zsx;
ID
----------
1
2
3
4
5
6
7
8
9
10
(2)
做一個全備包括歸檔:
RMAN> backup database format '/backup/2013_11_14_1055_%U.bak'
plus archivelog delete all input;
(3)
插入10條資料
begin
for i in 11..20
loop
insert into zsx values (i);
commit;
end loop;
end;
(4)
SQL> alter system checkpoint;
SQL> alter system switch logfile;
(5)
繼續插入資料
begin
for i in 21..10000
loop
insert into zsx values (i);
commit;
end loop;
end;
(6)
會產生更多的歸檔,我們將歸檔備份走:
RMAN> backup archivelog all format '/backup/2013_11_14_1139_arc_%U.bak' delete input;
(7)
現在想做完全恢復,但是/arch下的歸檔都沒有了,而原先備份的時候只有10條資料
[oracle@RAC1 arch]$ ll
total 0
(8)
我們試著做完全恢復,看看會不會oracle自動用備份的歸檔。
[oracle@RAC1 rac1]$ rm -rf *.dbf
(9)
shutdown abort;
(10)
startup mount;
(11)
RMAN> restore database;
(12)
SQL> recover database;
ORA-00279: change 577511 generated at 11/26/2013 06:25:59 needed for thread 1
ORA-00289: suggestion : /arch/1_4_832476410.arc
ORA-00280: change 577511 for thread 1 is in sequence #4
Specify log: {=suggested | filename | AUTO | CANCEL}
注意:
這時候預設的歸檔路徑下沒有歸檔了,但是指定需要備份的歸檔而且路徑是在/arch,我們拭目以待,
敲個auto。
auto
ORA-00308: cannot open archived log '/arch/1_4_832476410.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
注意:
發現不行。
(13)
根據上面發現,我們需要4號歸檔,因為我們有備份,所以不怕。
(14)
恢復歸檔
既然需要4號,而且4號以後的都沒有了,那麼我們就從4號歸檔開始恢復:
RMAN> restore archivelog from logseq 4;
(15)
檢視歸檔路徑下的歸檔,從4號到我們備份時候的歸檔都有了
[oracle@RAC1 arch]$ ll
total 5788
-rw-r----- 1 oracle oinstall 1024 Nov 26 07:34 1_10_832476410.arc
-rw-r----- 1 oracle oinstall 50176 Nov 26 07:34 1_11_832476410.arc
-rw-r----- 1 oracle oinstall 4608 Nov 26 07:34 1_12_832476410.arc
-rw-r----- 1 oracle oinstall 2048 Nov 26 07:34 1_13_832476410.arc
-rw-r----- 1 oracle oinstall 18944 Nov 26 07:34 1_4_832476410.arc
-rw-r----- 1 oracle oinstall 260096 Nov 26 07:34 1_5_832476410.arc
-rw-r----- 1 oracle oinstall 22528 Nov 26 07:34 1_6_832476410.arc
-rw-r----- 1 oracle oinstall 5519360 Nov 26 07:34 1_7_832476410.arc
-rw-r----- 1 oracle oinstall 1024 Nov 26 07:34 1_8_832476410.arc
-rw-r----- 1 oracle oinstall 1024 Nov 26 07:34 1_9_832476410.arc
(16)
再次恢復:輸入auto
SQL> recover database;
ORA-00279: change 577511 generated at 11/26/2013 06:25:59 needed for thread 1
ORA-00289: suggestion : /arch/1_4_832476410.arc
ORA-00280: change 577511 for thread 1 is in sequence #4
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
注意歸檔自動應用,並且介質恢復完成。
ORA-00279: change 578065 generated at 11/26/2013 06:42:33 needed for thread 1
ORA-00289: suggestion : /arch/1_6_832476410.arc
ORA-00280: change 578065 for thread 1 is in sequence #6
ORA-00278: log file '/arch/1_5_832476410.arc' no longer needed for this
recovery
ORA-00279: change 598139 generated at 11/26/2013 06:50:53 needed for thread 1
ORA-00289: suggestion : /arch/1_7_832476410.arc
ORA-00280: change 598139 for thread 1 is in sequence #7
ORA-00278: log file '/arch/1_6_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609383 generated at 11/26/2013 07:02:21 needed for thread 1
ORA-00289: suggestion : /arch/1_8_832476410.arc
ORA-00280: change 609383 for thread 1 is in sequence #8
ORA-00278: log file '/arch/1_7_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609385 generated at 11/26/2013 07:02:23 needed for thread 1
ORA-00289: suggestion : /arch/1_9_832476410.arc
ORA-00280: change 609385 for thread 1 is in sequence #9
ORA-00278: log file '/arch/1_8_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609387 generated at 11/26/2013 07:02:24 needed for thread 1
ORA-00289: suggestion : /arch/1_10_832476410.arc
ORA-00280: change 609387 for thread 1 is in sequence #10
ORA-00278: log file '/arch/1_9_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609389 generated at 11/26/2013 07:02:24 needed for thread 1
ORA-00289: suggestion : /arch/1_11_832476410.arc
ORA-00280: change 609389 for thread 1 is in sequence #11
ORA-00278: log file '/arch/1_10_832476410.arc' no longer needed for this
recovery
Log applied.
Media recovery complete.
(17)
開啟資料庫
SQL> alter database open;
Database altered.
(18)
檢視資料
SQL> select count(*) from zsx;
COUNT(*)
----------
10000
注意:
10000條資料都在,沒有發現丟失。
作業系統:oracle_linux_5.6_32
資料庫:oracle_11.2.0.3 單例項
問題:
我一直有個問題,用delete in put這個命令的時候,備份的時候順便備份歸檔瞭然後刪掉了
原來目錄下的歸檔,但是如果下次我們恢復的時候,需要歸檔怎麼辦,原來的位置下沒有
歸檔了,oracle會自動應用剛剛備份的歸檔嗎。
實驗步驟如下:
(1)
檢視錶zsx中有多少條資料
SQL> select * from zsx;
ID
----------
1
2
3
4
5
6
7
8
9
10
(2)
做一個全備包括歸檔:
RMAN> backup database format '/backup/2013_11_14_1055_%U.bak'
plus archivelog delete all input;
(3)
插入10條資料
begin
for i in 11..20
loop
insert into zsx values (i);
commit;
end loop;
end;
(4)
SQL> alter system checkpoint;
SQL> alter system switch logfile;
(5)
繼續插入資料
begin
for i in 21..10000
loop
insert into zsx values (i);
commit;
end loop;
end;
(6)
會產生更多的歸檔,我們將歸檔備份走:
RMAN> backup archivelog all format '/backup/2013_11_14_1139_arc_%U.bak' delete input;
(7)
現在想做完全恢復,但是/arch下的歸檔都沒有了,而原先備份的時候只有10條資料
[oracle@RAC1 arch]$ ll
total 0
(8)
我們試著做完全恢復,看看會不會oracle自動用備份的歸檔。
[oracle@RAC1 rac1]$ rm -rf *.dbf
(9)
shutdown abort;
(10)
startup mount;
(11)
RMAN> restore database;
(12)
SQL> recover database;
ORA-00279: change 577511 generated at 11/26/2013 06:25:59 needed for thread 1
ORA-00289: suggestion : /arch/1_4_832476410.arc
ORA-00280: change 577511 for thread 1 is in sequence #4
Specify log: {
注意:
這時候預設的歸檔路徑下沒有歸檔了,但是指定需要備份的歸檔而且路徑是在/arch,我們拭目以待,
敲個auto。
auto
ORA-00308: cannot open archived log '/arch/1_4_832476410.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
注意:
發現不行。
(13)
根據上面發現,我們需要4號歸檔,因為我們有備份,所以不怕。
(14)
恢復歸檔
既然需要4號,而且4號以後的都沒有了,那麼我們就從4號歸檔開始恢復:
RMAN> restore archivelog from logseq 4;
(15)
檢視歸檔路徑下的歸檔,從4號到我們備份時候的歸檔都有了
[oracle@RAC1 arch]$ ll
total 5788
-rw-r----- 1 oracle oinstall 1024 Nov 26 07:34 1_10_832476410.arc
-rw-r----- 1 oracle oinstall 50176 Nov 26 07:34 1_11_832476410.arc
-rw-r----- 1 oracle oinstall 4608 Nov 26 07:34 1_12_832476410.arc
-rw-r----- 1 oracle oinstall 2048 Nov 26 07:34 1_13_832476410.arc
-rw-r----- 1 oracle oinstall 18944 Nov 26 07:34 1_4_832476410.arc
-rw-r----- 1 oracle oinstall 260096 Nov 26 07:34 1_5_832476410.arc
-rw-r----- 1 oracle oinstall 22528 Nov 26 07:34 1_6_832476410.arc
-rw-r----- 1 oracle oinstall 5519360 Nov 26 07:34 1_7_832476410.arc
-rw-r----- 1 oracle oinstall 1024 Nov 26 07:34 1_8_832476410.arc
-rw-r----- 1 oracle oinstall 1024 Nov 26 07:34 1_9_832476410.arc
(16)
再次恢復:輸入auto
SQL> recover database;
ORA-00279: change 577511 generated at 11/26/2013 06:25:59 needed for thread 1
ORA-00289: suggestion : /arch/1_4_832476410.arc
ORA-00280: change 577511 for thread 1 is in sequence #4
Specify log: {
auto
注意歸檔自動應用,並且介質恢復完成。
ORA-00279: change 578065 generated at 11/26/2013 06:42:33 needed for thread 1
ORA-00289: suggestion : /arch/1_6_832476410.arc
ORA-00280: change 578065 for thread 1 is in sequence #6
ORA-00278: log file '/arch/1_5_832476410.arc' no longer needed for this
recovery
ORA-00279: change 598139 generated at 11/26/2013 06:50:53 needed for thread 1
ORA-00289: suggestion : /arch/1_7_832476410.arc
ORA-00280: change 598139 for thread 1 is in sequence #7
ORA-00278: log file '/arch/1_6_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609383 generated at 11/26/2013 07:02:21 needed for thread 1
ORA-00289: suggestion : /arch/1_8_832476410.arc
ORA-00280: change 609383 for thread 1 is in sequence #8
ORA-00278: log file '/arch/1_7_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609385 generated at 11/26/2013 07:02:23 needed for thread 1
ORA-00289: suggestion : /arch/1_9_832476410.arc
ORA-00280: change 609385 for thread 1 is in sequence #9
ORA-00278: log file '/arch/1_8_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609387 generated at 11/26/2013 07:02:24 needed for thread 1
ORA-00289: suggestion : /arch/1_10_832476410.arc
ORA-00280: change 609387 for thread 1 is in sequence #10
ORA-00278: log file '/arch/1_9_832476410.arc' no longer needed for this
recovery
ORA-00279: change 609389 generated at 11/26/2013 07:02:24 needed for thread 1
ORA-00289: suggestion : /arch/1_11_832476410.arc
ORA-00280: change 609389 for thread 1 is in sequence #11
ORA-00278: log file '/arch/1_10_832476410.arc' no longer needed for this
recovery
Log applied.
Media recovery complete.
(17)
開啟資料庫
SQL> alter database open;
Database altered.
(18)
檢視資料
SQL> select count(*) from zsx;
COUNT(*)
----------
10000
注意:
10000條資料都在,沒有發現丟失。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29107230/viewspace-1062261/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- delete input 與 delete all inputdelete
- rman 中的 delete all input 和 delete input 的區別delete
- backup archivelog delete input 與delete all input 區別Hivedelete
- DELETE OBSOLETE不刪除歸檔日誌以及歸檔的備份集delete
- 備份之歸檔重做日誌備份
- 測試RMAN的backup archivelog all delete input會不會刪除還未傳輸到備庫的歸檔日誌Hivedelete
- BACKUP ARCHIVELOG with DELETE INPUT or DELET all..Hivedelete
- ASM+RMAN使用delete input備份日誌的問題ASMdelete
- RMAN備份、恢復實驗室 之 備份篇 【歸檔模式】模式
- 備份&恢復之四:非歸檔模式下的備份與恢復模式
- oracle 如何不備份已經備份的歸檔Oracle
- 備份歸檔日誌報錯ORA-19625: crosscheck archivelog allROSHive
- 備份歸檔日誌
- 理解RMAN backup database plus archivelog delete all input命令DatabaseHivedelete
- rman全庫備份備份歸檔日誌檔案
- 備份歸檔日誌檔案
- 冷備份應用歸檔
- RMAN說,我能備份(5)--RMAN備份歸檔檔案
- 不備份上次已經備份的歸檔
- oracle實驗記錄 (恢復-rman操作delete(all) input )Oracledelete
- Oracle設定多個歸檔路徑生成多份歸檔日誌,Rman備份時也只備份其中的一份歸檔日誌Oracle
- Oracle的奇葩設定之非歸檔模式與RMAN備份Oracle模式
- 備份之控制檔案備份
- RMAN備份歸檔日誌多份 %c
- Oracle歸檔空間不足,delete archivelog all;命令失效時解決方法OracledeleteHive
- rman開啟備份優化對備份歸檔的影響優化
- 無備份恢復(歸檔模式)模式
- oracle10g rac(rhel4)_rman備份歸檔出錯_backup archivelog allOracleHive
- 第5章:從開啟的資料庫備份與恢復之備份歸檔日誌檔案資料庫
- 【備份恢復】 閃回技術之閃迴歸檔
- 基於歸檔的冷備份恢復
- 冷備份+歸檔日誌的恢復
- 非歸檔模式下的資料備份模式
- RMAN備份恢復之歸檔日誌對BLOCKRECOVER的影響BloC
- 歸檔日誌大小 與使用rman 備份後的歸檔日誌產生的備份集大小的關係
- rman備份但丟失一個資料檔案,但有歸檔備份
- 備份前先設定成歸檔模式模式
- RMAN備份歸檔日誌指令碼指令碼