Oracle 10g跨越Resetlogs时间点进行恢复(3)

日期: 2008-06-12 作者:Alizze 来源:TechTarget中国

  四、此时的数据库状态


  $ sqlplus “/ as sysdba”


  SQL*Plus: Release 10.1.0.2.0 – Production on Tue Apr 5 16:43:58 2005


  Copyright (c) 1982, 2004, Oracle. All rights reserved.


  Connected to:


  Oracle Database 10g Enterprise Edition


  Release 10.1.0.2.0 – 64bit Production


  With the Partitioning, OLAP and Data Mining options


  SYS AS SYSDBA on 2005-04-05 16:43:58 >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


  SYS AS SYSDBA on 2005-04-05 16:44:01 >select count(*) from t;


  count(*)


  ———-


  18956


  五、继续进行数据更改


  SYS AS SYSDBA on 2005-04-05 16:44:08 >


  create table tt as select * from dba_users;


  Table created.


  SYS AS SYSDBA on 2005-04-05 16:45:51 >alter system switch logfile;


  System altered.


  SYS AS SYSDBA on 2005-04-05 16:45:56 >select count(*) from tt;


  count(*)


  ———-


  12


  SYS AS SYSDBA on 2005-04-05 16:46:01 >insert into tt select * from tt;


  12 rows created.


  SYS AS SYSDBA on 2005-04-05 16:46:13 >commit;


  Commit complete.


  SYS AS SYSDBA on 2005-04-05 16:46:16 >alter system switch logfile;


  System altered.


  此时的日志序列:


  SYS AS SYSDBA on 2005-04-05 17:46:19 >


  select * from v$log_history where recid >1811;



  RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIME


  NEXT_CHANGE# RESETLOGS_CHANGE# RESETLOGS_TIME


  ———- ———- ———- ———- ————-


  1812 554813757 1 1 10923677 2005-04-05 09:54:53 10925720 10923677 2005-04-05 09:54:53


  1813 554813974 1 2 10925720 2005-04-05 10:55:57 10925827 10923677 2005-04-05 09:54:53


  1814 554823464 1 3 10925827 2005-04-05 10:59:34 10947409 10923677 2005-04-05 09:54:53


  1815 554828646 1 4 10947409 2005-04-05 13:37:44 10950318 10923677 2005-04-05 09:54:53


  1816 554833748 1 5 10950318 2005-04-05 15:04:06 10953123 10923677 2005-04-05 09:54:53


  1817 554833901 1 6 10953123 2005-04-05 16:29:08 10953187 10923677 2005-04-05 09:54:53


  1818 554833950 1 7 10953187 2005-04-05 16:31:41 10953213 10923677 2005-04-05 09:54:53


  1819 554834005 1 8 10953213 2005-04-05 16:32:30 10953633 10923677 2005-04-05 09:54:53


  1820 554834118 1 9 10953633 2005-04-05 16:33:25 10953726 10923677 2005-04-05 09:54:53


  1821 554834756 1 1 10953214 2005-04-05 16:42:34 10953433 10953214 2005-04-05 16:42:34


  1822 554834781 1 2 10953433 2005-04-05 16:45:56 10953445 10953214 2005-04-05 16:42:34


  11 rows selected.


  SYS AS SYSDBA on 2005-04-05 16:46:21 >shutdown immediate;


  Database closed.


  Database dismounted.


  ORACLE instance shut down.


  SYS AS SYSDBA on 2005-04-05 16:47:38 >exit


  Disconnected from Oracle Database 10g Enterprise


  Edition Release 10.1.0.2.0 – 64bit Production


  With the Partitioning, OLAP and Data Mining options


  六、再次执行恢复


  $ rman target /


  Recovery Manager: Release 10.1.0.2.0 – 64bit Production


  Copyright (c) 1995, 2004, Oracle. All rights reserved.


  connected to target database (not started)


  RMAN> startup mount;


  Oracle instance started


  database mounted


  Total System Global Area 314572800 bytes


  Fixed Size 1301704 bytes


  Variable Size 261890872 bytes


  Database Buffers 50331648 bytes


  Redo Buffers 1048576 bytes


  RMAN> run {


  2> restore database;


  3> recover database;


  4> }


  Starting restore at 2005-04-05 16:49:54


  using target database controlfile instead of recovery catalog


  allocated channel: ORA_DISK_1


  channel ORA_DISK_1: sid=160 devtype=DISK


  datafile 8 not processed because file is read-only


  channel ORA_DISK_1: starting datafile backupset restore


  channel ORA_DISK_1: specifying datafile(s) to restore from backup set


  restoring datafile 00001 to /opt/oracle/oradata/eygle/system01.dbf


  restoring datafile 00002 to /opt/oracle/oradata/eygle/undotbs01.dbf


  restoring datafile 00003 to /opt/oracle/oradata/eygle/sysaux01.dbf


  restoring datafile 00006 to /opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_test_03xv34ny_.dbf


  restoring datafile 00009 to /data1/oradata/systemfile/bigtbs.dbf


  restoring datafile 00010 to /opt/oracle/oradata/eygle/dfmbrc.dbf


  channel ORA_DISK_1: restored backup piece 1


  piece handle=/data5/flash_recovery_area/EYGLE/backupset


  /2005_04_05/o1_mf_nnndf_TAG20050405T162921_154m33kf_.bkp


  tag=TAG20050405T162921


  channel ORA_DISK_1: restore complete


  channel ORA_DISK_1: starting datafile backupset restore


  channel ORA_DISK_1: specifying datafile(s) to restore from backup set


restoring datafile 00004 to /opt/oracle/oradata/eygle/users01.dbf


