基于scn的恢复是怎样的

网友投稿 216 2023-12-29

基于scn的恢复是怎样的

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

基于scn的恢复是怎样的

--先背备份:(热备)[oracle@wang ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 8 19:35:11 2017Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.connected to target database: DBDB (DBID=3282897732)RMAN> backup database;Starting backup at 08-DEC-17using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=44 device type=DISKchannel 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_TAG20171208T193949_f2nyj5gy_.bkp tag=TAG20171208T193949 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:55channel 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-17 channel 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_TAG20171208T193949_f2nykwl2_.bkp tag=TAG20171208T193949 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_TAG20171208T193949_f2nylpqk_.bkp tag=TAG20171208T193949 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 08-DEC-17RMAN>     二、模拟操作:SQL> select current_scn from v$database;CURRENT_SCN-----------    3960846SQL>  SQL> create table scott.scn_a as select * from dba_objects;Table created.SQL> select count(*) from scott.scn_a;  COUNT(*)----------     87053SQL> select current_scn from v$database;CURRENT_SCN-----------    3960968SQL> SQL> create table hr.scn_b as select * from dba_objects;Table created.SQL> select count(*) from hr.scn_b;  COUNT(*)----------     87054SQL> select current_scn from v$database;CURRENT_SCN-----------    3961042SQL>        SQL> alter system switch logfile;System altered.SQL> SQL> select current_scn from v$database;CURRENT_SCN-----------    3961063SQL> SQL> alter system checkpoint;System altered.SQL> SQL> select current_scn from v$database;CURRENT_SCN-----------    3961088--删除表scn_a/scn_b:SQL> drop table scott.scn_a purge;Table dropped.SQL> drop table hr.scn_b purge;

Table dropped.

--进行恢复:--关库,启动到mount状态: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> 启用rman进行恢复:[oracle@wang ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 8 19:49:38 2017Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.connected to target database: DBDB (DBID=3282897732, not open)RMAN>      RMAN> run {      set until scn =3960968;      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_TAG20171208T193949_f2nyj5gy_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nyj5gy_.bkp tag=TAG20171208T193949channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:02:15channel 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_TAG20171208T193949_f2nykwl2_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nykwl2_.bkp tag=TAG20171208T193949channel 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 recoverymedia recovery complete, elapsed time: 00:00:00Finished recover at 08-DEC-17database openedRMAN>   --验证:SQL> select status from v$instance;STATUS------------OPENSQL> select count(*) from scott.scn_a;  COUNT(*)----------     87053SQL> SQL> select count(*) from hr.scn_b;select count(*) from hr.scn_b                        *ERROR at line 1:ORA-00942: table or view does not exist

因为恢复时只是恢复到创建scn_a表后查询到的current_scn,此时表scn_b还没有创建。

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

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

上一篇:vuemethods(vuemethods和computed 的区别)
下一篇:vuei18n接受一个变量?
相关文章

 发表评论

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