oracle 10g r2新功能可以跨越resetlogs 恢復
10g 新版本可以跨越resetlogs 用先前的備份來恢復 ,雖然有這個特性,但還是建議resetlogs 馬上進行全庫備份
10g 以前版本是不行的
先測試下9i
RMAN> recover database;
Starting recover at 05-JUN-08
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=22
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\BACKUP\3AJI5OME_1_1 tag=TAG20080605T121510 params=NULL
channel ORA_DISK_1: restore complete
archive log filename=D:\ARCHPAUL\PUBTEST_1_22.DBF thread=1 sequence=22
unable to find archive log
archive log thread=1 sequence=23
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/05/2008 14:42:21
RMAN-06054: media recovery requesting unknown log: thread 1 scn 769229
RMAN> alter database open resetlogs;
database opened
RMAN> exit
Recovery Manager complete.
C:\Documents and Settings\Paul Yi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on Thu Jun 5 14:46:46 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select count(*) from test;
COUNT(*)
----------
64
SQL> insert into test select * from test;
64 rows created.
SQL> /
128 rows created.
SQL> commit;
Commit complete.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination d:\archpaul
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL> alter system switch logfile;
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination d:\archpaul
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL> select count(*) from test;
COUNT(*)
----------
256
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
C:\Documents and Settings\Paul Yi>rman target /
Recovery Manager: Release 9.2.0.8.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 101785012 bytes
Fixed Size 454068 bytes
Variable Size 75497472 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
RMAN> restore controlfile from 'd:\backup\C-799229701-20080605-01';
Starting restore at 05-JUN-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
channel ORA_DISK_1: restoring controlfile
channel ORA_DISK_1: restore complete
replicating controlfile
input filename=D:\ORACLE\ORADATA\PUBTEST\CONTROL01.CTL
output filename=D:\ORACLE\ORADATA\PUBTEST\CONTROL02.CTL
output filename=D:\ORACLE\ORADATA\PUBTEST\CONTROL03.CTL
Finished restore at 05-JUN-08
RMAN> alter database mount;
database mounted
RMAN> restore database;
Starting restore at 05-JUN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:\ORACLE\ORADATA\PUBTEST\SYSTEM01.DBF
restoring datafile 00002 to D:\ORACLE\ORADATA\PUBTEST\UNDOTBS01.DBF
restoring datafile 00003 to D:\ORACLE\ORADATA\PUBTEST\EXAMPLE01.DBF
restoring datafile 00004 to D:\ORACLE\ORADATA\PUBTEST\INDX01.DBF
restoring datafile 00005 to D:\ORACLE\ORADATA\PUBTEST\TOOLS01.DBF
restoring datafile 00006 to D:\ORACLE\ORADATA\PUBTEST\USERS01.DBF
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\BACKUP\39JI5OL0_1_1 tag=TAG20080605T121424 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 05-JUN-08
RMAN> recover database;
Starting recover at 05-JUN-08
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=22
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\BACKUP\3AJI5OME_1_1 tag=TAG20080605T121510 params=NULL
channel ORA_DISK_1: restore complete
archive log filename=D:\ARCHPAUL\PUBTEST_1_22.DBF thread=1 sequence=22
unable to find archive log
archive log thread=1 sequence=23
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/05/2008 14:52:03
RMAN-06054: media recovery requesting unknown log: thread 1 scn 769229
RMAN> alter database open resetlogs;
database opened
RMAN> exit
Recovery Manager complete.
C:\Documents and Settings\Paul Yi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on Thu Jun 5 14:52:30 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select count(*) from test;
COUNT(*)
----------
64
還是恢復到先前備份的那種狀態 後面resetlogs後新增加的資料丟失了 這是因為不能跨越resetlogs的恢復
所以9i 強烈建議 resetlogs必須全備份一次資料庫
10g R2下的測試:
RMAN> alter database open resetlogs;
資料庫已開啟
RMAN> exit
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Paul Yi>set oracle_sid=orcl
C:\Documents and Settings\Paul Yi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on Thu Jun 5 16:25:18 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL> select count(*) from test;
COUNT(*)
----------
45028
SQL> insert into test select * from test;
45028 rows created.
SQL> commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
90056
SQL> shutdown immediate;
用先前的備份恢復:
RMAN> startup nomount;
已連線到目標資料庫 (未啟動)
Oracle 例項已啟動
系統全域性區域總計 289406976 位元組
Fixed Size 1248576 位元組
Variable Size 96469696 位元組
Database Buffers 184549376 位元組
Redo Buffers 7139328 位元組
RMAN> restore controlfile from 'D:\oracle\flash_recovery_area\ORCL\AUTOBACKUP\20
08_06_05\O1_MF_S_656605042_44H17N1V_.BKP';
啟動 restore 於 05-6月 -08
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=157 devtype=DISK
通道 ORA_DISK_1: 正在復原控制檔案
通道 ORA_DISK_1: 恢復完成, 用時: 00:00:03
輸出檔名=D:\ORACLE\ORADATA\ORCL\CONTROL01.CTL
輸出檔名=D:\ORACLE\ORADATA\ORCL\CONTROL02.CTL
輸出檔名=D:\ORACLE\ORADATA\ORCL\CONTROL03.CTL
完成 restore 於 05-6月 -08
RMAN> alter database mount;
資料庫已裝載
釋放的通道: ORA_DISK_1
RMAN> restore database;
啟動 restore 於 05-6月 -08
啟動 implicit crosscheck backup 於 05-6月 -08
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=156 devtype=DISK
已交叉檢驗的 3 物件
完成 implicit crosscheck backup 於 05-6月 -08
啟動 implicit crosscheck copy 於 05-6月 -08
使用通道 ORA_DISK_1
完成 implicit crosscheck copy 於 05-6月 -08
搜尋恢復區域中的所有檔案
正在編制檔案目錄...
目錄編制完畢
已列入目錄的檔案的列表
=======================
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1_18_44H1
Z3FW_.ARC
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1_19_44H1
Z26L_.ARC
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1_1_44H26
3WN_.ARC
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1_1_44H2F
DQC_.ARC
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1_20_44H1
Z2PO_.ARC
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1_2_44H2F
D3T_.ARC
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566050
42_44H17N1V_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566052
54_44H1G7SD_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566052
62_44H1GJJ3_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566054
19_44H1MDOK_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566058
15_44H1ZSFF_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566062
67_44H2FX5R_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566081
98_44H4B85T_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_06_05\O1_MF_S_6566082
49_44H4CTKM_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_06_05\O1_MF_ANNNN_TAG2
0080605T142217_44H1JTVV_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_06_05\O1_MF_ANNNN_TAG2
0080605T142336_44H1M9XC_.BKP
檔名: D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_06_05\O1_MF_NNNDF_TAG2
0080605T142220_44H1JWYS_.BKP
使用通道 ORA_DISK_1
未處理資料檔案 4, 因為檔案是隻讀的
未處理資料檔案 5, 因為檔案是隻讀的
通道 ORA_DISK_1: 正在開始恢復資料檔案備份集
通道 ORA_DISK_1: 正在指定從備份集恢復的資料檔案
正將資料檔案00001恢復到D:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF
正將資料檔案00002恢復到D:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF
正將資料檔案00003恢復到D:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF
通道 ORA_DISK_1: 正在讀取備份段 D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\200
8_06_05\O1_MF_NNNDF_TAG20080605T142220_44H1JWYS_.BKP
通道 ORA_DISK_1: 已恢復備份段 1
段控制程式碼 = D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_06_05\O1_MF_NNNDF_TAG
20080605T142220_44H1JWYS_.BKP 標記 = TAG20080605T142220
通道 ORA_DISK_1: 恢復完成, 用時: 00:00:35
完成 restore 於 05-6月 -08
RMAN> recover database;
啟動 recover 於 05-6月 -08
使用通道 ORA_DISK_1
未處理資料檔案 4, 因為檔案是隻讀的
未處理資料檔案 5, 因為檔案是隻讀的
正在開始介質的恢復
存檔日誌執行緒 1 序列 18 已作為檔案 D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\
2008_06_05\O1_MF_1_18_44H1Z3FW_.ARC 存在於磁碟上
存檔日誌執行緒 1 序列 19 已作為檔案 D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\
2008_06_05\O1_MF_1_19_44H1Z26L_.ARC 存在於磁碟上
存檔日誌執行緒 1 序列 20 已作為檔案 D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\
2008_06_05\O1_MF_1_20_44H1Z2PO_.ARC 存在於磁碟上
存檔日誌執行緒 1 序列 1 已作為檔案 D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2
008_06_05\O1_MF_1_1_44H263WN_.ARC 存在於磁碟上
存檔日誌執行緒 1 序列 2 已作為檔案 D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2
008_06_05\O1_MF_1_2_44H2FD3T_.ARC 存在於磁碟上
存檔日誌執行緒 1 序列 1 已作為檔案 D:\ORACLE\ORADATA\ORCL\REDO01.LOG 存在於磁碟上
通道 ORA_DISK_1: 正在啟動到預設目標的存檔日誌恢復
通道 ORA_DISK_1: 正在恢復存檔日誌
存檔日誌執行緒 =1 序列=16
通道 ORA_DISK_1: 正在恢復存檔日誌
存檔日誌執行緒 =1 序列=17
通道 ORA_DISK_1: 正在讀取備份段 D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\200
8_06_05\O1_MF_ANNNN_TAG20080605T142217_44H1JTVV_.BKP
通道 ORA_DISK_1: 已恢復備份段 1
段控制程式碼 = D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_06_05\O1_MF_ANNNN_TAG
20080605T142217_44H1JTVV_.BKP 標記 = TAG20080605T142217
通道 ORA_DISK_1: 恢復完成, 用時: 00:00:02
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_16_44HB9609_.ARC 執行緒 =1 序列 =16
通道 default: 正在刪除存檔日誌
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_16_44HB9609_.ARC 記錄 ID=16 時間戳 =656614310
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_17_44HB9627_.ARC 執行緒 =1 序列 =17
通道 default: 正在刪除存檔日誌
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_17_44HB9627_.ARC 記錄 ID=15 時間戳 =656614310
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_18_44H1Z3FW_.ARC 執行緒 =1 序列 =18
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_19_44H1Z26L_.ARC 執行緒 =1 序列 =19
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_20_44H1Z2PO_.ARC 執行緒 =1 序列 =20
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_1_44H263WN_.ARC 執行緒 =1 序列 =1
存檔日誌檔名 =D:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_06_05\O1_MF_1
_2_44H2FD3T_.ARC 執行緒 =1 序列 =2
存檔日誌檔名 =D:\ORACLE\ORADATA\ORCL\REDO01.LOG 執行緒 =1 序列 =1
建立資料檔案 fno = 6 名稱 = D:\UNDO01.DBF
存檔日誌檔名 =D:\ORACLE\ORADATA\ORCL\REDO01.LOG 執行緒 =1 序列 =1
介質恢復完成, 用時: 00:00:06
完成 recover 於 05-6月 -08
RMAN> alter database open resetlogs;
資料庫已開啟
RMAN> exit
恢復管理器完成。
F:\oracle\product\10.2.0\db_1\BIN>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 6月 5 16:53:20 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
連線到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(*) from test;
COUNT(*)
----------
90056
SQL>
resetlogs後新增的資料也增加上了 資料一致
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-332603/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle資料庫恢復之resetlogsOracle資料庫
- Oracle 11g R2 備份與恢復Oracle
- Oracle為什麼使用備份的控制檔案恢復後一定要resetlogsOracle
- NBU恢復oracleOracle
- Oracle案例12——NBU Oracle恢復Oracle
- forall在10g新功能
- oracle冷備恢復Oracle
- oracle 異機恢復Oracle
- Oracle RMAN恢復測試Oracle
- Oracle 不完全恢復Oracle
- Oracle RushQL勒索病毒恢復方法Oracle
- Oracle 備份 與 恢復 概述Oracle
- Oracle 備份恢復之 FlashbackOracle
- Oracle恢復誤刪資料Oracle
- ORACLE備份&恢復案例(轉)Oracle
- oracle基於SCN增量恢復Oracle
- Oracle Redo丟失恢復方案Oracle
- Oracle RMAN 表空間恢復Oracle
- 備份與恢復oracle_homeOracle
- oracle 增量備份恢復驗證Oracle
- Oracle 備份和恢復介紹Oracle
- oracle使用小記、刪除恢復Oracle
- ORACLE備份&恢復案例三(轉)Oracle
- ORACLE備份&恢復案例二(轉)Oracle
- Networker恢復oracle rac到單機Oracle
- 【Oracle 恢復表空間】 實驗Oracle
- 兩篇oracle異機恢復文章Oracle
- ORACLE本地磁碟備份恢復Oracle
- oracle 10g flashback databaseOracle 10gDatabase
- 剪下後的檔案可以恢復嗎?恢復剪下檔案怎麼辦?
- 7_Oracle truncate異常恢復之plsql修復OracleSQL
- 6_Oracle truncate異常恢復之bbed修復Oracle
- Oracle 12c 備份與恢復Oracle
- Oracle資料庫冷備和恢復Oracle資料庫
- Oracle 備份恢復篇之RMAN catalogOracle
- ORACLE DG從庫 Rman備份恢復Oracle
- Oracle 檔案意外刪除恢復(Linux)OracleLinux
- Oracle & MySQL & PostgreSQL資料庫恢復支援OracleMySql資料庫
- Oracle asm磁碟損壞異常恢復OracleASM