restoring datafile 00005 to /data1/oradata/systemfile/eygle01.dbf


  restoring datafile 00007 to /opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_itpub_03xv5g66_.dbf


  channel ORA_DISK_1: restored backup piece 1


  piece handle=/data5/flash_recovery_area/EYGLE/backupset


  /2005_04_05/o1_mf_nnndf_TAG20050405T162921_154m6dxm_.bkp tag=TAG20050405T162921


  channel ORA_DISK_1: restore complete


  channel ORA_DISK_1: starting datafile backupset restore


  channel ORA_DISK_1: specifying datafile(s) to restore from backup set


  restoring datafile 00011 to /opt/oracle/oradata/eygle/t2k01.dbf


  channel ORA_DISK_1: restored backup piece 1


  piece handle=/data5/flash_recovery_area/EYGLE/backupset


  /2005_04_05/o1_mf_nnndf_TAG20050405T162921_154m76kz_.bkp


  tag=TAG20050405T162921


  channel ORA_DISK_1: restore complete


  Finished restore at 2005-04-05 16:52:31


  Starting recover at 2005-04-05 16:52:32


  using channel ORA_DISK_1


  datafile 8 not processed because file is offline


  starting media recovery


  archive log thread 1 sequence 7 is already on disk as file /data5/flash_recovery_area/EYGLE/archivelog


  /2005_04_05/o1_mf_1_7_154m8z7k_.arc


  archive log thread 1 sequence 1 is already on disk as file /data5/flash_recovery_area/EYGLE/archivelog


  /2005_04_05/o1_mf_1_1_154n24v5_.arc


  archive log thread 1 sequence 2 is already on disk as file /data5/flash_recovery_area/EYGLE/archivelog


  /2005_04_05/o1_mf_1_2_154n2y40_.arc


  channel ORA_DISK_1: starting archive log


  restore to default destination


  channel ORA_DISK_1: restoring archive log


  archive log thread=1 sequence=6


  channel ORA_DISK_1: restored backup piece 1


  piece handle=/data5/flash_recovery_area/EYGLE/backupset


  /2005_04_05/o1_mf_annnn_TAG20050405T163142_154m7jpo_.bkp


  tag=TAG20050405T163142


  channel ORA_DISK_1: restore complete


  archive log filename=/data5/flash_recovery_area/EYGLE/archivelog


  /2005_04_05/o1_mf_1_6_154ngror_.arc thread=1 sequence=6


  channel default: deleting archive log(s)


  archive log filename=/data5/flash_recovery_area/EYGLE/archivelog


  /2005_04_05/o1_mf_1_6_154ngror_.arc recid=306 stamp=554835160


  archive log filename=/data5/flash_recovery_area/EYGLE/archivelog


  /2005_04_05/o1_mf_1_7_154m8z7k_.arc thread=1 sequence=7


  media recovery complete


  Finished recover at 2005-04-05 16:53:04


  RMAN> alter database open;


  database opened


  RMAN> exit


  Recovery Manager complete.


  七、最后检查数据恢复情况


  注意此次恢复跨越了resetlogs时间点


  $ sqlplus “/ as sysdba”


  SQL*Plus: Release 10.1.0.2.0 – Production on


  Tue Apr 5 16:53:56 2005


  Copyright (c) 1982, 2004, Oracle. All rights reserved.


  Connected to:


  Oracle Database 10g Enterprise Edition Release


  10.1.0.2.0 – 64bit Production


  With the Partitioning, OLAP and Data Mining options


  SYS AS SYSDBA on 2005-04-05 16:53:56 >select count(*) from t;


  count(*)


  ———-


  18956


  SYS AS SYSDBA on 2005-04-05 16:54:01 >select count(*) from tt;


  count(*)


  ———-


  24


  SYS AS SYSDBA on 2005-04-05 16:54:07 >


  SYS AS SYSDBA on 2005-04-05 16:54:47 >


  至此,数据恢复彻底完成。

我们一直都在努力坚持原创.......请不要一声不吭,就悄悄拿走。

我原创,你原创,我们的内容世界才会更加精彩!

【所有原创内容版权均属TechTarget,欢迎大家转发分享。但未经授权,严禁任何媒体(平面媒体、网络媒体、自媒体等)以及微信公众号复制、转载、摘编或以其他方式进行使用。】

微信公众号

TechTarget微信公众号二维码

TechTarget

官方微博

TechTarget中国官方微博二维码

TechTarget中国

电子邮件地址不会被公开。 必填项已用*标注

敬请读者发表评论,本站保留删除与本文无关和不雅评论的权力。

作者

Alizze
Alizze

相关推荐

  • MySQL到OpenStack Swift的备份与恢复

    在OpenStack中MySQL数据库的使用很普遍。OpenStack核心服务计算(Nova),存储(Cinder),Neutron(网络),镜像(Glance)和认证(Keystone)都使用MySQL数据库。

  • Oracle 10g/11g Latch机制的变化

    Oracle的Latch机制采用spin来进行持有CPU的不断尝试,虽然通常Latch的获取会非常快(一般在微秒级),但是很多时候Latch竞争还是会引发极为严重的CPU争用。

  • Oracle10g DBCONSOLE 服务无法启动的解决方法

    EM工具是Oracle10g推出的web方式的数据库控制台管理工具,此工具采用三层的技术架构,工具比较直观,使用方便。而DBCONSOLE服务是EM工具的服务程序。

  • 详解Oracle 10g中关于序列的使用

    在Oracle中如果要设定一个独立表结构的主键为自增,其中就涉及到了 Oracle 10G中关于序列(Sequence)的使用。