Oracle 基于 RMAN 的不完全恢复(incomplete rec

系统 2500 0

      Oracle 数据库可以实现数据库不完全恢复与完全恢复。完全恢复是将数据库恢复到最新时刻,也就是无损恢复,保证数据库无丢失的恢复。而不完全恢复则是根据需要特意将数据库恢复到某个过去的特定时间点或特定的SCN以及特定的Sequence。我们可以通过 基于用户管理的不完全恢复 实现,也可以通过基于RMAN方式来实现。本文主要描述是基于RMAN的不完全恢复的几种情形并给出示例。有关数据库备份恢复,RMAN备份恢复的概念与实战可以参考文章尾部给出的链接。

 

一、不完全恢复的步骤
    a、关闭数据库并备份数据库(以防止恢复失败)
    b、启动数据库到mount 状态
    c、还原数据库
    d、将数据库恢复至某个时间点、序列、或系统改变号
    e、使用RESETLOGS关键字打开数据库

 

二、不完全恢复的几种类型
  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不完全恢复的主要操作命令

    a、基于TIME 参数不完全恢复

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 参数不完全恢复

run { 

      shutdown immediate;

      startup mount;

      set until scn 3400; 

      restore database;

      recover database;

      alter database open resetlogs;

}



c、基于SEQUENCE 参数不完全恢复:

run { 

      shutdown immediate;

      startup mount;

      set until sequence 12903;

      restore database;

      recover database;

      alter database open resetlogs;

}




  

四、演示RMAN不完全恢复

    1、准备环境

--->首先备份数据库

[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>

--下面是产生的备份文件

[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   



--演示环境

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.



-->下面的查询得到当前已产生的归档日志

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



-->创建测试用表并插入记录

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;  -->对当前日志进行归档



-->下面的查询可知产生新的归档日志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



-->应证归档日志中包含记录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



-->查看当前数据库的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;



-->此时数据库当前的redo log并没有归档,因此插入的数据位于联机日志

10:27:40 SQL> ho strings /u02/DB/oradb/redo/redo03.log | grep "Completed"

        Completed



--->下面列出完成的记录与日志对照关系

SQL> select * from t2;



ID         DT                    对应的归档日志            对应的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、实施不完全恢复

a、基于时间点的不完全恢复

[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      ---->启动数据文件还原

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     --->完成数据文件还原

Finished restore at 20130705 10:35:28



Starting recover at 20130705 10:35:29   --->启动数据恢复

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 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 --->列出日志对应的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   --->介质恢复完成,可以看到介质恢复,日志apply到了30(不包含sequence 30的内容)

Finished recover at 20130705 10:35:42             --->完成恢复



RMAN> alter database open resetlogs;              --->手动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



-->验证结果,记录Robinson已经被恢复

[oracle@node1 ~]$ ./query_t2.sh 



ID         DT

---------- --------------------

Robinson   20130705 10:08:15



[oracle@node1 ~]$ exit

exit

host command complete



-->新的incarnation已经被产生,为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的不完全恢复

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                               --->此时apply到了31(不包含sequence 31的内容)

Finished recover at 20130705 11:03:19



database opened



RMAN> host;



-->验证结果,记录Jackson已经被恢复

[oracle@node1 ~]$ ./query_t2.sh 



ID         DT

---------- --------------------

Robinson   20130705 10:08:15

Jackson    20130705 10:11:27



c、基于sequence的不完全恢复

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 --->此时也是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.



-->验证结果,记录Winson已经被恢复

[oracle@node1 ~]$ ./query_t2.sh 



ID         DT

---------- --------------------

Robinson   20130705 10:08:15

Jackson    20130705 10:11:27

Winson     20130705 10:15:47



d、恢复到最近时刻

-->此处的恢复到最近(新)时刻,也就是我们希望恢复最后的记录"Completed"

-->通常情况下,我们恢复到故障点为完全恢复,此时也可以说是做完全恢复

-->但是由于我们对数据库作了不完全恢复,因此此时即使是做完全恢复,仍然为不完全恢复,见下面的示例

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



--可以看到,数据库被apply到了sequence为33的归档日志,现在数据库寻找sequence为34为SCN为1367222的归档日志

--细心的朋友可能会发现,我们之前仅仅归档到32,那sequence为33的归档日志从而而来呢,应该是系统自动产生了一次归档

--但这里我的归档日志大小为50MB,因此也不可能是由于redo log满而产生归档



--查看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)     --->提示介质恢复完成

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      --->执行open resetlogs     

Archived Log entry 8 added for thread 1 sequence 33 ID 0x98733640 dest 1:   --->这个地方是关键

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校验错误

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          --->设置新的incarnation



-->下面的归档日志的产生时间与alert日志中的时间相吻合

[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时产生了归档日志

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



-->验证结果

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




  

五、小结
a、RMAN支持基于TIME,SCN,SEQUENCE参数的不完全恢复,不支持基于CANCEL的不完全恢复
b、所有实施了不完全恢复的数据库都需要以open resetlogs方式打开数据库,且同时伴随一个新的incarnation产生
c、不完全恢复之后即使是恢复到故障点,或者说想做完全恢复,都只能是做不完全恢复到最近时刻
d、不完全恢复后再次恢复到最新时刻,新的incarnation变为CURRENT状态,中间的incarnation为ORPHAN状态
e、首次不完全恢复以open resetlogs方式打开数据库时,未归档的联机日志被归档
f、注意until子句的用法。until子句是到什么什么,不包括,是一个非半闭包的形式
g、生产环境建议不完全恢复前后备份数据库

 

Oracle&nbsp;牛鹏社

 

相关参考
    Oracle 冷备份

    Oracle 热备份

    Oracle 备份恢复概念

    Oracle 实例恢复

    Oracle 基于用户管理恢复的处理

    SYSTEM 表空间管理及备份恢复

    SYSAUX表空间管理及恢复

    Oracle 基于备份控制文件的恢复(unsing backup controlfile)

    RMAN 概述及其体系结构

    RMAN 配置、监控与管理

    RMAN 备份详解

    RMAN 还原与恢复

    RMAN catalog 的创建和使用

    基于catalog 创建RMAN存储脚本

    基于catalog 的RMAN 备份与恢复

    RMAN 备份路径困惑

    自定义 RMAN 显示的日期时间格式

    只读表空间的备份与恢复

    Oracle 基于用户管理的不完全恢复

    理解 using backup controlfile

    使用RMAN实现异机备份恢复(WIN平台)

    使用RMAN迁移文件系统数据库到ASM

    基于Linux下 Oracle 备份策略(RMAN)

    Linux 下RMAN备份shell脚本

    使用RMAN迁移数据库到异机

    RMAN 提示符下执行SQL语句

 

Oracle 基于 RMAN 的不完全恢复(incomplete recovery by RMAN)


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论