????? Oracle 數(shù)據(jù)庫(kù)可以實(shí)現(xiàn)數(shù)據(jù)庫(kù)不完全恢復(fù)與完全恢復(fù)。完全恢復(fù)是將數(shù)據(jù)庫(kù)恢復(fù)到最新時(shí)刻,也就是無(wú)損恢復(fù),保證數(shù)據(jù)庫(kù)無(wú)丟失的恢復(fù)。而不完全恢復(fù)則是根據(jù)需要特意將數(shù)據(jù)庫(kù)恢復(fù)到某個(gè)過(guò)去的特定時(shí)間點(diǎn)或特定的SCN以及特定的Sequence。我們可以通過(guò) 基于用戶管理的不完全恢復(fù) 實(shí)現(xiàn),也可以通過(guò)基于RMAN方式來(lái)實(shí)現(xiàn)。本文主要描述是基于RMAN的不完全恢復(fù)的幾種情形并給出示例。有關(guān)數(shù)據(jù)庫(kù)備份恢復(fù),RMAN備份恢復(fù)的概念與實(shí)戰(zhàn)可以參考文章尾部給出的鏈接。
?
一、不完全恢復(fù)的步驟
??? a、關(guān)閉數(shù)據(jù)庫(kù)并備份數(shù)據(jù)庫(kù)(以防止恢復(fù)失敗)
??? b、啟動(dòng)數(shù)據(jù)庫(kù)到mount 狀態(tài)
??? c、還原數(shù)據(jù)庫(kù)
??? d、將數(shù)據(jù)庫(kù)恢復(fù)至某個(gè)時(shí)間點(diǎn)、序列、或系統(tǒng)改變號(hào)
??? e、使用RESETLOGS關(guān)鍵字打開數(shù)據(jù)庫(kù)
?
二、不完全恢復(fù)的幾種類型
??Type of Recovery??????? Function
??-------------------???? ----------------------------
??Time-based recovery???? Recovers the data up to a specified point in time.
??Cancel-based recovery?? Recovers until you issue the CANCEL statement (not available when using Recovery Manager).
??Change-based recovery?? Recovers until the specified SCN.
??Log sequence recovery?? Recovers until the specified log sequence number (only available when using Recovery Manager).
??
三、RMAN不完全恢復(fù)的主要操作命令
a、基于TIME 參數(shù)不完全恢復(fù)
run {
shutdown immediate;
startup mount;
set until time "to_date('20130705 10:09:53','yyyymmdd hh24:mi:ss')";
restore database;
recover database;
alter database open resetlogs;
}
b、基于SCN 參數(shù)不完全恢復(fù)
run {
shutdown immediate;
startup mount;
set until scn 3400;
restore database;
recover database;
alter database open resetlogs;
}
c、基于SEQUENCE 參數(shù)不完全恢復(fù):
run {
shutdown immediate;
startup mount;
set until sequence 12903;
restore database;
recover database;
alter database open resetlogs;
}
四、演示RMAN不完全恢復(fù)
1、準(zhǔn)備環(huán)境
--->首先備份數(shù)據(jù)庫(kù)
[oracle@node1 ~]$ export ORACLE_SID=oradb
[oracle@node1 ~]$ more rman_full.rcv
run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup database format '/u02/rman/full_%d_%U' tag=full_bak
plus archivelog format '/u02/rman/arch_%d_%U' tag=arch;
release channel ch1;
release channel ch2;
}
[oracle@node1 ~]$ rman target / cmdfile=/home/oracle/rman_full.rcv log=/home/oracle/rman_full.log
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11>
--下面是產(chǎn)生的備份文件
[oracle@node1 ~]$ ls -hltr /u02/rman
total 1.1G
-rw-r----- 1 oracle asmadmin 31M Jul 5 09:44 arch_ORADB_03odvgv2_1_1
-rw-r----- 1 oracle asmadmin 595M Jul 5 09:45 full_ORADB_04odvgv7_1_1
-rw-r----- 1 oracle asmadmin 490M Jul 5 09:45 full_ORADB_05odvgv7_1_1
-rw-r----- 1 oracle asmadmin 12K Jul 5 09:46 arch_ORADB_06odvh30_1_1
--演示環(huán)境
SQL> select * from v$version where rownum<2;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
SQL> conn scott/tiger;
Connected.
-->下面的查詢得到當(dāng)前已產(chǎn)生的歸檔日志
SQL> SELECT name,sequence# seq#,status,completion_time FROM v$archived_log;
NAME SEQ# S COMPLETION_TIME
---------------------------------------------------------- ---- - -----------------
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_26_8xd97058_.arc 26 A 20130705 09:44:01
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0_.arc 27 A 20130705 09:46:08
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc 28 A 20130705 10:03:36
-->創(chuàng)建測(cè)試用表并插入記錄
10:07:01 SQL> create table t2(id varchar2(10), dt varchar2(20));
10:07:57 SQL> insert into t2 select 'Robinson',to_char(sysdate,'yyyymmdd hh24:mi:ss') from dual;
10:08:15 SQL> commit;
10:08:18 SQL> alter system archive log current; -->對(duì)當(dāng)前日志進(jìn)行歸檔
-->下面的查詢可知產(chǎn)生新的歸檔日志29
10:08:28 SQL> SELECT name,sequence# seq#,status,completion_time FROM v$archived_log where sequence#>=28;
NAME SEQ# S COMPLETION_TIME
------------------------------------------------------------ ---- - -----------------
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc 28 A 20130705 10:03:36
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc 29 A 20130705 10:08:23
-->應(yīng)證歸檔日志中包含記錄Robinson
10:09:53 SQL> ho strings /u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc | grep "Robinson"
Robinson
--->第二次插入記錄
10:10:48 SQL> insert into t2 select 'Jackson',to_char(sysdate,'yyyymmdd hh24:mi:ss') from dual;
10:11:27 SQL> commit;
10:11:30 SQL> alter system archive log current;
10:11:47 SQL> SELECT name,sequence# seq#,status,completion_time FROM v$archived_log where sequence#>=28;
NAME SEQ# S COMPLETION_TIME
---------------------------------------------------------- ---- - -----------------
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc 28 A 20130705 10:03:36
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc 29 A 20130705 10:08:23
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc 30 A 20130705 10:11:47
10:12:17 SQL> ho strings /u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc | grep "Jackson"
Jackson
-->查看當(dāng)前數(shù)據(jù)庫(kù)的SCN
10:12:34 SQL> select name,current_scn from v$database;
NAME CURRENT_SCN
------------------------------ -----------
ORADB 1365679
--->第三次插入記錄
10:15:07 SQL> insert into t2 select 'Winson',to_char(sysdate,'yyyymmdd hh24:mi:ss') from dual;
10:15:47 SQL> commit;
10:21:18 SQL> alter system switch logfile;
--->第四次插入記錄
10:22:53 SQL> insert into t2 select 'LastRecord',to_char(sysdate,'yyyymmdd hh24:mi:ss') from dual;
10:23:44 SQL> commit;
10:23:47 SQL> select * from t2;
ID DT
---------- --------------------
Robinson 20130705 10:08:15
Jackson 20130705 10:11:27
Winson 20130705 10:15:47
LastRecord 20130705 10:23:44
10:23:52 SQL> alter system switch logfile;
-->下面是最終的歸檔日志情況
10:24:00 SQL> SELECT name,sequence# seq#,status,completion_time FROM v$archived_log where sequence#>=28;
NAME SEQ# S COMPLETION_TIME
------------------------------------------------------------ ---- - -----------------
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc 28 A 20130705 10:03:36
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc 29 A 20130705 10:08:23
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc 30 A 20130705 10:11:47
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_31_8xdcg1wc_.arc 31 A 20130705 10:21:53
/u02/DB/oradb/arch/2013_07_05/o1_mf_1_32_8xdcl0rx_.arc 32 A 20130705 10:24:00
10:24:12 SQL> ho strings /u02/DB/oradb/arch/2013_07_05/o1_mf_1_31_8xdcg1wc_.arc | grep "Winson"
Winson
--->最后一次插入記錄
10:25:16 SQL> insert into t2 select 'Completed',to_char(sysdate,'yyyymmdd hh24:mi:ss') from dual;
10:26:20 SQL> commit;
-->此時(shí)數(shù)據(jù)庫(kù)當(dāng)前的redo log并沒有歸檔,因此插入的數(shù)據(jù)位于聯(lián)機(jī)日志
10:27:40 SQL> ho strings /u02/DB/oradb/redo/redo03.log | grep "Completed"
Completed
--->下面列出完成的記錄與日志對(duì)照關(guān)系
SQL> select * from t2;
ID DT 對(duì)應(yīng)的歸檔日志 對(duì)應(yīng)的sequence
---------- -------------------- ------------------------ --------------
Robinson 20130705 10:08:15 o1_mf_1_29_8xdbnqx9_.arc 29
Jackson 20130705 10:11:27 o1_mf_1_30_8xdbv338_.arc 30
Winson 20130705 10:15:47 o1_mf_1_31_8xdcg1wc_.arc 31
LastRecord 20130705 10:23:44 o1_mf_1_32_8xdcl0rx_.arc 32
Completed 20130705 10:26:20 redo03.log
2、實(shí)施不完全恢復(fù)
a、基于時(shí)間點(diǎn)的不完全恢復(fù)
[oracle@node1 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 5 10:28:53 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORADB (DBID=2557712192)
RMAN> run{
2> shutdown immediate;
3> startup mount;
4> set until time "to_date('20130705 10:09:53','yyyymmdd hh24:mi:ss')";
5> restore database;
6> recover database;
7> }
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 263639040 bytes
executing command: SET until clause
Starting restore at 20130705 10:33:36
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore ---->啟動(dòng)數(shù)據(jù)文件還原
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u02/DB/oradb/oradata/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u02/DB/oradb/oradata/undotbs01.dbf
channel ORA_DISK_1: reading from backup piece /u02/rman/full_ORADB_04odvgv7_1_1
channel ORA_DISK_1: piece handle=/u02/rman/full_ORADB_04odvgv7_1_1 tag=FULL_BAK
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /u02/DB/oradb/oradata/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u02/DB/oradb/oradata/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u02/DB/oradb/oradata/example01.dbf
channel ORA_DISK_1: reading from backup piece /u02/rman/full_ORADB_05odvgv7_1_1
channel ORA_DISK_1: piece handle=/u02/rman/full_ORADB_05odvgv7_1_1 tag=FULL_BAK
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45 --->完成數(shù)據(jù)文件還原
Finished restore at 20130705 10:35:28
Starting recover at 20130705 10:35:29 --->啟動(dòng)數(shù)據(jù)恢復(fù)
using channel ORA_DISK_1
starting media recovery
---->下面提示歸檔日志已經(jīng)存在,是由于我們備份歸檔日志后并沒有對(duì)其清除
archived log for thread 1 with sequence 27 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0_.arc
archived log for thread 1 with sequence 28 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc
archived log for thread 1 with sequence 29 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc
archived log for thread 1 with sequence 30 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0_.arc thread=1 sequence=27 --->列出日志對(duì)應(yīng)的sequence
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc thread=1 sequence=28
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc thread=1 sequence=29
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc thread=1 sequence=30
media recovery complete, elapsed time: 00:00:09 --->介質(zhì)恢復(fù)完成,可以看到介質(zhì)恢復(fù),日志apply到了30(不包含sequence 30的內(nèi)容)
Finished recover at 20130705 10:35:42 --->完成恢復(fù)
RMAN> alter database open resetlogs; --->手動(dòng)open resetlogs
database opened
RMAN> host;
[oracle@node1 ~]$ more query_t2.sh
#!/bin/bash
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_SID=oradb
sqlplus -S /nolog <<EOF
connect scott/tiger
select * from scott.t2;
exit;
EOF
exit
-->驗(yàn)證結(jié)果,記錄Robinson已經(jīng)被恢復(fù)
[oracle@node1 ~]$ ./query_t2.sh
ID DT
---------- --------------------
Robinson 20130705 10:08:15
[oracle@node1 ~]$ exit
exit
host command complete
-->新的incarnation已經(jīng)被產(chǎn)生,為3
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORADB 2557712192 PARENT 1 20090813 23:00:48
2 2 ORADB 2557712192 PARENT 754488 20130111 17:37:07
3 3 ORADB 2557712192 CURRENT 1365530 20130705 10:37:15
b、基于SCN的不完全恢復(fù)
RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> reset database to incarnation 2; --->在此需要reset incarnation
database reset to incarnation 2
RMAN> run{
2> set until scn 1365679;
3> restore database;
4> recover database;
5> alter database open resetlogs;}
executing command: SET until clause
Starting restore at 20130705 11:01:14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=25 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
......................
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 20130705 11:03:05
Starting recover at 20130705 11:03:06
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 27 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0_.arc
.............................
archived log for thread 1 with sequence 31 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_31_8xdcg1wc_.arc
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0_.arc thread=1 sequence=27
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc thread=1 sequence=28
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc thread=1 sequence=29
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc thread=1 sequence=30 --->該日志包含記錄Jackson
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_31_8xdcg1wc_.arc thread=1 sequence=31
media recovery complete, elapsed time: 00:00:10 --->此時(shí)apply到了31(不包含sequence 31的內(nèi)容)
Finished recover at 20130705 11:03:19
database opened
RMAN> host;
-->驗(yàn)證結(jié)果,記錄Jackson已經(jīng)被恢復(fù)
[oracle@node1 ~]$ ./query_t2.sh
ID DT
---------- --------------------
Robinson 20130705 10:08:15
Jackson 20130705 10:11:27
c、基于sequence的不完全恢復(fù)
RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> reset database to incarnation 2;
RMAN> run{
2> set until sequence 32;
3> restore database;
4> recover database;
5> alter database open resetlogs;}
-- Author : Robinson
-- Blog : http://blog.csdn.net/robinson_0612
executing command: SET until clause
Starting restore at 05-JUL-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
...................
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 05-JUL-13
Starting recover at 05-JUL-13
using channel ORA_DISK_1
starting media recovery
...................................
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc thread=1 sequence=30
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_31_8xdcg1wc_.arc thread=1 sequence=31 --->此時(shí)也是apply到了31
media recovery complete, elapsed time: 00:00:07 --->我們指定了sequence為32(但不包含sequence 32)
Finished recover at 05-JUL-13
database opened
RMAN> host;
Recovery Manager complete.
-->驗(yàn)證結(jié)果,記錄Winson已經(jīng)被恢復(fù)
[oracle@node1 ~]$ ./query_t2.sh
ID DT
---------- --------------------
Robinson 20130705 10:08:15
Jackson 20130705 10:11:27
Winson 20130705 10:15:47
d、恢復(fù)到最近時(shí)刻
-->此處的恢復(fù)到最近(新)時(shí)刻,也就是我們希望恢復(fù)最后的記錄"Completed"
-->通常情況下,我們恢復(fù)到故障點(diǎn)為完全恢復(fù),此時(shí)也可以說(shuō)是做完全恢復(fù)
-->但是由于我們對(duì)數(shù)據(jù)庫(kù)作了不完全恢復(fù),因此此時(shí)即使是做完全恢復(fù),仍然為不完全恢復(fù),見下面的示例
RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> reset database to incarnation 2;
RMAN> run{
2> restore database;
3> recover database;
4> alter database open;}
Starting restore at 05-JUL-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
...........................
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 05-JUL-13
Starting recover at 05-JUL-13
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 27 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0_.arc
......................
archived log for thread 1 with sequence 33 is already on disk as file /u02/DB/oradb/arch/2013_07_05/o1_mf_1_33_8xddbvsc_.arc
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_27_8xd9c0f0_.arc thread=1 sequence=27
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_28_8xdbcrht_.arc thread=1 sequence=28
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc thread=1 sequence=29
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc thread=1 sequence=30
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_31_8xdcg1wc_.arc thread=1 sequence=31
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_32_8xdcl0rx_.arc thread=1 sequence=32
archived log file name=/u02/DB/oradb/arch/2013_07_05/o1_mf_1_33_8xddbvsc_.arc thread=1 sequence=33
unable to find archived log
archived log thread=1 sequence=34
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/05/2013 11:27:48
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 34 and starting SCN of 1367222
--可以看到,數(shù)據(jù)庫(kù)被apply到了sequence為33的歸檔日志,現(xiàn)在數(shù)據(jù)庫(kù)尋找sequence為34為SCN為1367222的歸檔日志
--細(xì)心的朋友可能會(huì)發(fā)現(xiàn),我們之前僅僅歸檔到32,那sequence為33的歸檔日志從而而來(lái)呢,應(yīng)該是系統(tǒng)自動(dòng)產(chǎn)生了一次歸檔
--但這里我的歸檔日志大小為50MB,因此也不可能是由于redo log滿而產(chǎn)生歸檔
--查看alert日志
[oracle@node1 trace]$ tail -1280 alert_oradb.log | more
Media Recovery Log /u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc
Fri Jul 05 10:35:41 2013
ORA-279 signalled during: alter database recover logfile '/u02/DB/oradb/arch/2013_07_05/o1_mf_1_29_8xdbnqx9_.arc'...
alter database recover logfile '/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc'
Media Recovery Log /u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc
Incomplete Recovery applied until change 1365529 time 07/05/2013 10:09:59
Media Recovery Complete (oradb) --->提示介質(zhì)恢復(fù)完成
Completed: alter database recover logfile '/u02/DB/oradb/arch/2013_07_05/o1_mf_1_30_8xdbv338_.arc'
Fri Jul 05 10:37:15 2013
alter database open resetlogs --->執(zhí)行open resetlogs
Archived Log entry 8 added for thread 1 sequence 33 ID 0x98733640 dest 1: --->這個(gè)地方是關(guān)鍵
RESETLOGS after incomplete recovery UNTIL CHANGE 1365529
Resetting resetlogs activation ID 2557687360 (0x98733640)
Errors in file /u01/app/oracle/diag/rdbms/oradb/oradb/trace/oradb_ora_30772.trc:
ORA-00367: checksum error in log file header --->下面伴隨一堆重置日志文件前的ORA校驗(yàn)錯(cuò)誤
ORA-00322: log 1 of thread 1 is not current copy
ORA-00312: online log 1 thread 1: '/u02/DB/oradb/redo/redo01.log'
Fri Jul 05 10:37:18 2013
Errors in file /u01/app/oracle/diag/rdbms/oradb/oradb/trace/oradb_m000_30963.trc:
ORA-00316: log 1 of thread 1, type 0 in header is not log file
ORA-00312: online log 1 thread 1: '/u02/DB/oradb/redo/redo01.log'
Errors in file /u01/app/oracle/diag/rdbms/oradb/oradb/trace/oradb_ora_30772.trc:
ORA-00367: checksum error in log file header
ORA-00322: log 2 of thread 1 is not current copy
ORA-00312: online log 2 thread 1: '/u02/DB/oradb/redo/redo02.log'
Errors in file /u01/app/oracle/diag/rdbms/oradb/oradb/trace/oradb_m000_30963.trc:
ORA-00316: log 2 of thread 1, type 0 in header is not log file
ORA-00312: online log 2 thread 1: '/u02/DB/oradb/redo/redo02.log'
Errors in file /u01/app/oracle/diag/rdbms/oradb/oradb/trace/oradb_ora_30772.trc:
ORA-00367: checksum error in log file header
ORA-00322: log 3 of thread 1 is not current copy
ORA-00312: online log 3 thread 1: '/u02/DB/oradb/redo/redo03.log'
Errors in file /u01/app/oracle/diag/rdbms/oradb/oradb/trace/oradb_m000_30963.trc:
ORA-00316: log 3 of thread 1, type 0 in header is not log file
ORA-00312: online log 3 thread 1: '/u02/DB/oradb/redo/redo03.log'
Fri Jul 05 10:37:23 2013
Setting recovery target incarnation to 3 --->設(shè)置新的incarnation
-->下面的歸檔日志的產(chǎn)生時(shí)間與alert日志中的時(shí)間相吻合
[oracle@node1 2013_07_05]$ ls -al --full-time o1_mf_1_33_8xddbvsc_.arc
-rw-r----- 1 oracle asmadmin 259584 2013-07-05 10:37:15.000000000 +0800 o1_mf_1_33_8xddbvsc_.arc
-->查詢視圖也可以得到在RESETLOGS時(shí)產(chǎn)生了歸檔日志
SQL> col name format a60 wrap
SQL> SELECT name,sequence# seq#,status,completion_time,end_of_redo_type eof_type from v$archived_log where sequence#=33;
NAME SEQ# S COMPLETION_TIME EOF_TYPE
------------------------------------------------------------ ---------- - ----------------- ----------
/u02/database/oradb/flash_recovery_area/ORADB/archivelog/201 33 A 20130705 10:37:15 RESETLOGS
3_07_05/o1_mf_1_33_8xddbvsc_.arc
-->驗(yàn)證結(jié)果
SQL> alter database open resetlogs;
Database altered.
SQL> select * from scott.t2;
ID DT
---------- --------------------
Robinson 20130705 10:08:15
Jackson 20130705 10:11:27
Winson 20130705 10:15:47
LastRecord 20130705 10:23:44
Completed 20130705 10:26:20
五、小結(jié)
a、RMAN支持基于TIME,SCN,SEQUENCE參數(shù)的不完全恢復(fù),不支持基于CANCEL的不完全恢復(fù)
b、所有實(shí)施了不完全恢復(fù)的數(shù)據(jù)庫(kù)都需要以open resetlogs方式打開數(shù)據(jù)庫(kù),且同時(shí)伴隨一個(gè)新的incarnation產(chǎn)生
c、不完全恢復(fù)之后即使是恢復(fù)到故障點(diǎn),或者說(shuō)想做完全恢復(fù),都只能是做不完全恢復(fù)到最近時(shí)刻
d、不完全恢復(fù)后再次恢復(fù)到最新時(shí)刻,新的incarnation變?yōu)镃URRENT狀態(tài),中間的incarnation為ORPHAN狀態(tài)
e、首次不完全恢復(fù)以open resetlogs方式打開數(shù)據(jù)庫(kù)時(shí),未歸檔的聯(lián)機(jī)日志被歸檔
f、注意until子句的用法。until子句是到什么什么,不包括,是一個(gè)非半閉包的形式
g、生產(chǎn)環(huán)境建議不完全恢復(fù)前后備份數(shù)據(jù)庫(kù)
?
?
相關(guān)參考
???
Oracle 冷備份
??? Oracle 熱備份
? ? Oracle 基于備份控制文件的恢復(fù)(unsing backup controlfile)
??? RMAN 備份詳解
??? RMAN 還原與恢復(fù)
??? RMAN catalog 的創(chuàng)建和使用
??? 基于catalog 創(chuàng)建RMAN存儲(chǔ)腳本
??? RMAN 備份路徑困惑
??? 只讀表空間的備份與恢復(fù)
??? 理解 using backup controlfile
??? 使用RMAN實(shí)現(xiàn)異機(jī)備份恢復(fù)(WIN平臺(tái))
??? 使用RMAN遷移文件系統(tǒng)數(shù)據(jù)庫(kù)到ASM
??? 基于Linux下 Oracle 備份策略(RMAN)
??? 使用RMAN遷移數(shù)據(jù)庫(kù)到異機(jī)
?
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元

