怎么进行基于sequence日志序号的恢复

网友投稿 330 2023-12-12

怎么进行基于sequence日志序号的恢复

今天就跟大家聊聊有关怎么进行基于sequence日志序号的恢复,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

怎么进行基于sequence日志序号的恢复

实验如下:--创建表ab:SQL> create table ab as select to_char(sysdate,yyyy-mm-dd hh34:mi:ss) as dd from dual;Table created.SQL> select * from v$log; GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME   NEXT_CHANGE# NEXT_TIME---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------ ------------ ------------1          1          1   52428800        512          1 NO  CURRENT                3933621 08-DEC-17      2.8147E+142          1          0   52428800        512          1 YES UNUSED                       0                         03          1          0   52428800        512          1 YES UNUSED                       0                         0SQL> archive log list;Database log mode              Archive ModeAutomatic archival             EnabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     1Next log sequence to archive   1Current log sequence           1SQL> SQL> alter system switch logfile;System altered.SQL> select * from v$log; GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME   NEXT_CHANGE# NEXT_TIME---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------ ------------ ------------1          1          1   52428800        512          1 YES ACTIVE                 3933621 08-DEC-17         3934299 08-DEC-172          1          2   52428800        512          1 NO  CURRENT                3934299 08-DEC-17      2.8147E+143          1          0   52428800        512          1 YES UNUSED                       0                         0SQL> archive log list;Database log mode              Archive ModeAutomatic archival             EnabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     1Next log sequence to archive   2Current log sequence           2SQL>   --备份数据库,热备:RMAN> backup database;Starting backup at 08-DEC-17using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00004 name=/u01/app/oracle/oradata/DBdb/users01.dbfinput datafile file number=00006 name=/u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbfinput datafile file number=00001 name=/u01/app/oracle/oradata/DBdb/system01.dbfinput datafile file number=00003 name=/u01/app/oracle/oradata/DBdb/undotbs01.dbfchannel ORA_DISK_1: starting piece 1 at 08-DEC-17channel ORA_DISK_1: finished piece 1 at 08-DEC-17piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T063250_f2mjdm4b_.bkp tag=TAG20171208T063250 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:15channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00002 name=/u01/app/oracle/oradata/DBdb/sysaux01.dbfinput datafile file number=00005 name=/u01/app/oracle/oradata/DBdb/example01.dbfchannel ORA_DISK_1: starting piece 1 at 08-DEC-17channel ORA_DISK_1: finished piece 1 at 08-DEC-17piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T063250_f2mjgy6s_.bkp tag=TAG20171208T063250 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:25channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 08-DEC-17channel ORA_DISK_1: finished piece 1 at 08-DEC-17piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T063250_f2mjhrc4_.bkp tag=TAG20171208T063250 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 08-DEC-17RMAN>  --创建表bc:SQL> create table bc as select to_char(sysdate,yyyy-mm-dd hh34:mi:ss) as dd from dual;Table created.SQL> alter system switch logfile;System altered.SQL> select * from v$log; GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME   NEXT_CHANGE# NEXT_TIME---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------ ------------ ------------1          1          1   52428800        512          1 YES INACTIVE               3933621 08-DEC-17         3934299 08-DEC-172          1          2   52428800        512          1 YES ACTIVE                 3934299 08-DEC-17         3934606 08-DEC-173          1          3   52428800        512          1 NO  CURRENT                3934606 08-DEC-17      2.8147E+14SQL>  archive log list;Database log mode              Archive ModeAutomatic archival             EnabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     1Next log sequence to archive   3Current log sequence           3SQL> SQL> select * from ab;DD-------------------2017-12-08 06:32:00SQL> select * from bc;DD-------------------2017-12-08 06:35:09--模拟删除表ab、bc:SQL> drop table ab purge;Table dropped.SQL> drop table bc purge;Table dropped.SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> SQL> startup mount;ORACLE instance started.Total System Global Area  835104768 bytesFixed Size                  2257840 bytesVariable Size             549456976 bytesDatabase Buffers          281018368 bytesRedo Buffers                2371584 bytesDatabase mounted.SQL> --开始进行恢复操作:v[oracle@wang ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 8 06:39:20 2017Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.connected to target database: DBDB (DBID=3282897732, not open)RMAN> run {      set until sequence=2;      restore database;      recover database;  alter database open resetlogs; }executing command: SET until clauseStarting restore at 08-DEC-17using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=20 device type=DISKchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/DBdb/system01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DBdb/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/DBdb/users01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T061035_f2mh3w1s_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T061035_f2mh3w1s_.bkp tag=TAG20171208T061035channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:02:25channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/DBdb/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/DBdb/example01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T061035_f2mh6759_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T061035_f2mh6759_.bkp tag=TAG20171208T061035channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:25Finished restore at 08-DEC-17Starting recover at 08-DEC-17using channel ORA_DISK_1starting media recoveryarchived log for thread 1 with sequence 1 is already on disk as file /u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/archivelog/2017_12_08/o1_mf_1_1_f2mh8kkg_.arcarchived log file name=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/archivelog/2017_12_08/o1_mf_1_1_f2mh8kkg_.arc thread=1 sequence=1archived log file name=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/archivelog/2017_12_08/o1_mf_1_1_f2mjco49_.arc thread=1 sequence=1media recovery complete, elapsed time: 00:00:02Finished recover at 08-DEC-17database openedRMAN>    --验证:SQL>     select status from v$instance;STATUS------------OPENSQL> select * from ab;DD-------------------2017-12-08 06:32:00SQL> select * from bc;select * from bc              *ERROR at line 1:

ORA-00942: table or view does not exist

结论:使用sequence进行不完全恢复时需要设置的sequence号为想要恢复的日志sequence+1。

看完上述内容,你们对怎么进行基于sequence日志序号的恢复有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Oracle 11gR2 RAC集群服务启动与关闭是怎样的
下一篇:Greenplum工具GPCC和GP日志中时间不匹配的实例分析
相关文章

 发表评论

暂时没有评论,来抢沙发吧~