resetlogs開啟資料庫後備份、歸檔日誌是否可用的測試 RMAN-06054
本測試驗證資料庫在resetlogs開啟後,之前的備份、日誌是否可用。
--首先測試備份是否可用
--檢視資料庫版本
SQL> select * from v$version where rownum<5;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
--插入測試資料
SQL> insert into test values(1,'before');
SQL> insert into test values(1,'before');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
ID NAME
---------- --------------------
1 before
---------- --------------------
1 before
--檢視當前scn
SQL> select current_scn from v$database;
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912936147
-----------
2912936147
--清空所有備份
RMAN> list backup of database summary;
RMAN> list backup of database summary;
specification does not match any backup in the repository
RMAN> list backup of archivelog all;
specification does not match any backup in the repository
--進行資料庫全備
RMAN> backup database;
RMAN> backup database;
Starting backup at 09-APR-12
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
... ...
rdn_.bkp tag=TAG20120409T231116 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:01:50
Finished backup at 09-APR-12
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
... ...
rdn_.bkp tag=TAG20120409T231116 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:01:50
Finished backup at 09-APR-12
RMAN> list backup of database summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
119 B F A DISK 09-APR-12 1 1 YES TAG20120409T231116
120 B F A DISK 09-APR-12 1 1 YES TAG20120409T231116
123 B F A DISK 09-APR-12 1 1 YES TAG20120409T231116
124 B F A DISK 09-APR-12 1 1 YES TAG20120409T231116
125 B F A DISK 09-APR-12 1 1 YES TAG20120409T231116
--檢視當前資料庫日誌序列
SQL> select SEQUENCE#,STATUS from v$log;
SQL> select SEQUENCE#,STATUS from v$log;
SEQUENCE# STATUS
---------- ----------------
10 INACTIVE
11 INACTIVE
12 CURRENT
---------- ----------------
10 INACTIVE
11 INACTIVE
12 CURRENT
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 10
Next log sequence to archive 12
Current log sequence 12
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 10
Next log sequence to archive 12
Current log sequence 12
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
------------------
YES
--插入備份後的測試資料2
SQL> insert into test values(2,'yallonking');
SQL> insert into test values(2,'yallonking');
1 row created.
SQL> commit;
Commit complete.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912937359
-----------
2912937359
--建資料庫閃回到記錄1的狀態,並以restlogs開啟資料庫(模擬不完全恢復)
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912936147;
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912936147;
Flashback complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
--檢視測試資料
SQL> conn test/test
Connected.
SQL> select * from test;
SQL> conn test/test
Connected.
SQL> select * from test;
ID NAME
---------- --------------------
1 before
---------- --------------------
1 before
--檢視當前日誌序列
SQL> select SEQUENCE#,STATUS from v$log;
SQL> select SEQUENCE#,STATUS from v$log;
SEQUENCE# STATUS
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
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
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
--檢視當前歸檔日誌中的序列號變化
[oracle@test 2012_04_09]$ ll
total 16304
-rw-r----- 1 oracle oinstall 14886912 Apr 9 23:59 o1_mf_1_10_7r61vk5f_.arc
-rw-r----- 1 oracle oinstall 487936 Apr 9 23:47 o1_mf_1_11_7r614lr5_.arc
-rw-r----- 1 oracle oinstall 487936 Apr 9 23:59 o1_mf_1_11_7r61vl56_.arc
-rw-r----- 1 oracle oinstall 819712 Apr 9 23:59 o1_mf_1_12_7r61vl79_.arc
[oracle@test 2012_04_09]$ cd -
/tmp/TEST/archivelog/2012_04_10
[oracle@test 2012_04_10]$ ll
total 1532
-rw-r----- 1 oracle oinstall 1040384 Apr 10 00:07 o1_mf_1_1_7r6299vp_.arc
-rw-r----- 1 oracle oinstall 250368 Apr 10 00:08 o1_mf_1_1_7r62cx25_.arc
-rw-r----- 1 oracle oinstall 271872 Apr 10 00:10 o1_mf_1_1_7r62j5bk_.arc
[oracle@test 2012_04_09]$ ll
total 16304
-rw-r----- 1 oracle oinstall 14886912 Apr 9 23:59 o1_mf_1_10_7r61vk5f_.arc
-rw-r----- 1 oracle oinstall 487936 Apr 9 23:47 o1_mf_1_11_7r614lr5_.arc
-rw-r----- 1 oracle oinstall 487936 Apr 9 23:59 o1_mf_1_11_7r61vl56_.arc
-rw-r----- 1 oracle oinstall 819712 Apr 9 23:59 o1_mf_1_12_7r61vl79_.arc
[oracle@test 2012_04_09]$ cd -
/tmp/TEST/archivelog/2012_04_10
[oracle@test 2012_04_10]$ ll
total 1532
-rw-r----- 1 oracle oinstall 1040384 Apr 10 00:07 o1_mf_1_1_7r6299vp_.arc
-rw-r----- 1 oracle oinstall 250368 Apr 10 00:08 o1_mf_1_1_7r62cx25_.arc
-rw-r----- 1 oracle oinstall 271872 Apr 10 00:10 o1_mf_1_1_7r62j5bk_.arc
--插入閃回後的測試資料3
SQL> insert into test values(3,'after');
1 row created.
SQL> commit;
Commit complete.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912937130
-----------
2912937130
--嘗試閃回到備份後的記錄2,但資料庫已經閃回到備份時的1,且將日誌序列重置,故此處無法獲得記錄2 的相關日誌資訊,故閃回不到記錄2。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912937359;
flashback database to scn 2912937359
*
ERROR at line 1:
ORA-38743: Time/SCN is in the future of the database.
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912937359;
flashback database to scn 2912937359
*
ERROR at line 1:
ORA-38743: Time/SCN is in the future of the database.
--嘗試閃回到資料庫已經閃回到1且在之後又進行了3的插入,因為閃回到1後,記錄3的日誌資訊還在沒有被重置,故此刻是可以閃回到3的。
SQL> flashback database to scn 2912937130;
SQL> flashback database to scn 2912937130;
Flashback complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test.test;
ID NAME
---------- --------------------
1 before
3 after
---------- --------------------
1 before
3 after
--再次嘗試閃回到備份記錄1成功。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912936147;
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912936147;
Flashback complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test.test;
ID NAME
---------- --------------------
1 before
---------- --------------------
1 before
--下面是2種情況進行分析resetlogs後的和前的日誌是否可用的測試
--情況一
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
Fixed Size 1336960 bytes
Variable Size 331352448 bytes
Database Buffers 83886080 bytes
Redo Buffers 6094848 bytes
Database mounted.
RMAN> run{
2> set until sequence 12 thread 1;
3> recover database;
4> }
2> set until sequence 12 thread 1;
3> recover database;
4> }
executing command: SET until clause
Starting recover at 10-APR-12
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
starting media recovery
media recovery complete, elapsed time: 00:00:00
media recovery complete, elapsed time: 00:00:00
Finished recover at 10-APR-12
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test.test;
ID NAME
---------- --------------------
1 before
---------- --------------------
1 before
--此處發現resetlogs以前的歸檔日誌是可以使用的,但記錄2還是沒有恢復過來,初步斷定是當時日誌還是在redo中,沒有寫到歸檔中。
--下面重新進行測試
SQL> truncate table test.test;
SQL> truncate table test.test;
Table truncated.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912941477
-----------
2912941477
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
SQL> insert into test.test values(1,'oraking');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> alter system archive log current;
System altered.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
4 INACTIVE
5 INACTIVE
6 CURRENT
---------- ----------------
4 INACTIVE
5 INACTIVE
6 CURRENT
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912941587
-----------
2912941587
SQL> insert into test.test values(2,'yallonking');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> alter system archive log current;
System altered.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
10 INACTIVE
11 CURRENT
9 INACTIVE
---------- ----------------
10 INACTIVE
11 CURRENT
9 INACTIVE
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912942137
-----------
2912942137
SQL> insert into test.test values(3,'yallonking');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> alter system archive log current;
System altered.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
16 CURRENT
14 INACTIVE
15 ACTIVE
---------- ----------------
16 CURRENT
14 INACTIVE
15 ACTIVE
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912942252
-----------
2912942252
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 343935360 bytes
Database Buffers 71303168 bytes
Redo Buffers 6094848 bytes
Database mounted.
Fixed Size 1336960 bytes
Variable Size 343935360 bytes
Database Buffers 71303168 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912942252;
Flashback complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
SQL> select * from test.test;
ID NAME
---------- --------------------
1 oraking
2 yallonking
3 yallonking
---------- --------------------
1 oraking
2 yallonking
3 yallonking
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 343935360 bytes
Database Buffers 71303168 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> !
[oracle@test ~]$ rman target /
Fixed Size 1336960 bytes
Variable Size 343935360 bytes
Database Buffers 71303168 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> !
[oracle@test ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 10 02:30:34 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST (DBID=2055832488, not open)
RMAN> run{
2> set until sequence 10 thread 1;
3> recover database;
4> }
2> set until sequence 10 thread 1;
3> recover database;
4> }
executing command: SET until clause
Starting recover at 10-APR-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=22 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=23 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=24 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=25 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=26 device type=DISK
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=22 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=23 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=24 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=25 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=26 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:00
media recovery complete, elapsed time: 00:00:00
Finished recover at 10-APR-12
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test.test;
ID NAME
---------- --------------------
1 oraking
2 yallonking
3 yallonking
---------- --------------------
1 oraking
2 yallonking
3 yallonking
SQL> flashback database to scn 2912941587;
Flashback complete.
SQL> !
[oracle@test ~]$ rman target /
[oracle@test ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 10 02:37:20 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST (DBID=2055832488, not open)
RMAN> run{
2> set until sequence 10 thread 1;
3> recover database;}
2> set until sequence 10 thread 1;
3> recover database;}
executing command: SET until clause
Starting recover at 10-APR-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=22 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=23 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=24 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=25 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=26 device type=DISK
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=22 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=23 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=24 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=25 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=26 device type=DISK
starting media recovery
archived log for thread 1 with sequence 6 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_6_7r6bcs7b_.arc
archived log for thread 1 with sequence 7 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6bctbj_.arc
archived log for thread 1 with sequence 8 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6bcx9t_.arc
archived log for thread 1 with sequence 9 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6bcy2w_.arc
archived log for thread 1 with sequence 10 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_10_7r6bd34t_.arc
archived log for thread 1 with sequence 11 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_11_7r6bg47x_.arc
archived log for thread 1 with sequence 12 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_12_7r6bg58h_.arc
archived log for thread 1 with sequence 13 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_13_7r6bg8fs_.arc
archived log for thread 1 with sequence 14 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_14_7r6bmpom_.arc
archived log for thread 1 with sequence 15 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_15_7r6bmppk_.arc
archived log for thread 1 with sequence 16 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_16_7r6bmpnf_.arc
archived log for thread 1 with sequence 1 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_1_7r6bthx9_.arc
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_6_7r6bcs7b_.arc thread=1 sequence=6
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6bctbj_.arc thread=1 sequence=7
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6bcx9t_.arc thread=1 sequence=8
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6bcy2w_.arc thread=1 sequence=9
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_10_7r6bd34t_.arc thread=1 sequence=10
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_11_7r6bg47x_.arc thread=1 sequence=11
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_12_7r6bg58h_.arc thread=1 sequence=12
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_13_7r6bg8fs_.arc thread=1 sequence=13
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_14_7r6bmpom_.arc thread=1 sequence=14
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_15_7r6bmppk_.arc thread=1 sequence=15
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_16_7r6bmpnf_.arc thread=1 sequence=16
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_1_7r6bthx9_.arc thread=1 sequence=1
unable to find archived log
archived log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/10/2012 02:37:59
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 1 and starting SCN of 2912942650
archived log for thread 1 with sequence 7 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6bctbj_.arc
archived log for thread 1 with sequence 8 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6bcx9t_.arc
archived log for thread 1 with sequence 9 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6bcy2w_.arc
archived log for thread 1 with sequence 10 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_10_7r6bd34t_.arc
archived log for thread 1 with sequence 11 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_11_7r6bg47x_.arc
archived log for thread 1 with sequence 12 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_12_7r6bg58h_.arc
archived log for thread 1 with sequence 13 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_13_7r6bg8fs_.arc
archived log for thread 1 with sequence 14 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_14_7r6bmpom_.arc
archived log for thread 1 with sequence 15 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_15_7r6bmppk_.arc
archived log for thread 1 with sequence 16 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_16_7r6bmpnf_.arc
archived log for thread 1 with sequence 1 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_1_7r6bthx9_.arc
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_6_7r6bcs7b_.arc thread=1 sequence=6
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6bctbj_.arc thread=1 sequence=7
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6bcx9t_.arc thread=1 sequence=8
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6bcy2w_.arc thread=1 sequence=9
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_10_7r6bd34t_.arc thread=1 sequence=10
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_11_7r6bg47x_.arc thread=1 sequence=11
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_12_7r6bg58h_.arc thread=1 sequence=12
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_13_7r6bg8fs_.arc thread=1 sequence=13
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_14_7r6bmpom_.arc thread=1 sequence=14
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_15_7r6bmppk_.arc thread=1 sequence=15
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_16_7r6bmpnf_.arc thread=1 sequence=16
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_1_7r6bthx9_.arc thread=1 sequence=1
unable to find archived log
archived log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/10/2012 02:37:59
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 1 and starting SCN of 2912942650
RMAN> quit
以上說明:時刻A插入資料,進行到時刻C,閃回至時刻B,則A->B間的日誌不可用,也就是不能進行不完全恢復到A和B之間的某個時刻。
--情況二
SQL> truncate table test.test;
Table truncated.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912943400
-----------
2912943400
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
SQL> insert into test.test values(1,'oraking');
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
SQL> insert into test.test values(1,'oraking');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> alter system archive log current;
System altered.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
4 INACTIVE
5 INACTIVE
6 CURRENT
---------- ----------------
4 INACTIVE
5 INACTIVE
6 CURRENT
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912943445
-----------
2912943445
SQL> insert into test.test values(2,'yallonking');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> alter system archive log current;
System altered.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
10 INACTIVE
11 CURRENT
9 INACTIVE
---------- ----------------
10 INACTIVE
11 CURRENT
9 INACTIVE
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912943484
-----------
2912943484
SQL> insert into test.test values(3,'king');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> alter system archive log current;
System altered.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
16 INACTIVE
17 INACTIVE
18 CURRENT
---------- ----------------
16 INACTIVE
17 INACTIVE
18 CURRENT
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2912943534
-----------
2912943534
SQL> select * from test.test;
ID NAME
---------- --------------------
1 oraking
2 yallonking
3 king
---------- --------------------
1 oraking
2 yallonking
3 king
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1336960 bytes
Variable Size 356518272 bytes
Database Buffers 58720256 bytes
Redo Buffers 6094848 bytes
Database mounted.
Fixed Size 1336960 bytes
Variable Size 356518272 bytes
Database Buffers 58720256 bytes
Redo Buffers 6094848 bytes
Database mounted.
SQL> flashback database to scn 2912943445;
Flashback complete.
SQL> !
[oracle@test ~]$ rman target /
[oracle@test ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 10 03:01:36 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST (DBID=2055832488, not open)RMAN> run{
2> set until sequence 10 thread 1;
3> recover database;
4> }
2> set until sequence 10 thread 1;
3> recover database;
4> }
executing command: SET until clause
Starting recover at 10-APR-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=22 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=23 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=24 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=25 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=26 device type=DISK
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=22 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=23 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=24 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=25 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=26 device type=DISK
starting media recovery
archived log for thread 1 with sequence 6 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_6_7r6dcdn2_.arc
archived log for thread 1 with sequence 7 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6dcfgs_.arc
archived log for thread 1 with sequence 8 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6dcgko_.arc
archived log for thread 1 with sequence 9 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6dcjdd_.arc
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_6_7r6dcdn2_.arc thread=1 sequence=6
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6dcfgs_.arc thread=1 sequence=7
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6dcgko_.arc thread=1 sequence=8
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6dcjdd_.arc thread=1 sequence=9
media recovery complete, elapsed time: 00:00:00
Finished recover at 10-APR-12
archived log for thread 1 with sequence 7 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6dcfgs_.arc
archived log for thread 1 with sequence 8 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6dcgko_.arc
archived log for thread 1 with sequence 9 is already on disk as file /tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6dcjdd_.arc
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_6_7r6dcdn2_.arc thread=1 sequence=6
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_7_7r6dcfgs_.arc thread=1 sequence=7
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_8_7r6dcgko_.arc thread=1 sequence=8
archived log file name=/tmp/TEST/archivelog/2012_04_10/o1_mf_1_9_7r6dcjdd_.arc thread=1 sequence=9
media recovery complete, elapsed time: 00:00:00
Finished recover at 10-APR-12
RMAN> quit
Recovery Manager complete.
[oracle@test ~]$ exit
exit
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test.test;
ID NAME
---------- --------------------
1 oraking
2 yallonking
---------- --------------------
1 oraking
2 yallonking
--以上說明當資料庫閃回到之前的A時刻後,A之後的日誌也是可以繼續使用的。
總結:當資料庫以resetlogs開啟資料庫後,日誌序列重置,之前的備份仍然可用,但備份之後的日誌需要分情況討論。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26143577/viewspace-720847/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用_allow_resetlogs_corruption開啟無歸檔日誌rman備份庫
- 第5章:從開啟的資料庫備份與恢復之備份歸檔日誌檔案資料庫
- 用RMAN備份歸檔日誌時檢查歸檔日誌是否存在
- rman全庫備份備份歸檔日誌檔案
- 備份歸檔日誌
- 使用冷備份與冷備份後的資料庫歸檔日誌檔案進行資料庫不完整恢復資料庫
- RAC環境備份歸檔日誌和RMAN恢復啟動資料庫資料庫
- 歸檔日誌大小 與使用rman 備份後的歸檔日誌產生的備份集大小的關係
- 備份歸檔日誌檔案
- 備份之歸檔重做日誌備份
- RMAN備份資料檔案+控制檔案+歸檔日誌
- Backup And Recovery User's Guide-備份資料庫-備份歸檔重做日誌檔案GUIIDE資料庫
- 從備份集恢復歸檔日誌的測試與說明
- RMAN備份整庫和歸檔日誌的方法
- rman備份後為什麼要同時備份歸檔日誌
- 備份與恢復--從備份的歸檔日誌中恢復資料
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份歸檔重做日誌GUIIDE資料庫
- RMAN備份歸檔日誌多份 %c
- 手工rm刪除歸檔日誌對備份歸檔日誌的影響
- RMAN備份與恢復(新舊控制檔案及歸檔日誌)測試
- 冷備份+歸檔日誌的恢復
- RMAN備份歸檔日誌指令碼指令碼
- 誤刪歸檔日誌除導致備份歸檔日誌失敗
- 沒備份,歸檔日誌存在,丟失資料檔案的恢復
- Oracle設定多個歸檔路徑生成多份歸檔日誌,Rman備份時也只備份其中的一份歸檔日誌Oracle
- 測試,ogg從歸檔日誌中抽取資料
- oracle歸檔日誌丟失後的資料庫恢復Oracle資料庫
- RMAN備份與恢復(新舊控制檔案及歸檔日誌)測試(敘)
- RAC 開啟歸檔日誌
- postgresql開啟歸檔日誌SQL
- DB2資料庫的備份測試--開始備份DB2資料庫
- 資料庫備份與恢復(使用歸檔後滾)資料庫
- 非歸檔資料庫RMAN備份資料庫
- 缺少歸檔日誌,ORACLE資料庫恢復使用_allow_resetlogs_corruption引數Oracle資料庫
- Oralce資料庫關閉歸檔日誌並且刪除歸檔日誌資料庫
- Oracle RMAN 不完全恢復(只有資料檔案備份,丟失歸檔日誌備份)Oracle
- 測試在丟失歸檔日誌的情況下,跳過部分歸檔日誌進行資料恢復資料恢復
- 恢復控制檔案後,沒有最後一個歸檔日誌的備份,也沒新增歸檔日誌資訊,怎麼恢復?