知识大全 Oracle10g跨越Resetlogs时间点进行恢复

Posted 时间

篇首语:一个伟大的灵魂,会强化思想和生命。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 Oracle10g跨越Resetlogs时间点进行恢复相关的知识,希望对你有一定的参考价值。

Oracle10g跨越Resetlogs时间点进行恢复  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

  原因 日志序号会被置位 以此防止后续日志被应用 resetlogs之前的备份将不能用于进行跨域resetlogs时间点的恢复

  在Oracle数据库 g中 Oracle允许跨越resetlogs时间点进行完全/不完全恢复

  本文将针对此特性介绍一个详细的参考示例:

  一 全备份数据库

  $ rman target /

  Recovery Manager: Release bit Production

  Copyright (c) Oracle All rights reserved

  connected to target database: EYGLE (DBID= )

  RMAN> backup database plus archivelog delete all input;

  Starting backup at : :

  current log archived

  using target database controlfile instead of recovery catalog

  allocated channel: ORA_DISK_

  channel ORA_DISK_ : sid= devtype=DISK

  channel ORA_DISK_ : starting archive log backupset

  channel ORA_DISK_ : specifying archive log(s) in backup set

  input archive log thread= sequence= recid= stamp=

  input archive log thread= sequence= recid= stamp=

  input archive log thread= sequence= recid= stamp=

  channel ORA_DISK_ : starting piece at : :

  channel ORA_DISK_ : finished piece at : :

  piece handle=/data /flash_recovery_area/EYGLE/backupset/ _ _

  /o _mf_annnn_TAG T _ m woc_ bkp ment=NONE

  channel ORA_DISK_ : backup set plete elapsed time: : :

  channel ORA_DISK_ : deleting archive log(s)

  archive log filename=/data /flash_recovery_area/EYGLE

  /archivelog/ _ _

  /o _mf_ _ _ qm_ arc recid= stamp=

  archive log filename=/data

  /flash_recovery_area/EYGLE/archivelog/ _ _

  /o _mf_ _ _ g _ arc recid= stamp=

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

  / _ _ /o _mf_ _ _ m og _ arc recid= stamp=

  Finished backup at : :

  Starting backup at : :

  using channel ORA_DISK_

  channel ORA_DISK_ : starting full datafile backupset

  channel ORA_DISK_ : specifying datafile(s) in backupset

  input datafile fno= name=/data /oradata/systemfile/bigtbs dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/system dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/EYGLE/datafile/o _mf_test_ xv ny_ dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/undotbs dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/sysaux dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/dfmbrc dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/trans dbf

  channel ORA_DISK_ : starting piece at : :

  channel ORA_DISK_ : finished piece at : :

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m kf_ bkp ment=NONE

  channel ORA_DISK_ : backup set plete elapsed time: : :

  channel ORA_DISK_ : starting full datafile backupset

  channel ORA_DISK_ : specifying datafile(s) in backupset

  input datafile fno= name=/data /oradata/systemfile/eygle dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/users dbf

  input datafile fno= name=/opt/oracle/oradata/eygle/EYGLE/datafile/o _mf_itpub_ xv g _ dbf

  channel ORA_DISK_ : starting piece at : :

  channel ORA_DISK_ : finished piece at : :

  piece handle=/data /flash_recovery_area/EYGLE/backupset/ _ _

  /o _mf_nnndf_TAG T _ m dxm_ bkp ment=NONE

  channel ORA_DISK_ : backup set plete elapsed time: : :

  channel ORA_DISK_ : starting full datafile backupset

  channel ORA_DISK_ : specifying datafile(s) in backupset

  input datafile fno= name=/opt/oracle/oradata/eygle/t k dbf

  channel ORA_DISK_ : starting piece at : :

  channel ORA_DISK_ : finished piece at : :

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m kz_ bkp ment=NONE

  channel ORA_DISK_ : backup set plete elapsed time: : :

  Finished backup at : :

  Starting backup at : :

  current log archived

  using channel ORA_DISK_

  channel ORA_DISK_ : starting archive log backupset

  channel ORA_DISK_ : specifying archive log(s) in backup set

  input archive log thread= sequence= recid= stamp=

  channel ORA_DISK_ : starting piece at : :

  channel ORA_DISK_ : finished piece at : :

  piece handle=/data /flash_recovery_area/EYGLE/backupset/ _ _

  /o _mf_annnn_TAG T _ m jpo_ bkp ment=NONE

  channel ORA_DISK_ : backup set plete elapsed time: : :

  channel ORA_DISK_ : deleting archive log(s)

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

  / _ _ /o _mf_ _ _ m gb _ arc recid= stamp=

  Finished backup at : :

  Starting Control File and SPFILE Autobackup at : :

  piece handle=/data /flash_recovery_area/EYGLE/autobackup

  / _ _ /o _mf_s_ _ m qps_ bkp ment=NONE

  Finished Control File and SPFILE Autobackup at : :

  RMAN> exit

  Recovery Manager plete

  二 进行数据的更改

  $ sqlplus / as sysdba

  SQL*Plus: Release Production on

  Tue Apr : :

  Copyright (c) Oracle All rights reserved

  Connected to:

  Oracle Database g Enterprise Edition Release

   bit Production

  With the Partitioning OLAP and Data Mining options

  SYS AS SYSDBA on : : >alter system switch logfile;

  System altered

  SYS AS SYSDBA on : : >select count(*) from t;

  COUNT(*)

  

  

  SYS AS SYSDBA on : : >insert into t select * from t;

   rows created

  SYS AS SYSDBA on : : >mit;

  Commit plete

  SYS AS SYSDBA on : : >alter system switch logfile;

  System altered

  SYS AS SYSDBA on : : >truncate table t;

  Table truncated

  SYS AS SYSDBA on : : >alter system switch logfile;

  System altered

  日志序列的情况如下:

  SYS AS SYSDBA on : : >

  select * from v$log_history where recid > ;

  RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# RESETLOGS_CHANGE# RESETLOGS_TIME

  

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   rows selected

  关闭数据库:

  SYS AS SYSDBA on : : >shutdown immediate;

  Database closed

  Database dismounted

  ORACLE instance shut down

  SYS AS SYSDBA on : : >exit

  Disconnected from Oracle Database g Enterprise

  Edition Release bit Production

  With the Partitioning OLAP and Data Mining options

  三 执行不完全恢复

  $ rman target /

  Recovery Manager: Release bit Production

  Copyright (c) Oracle All rights reserved

  connected to target database (not started)

  RMAN> startup mount; 

  Oracle instance started

  database mounted

  Total System Global Area bytes

  Fixed Size bytes

  Variable Size bytes

  Database Buffers bytes

  Redo Buffers bytes

  RMAN> run

   > set until sequence thread ;

   > restore database;

   > recover database;

   >   

  executing mand: SET until clause

  using target database controlfile instead of recovery catalog

  Starting restore at : :

  allocated channel: ORA_DISK_

  channel ORA_DISK_ : sid= devtype=DISK

  datafile not processed because file is read only

  channel ORA_DISK_ : starting datafile backupset restore

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

  restoring datafile to /opt/oracle/oradata/eygle/system dbf

  restoring datafile to /opt/oracle/oradata/eygle/undotbs dbf

  restoring datafile to /opt/oracle/oradata/eygle/sysaux dbf

  restoring datafile to /opt/oracle/oradata/eygle/EYGLE/datafile/o _mf_test_ xv ny_ dbf

  restoring datafile to /data /oradata/systemfile/bigtbs dbf

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

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m kf_ bkp tag=TAG T

  channel ORA_DISK_ : restore plete

  channel ORA_DISK_ : starting datafile backupset restore

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

  restoring datafile to /opt/oracle/oradata/eygle/users dbf

  restoring datafile to /data /oradata/systemfile/eygle dbf

  restoring datafile to /opt/oracle/oradata/eygle/EYGLE/datafile/o _mf_itpub_ xv g _ dbf

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m dxm_ bkp

  tag=TAG T

  channel ORA_DISK_ : restore plete

  channel ORA_DISK_ : starting datafile backupset restore

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

  restoring datafile to /opt/oracle/oradata/eygle/t k dbf

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m kz_ bkp

  tag=TAG T

  channel ORA_DISK_ : restore plete

  Finished restore at : :

  Starting recover at : :

  using channel ORA_DISK_

  datafile not processed because file is offline

  starting media recovery

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

  / _ _ /o _mf_ _ _ m z k_ arc

  channel ORA_DISK_ : starting archive log

  restore to default destination

  channel ORA_DISK_ : restoring archive log

  archive log thread= sequence=

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_annnn_TAG T _ m jpo_ bkp

  tag=TAG T

  channel ORA_DISK_ : restore plete

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

  / _ _ /o _mf_ _ _ mtkfk_ arc thread= sequence=

  channel default: deleting archive log(s)

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

  / _ _ /o _mf_ _ _ mtkfk_ arc recid= stamp=

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

  / _ _ /o _mf_ _ _ m z k_ arc thread= sequence=

  media recovery plete

  Finished recover at : :

  RMAN> alter database open resetlogs;

  database opened

  RMAN> exit

  Recovery Manager plete

  四 此时的数据库状态

  $ sqlplus / as sysdba

  SQL*Plus: Release Production on Tue Apr : :

  Copyright (c) Oracle All rights reserved

  Connected to:

  Oracle Database g Enterprise Edition

  Release bit Production

  With the Partitioning OLAP and Data Mining options

  SYS AS SYSDBA on : : >archive log list;

  Database log mode Archive Mode

  Automatic archival Enabled

  Archive destination USE_DB_RECOVERY_FILE_DEST

  Oldest online log sequence

  Next log sequence to archive

  Current log sequence

  SYS AS SYSDBA on : : >select count(*) from t;

  COUNT(*)

  

  

  五 继续进行数据更改

  SYS AS SYSDBA on : : >

  create table tt as select * from dba_users;

  Table created

  SYS AS SYSDBA on : : >alter system switch logfile;

  System altered

  SYS AS SYSDBA on : : >select count(*) from tt;

  COUNT(*)

  

  

  SYS AS SYSDBA on : : >insert into tt select * from tt;

   rows created

  SYS AS SYSDBA on : : >mit;

  Commit plete

  SYS AS SYSDBA on : : >alter system switch logfile;

  System altered

  此时的日志序列:

  SYS AS SYSDBA on : : >

  select * from v$log_history where recid > ;

  RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIME

  NEXT_CHANGE# RESETLOGS_CHANGE# RESETLOGS_TIME

  

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   : : : :

   rows selected

  SYS AS SYSDBA on : : >shutdown immediate;

  Database closed

  Database dismounted

  ORACLE instance shut down

  SYS AS SYSDBA on : : >exit

  Disconnected from Oracle Database g Enterprise

  Edition Release bit Production

  With the Partitioning OLAP and Data Mining options

  六 再次执行恢复

  $ rman target /

  Recovery Manager: Release bit Production

  Copyright (c) Oracle All rights reserved

  connected to target database (not started)

  RMAN> startup mount;

  Oracle instance started

  database mounted

  Total System Global Area bytes

  Fixed Size bytes

  Variable Size bytes

  Database Buffers bytes

  Redo Buffers bytes

  RMAN> run

   > restore database;

   > recover database;

   >

  Starting restore at : :

  using target database controlfile instead of recovery catalog

  allocated channel: ORA_DISK_

  channel ORA_DISK_ : sid= devtype=DISK

  datafile not processed because file is read only

  channel ORA_DISK_ : starting datafile backupset restore

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

  restoring datafile to /opt/oracle/oradata/eygle/system dbf

  restoring datafile to /opt/oracle/oradata/eygle/undotbs dbf

  restoring datafile to /opt/oracle/oradata/eygle/sysaux dbf

  restoring datafile to /opt/oracle/oradata/eygle/EYGLE/datafile/o _mf_test_ xv ny_ dbf

  restoring datafile to /data /oradata/systemfile/bigtbs dbf

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

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m kf_ bkp

  tag=TAG T

  channel ORA_DISK_ : restore plete

  channel ORA_DISK_ : starting datafile backupset restore

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

  restoring datafile to /opt/oracle/oradata/eygle/users dbf

  restoring datafile to /data /oradata/systemfile/eygle dbf

  restoring datafile to /opt/oracle/oradata/eygle/EYGLE/datafile/o _mf_itpub_ xv g _ dbf

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m dxm_ bkp tag=TAG T

  channel ORA_DISK_ : restore plete

  channel ORA_DISK_ : starting datafile backupset restore

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

  restoring datafile to /opt/oracle/oradata/eygle/t k dbf

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_nnndf_TAG T _ m kz_ bkp

  tag=TAG T

  channel ORA_DISK_ : restore plete

  Finished restore at : :

  Starting recover at : :

  using channel ORA_DISK_

  datafile not processed because file is offline

  starting media recovery

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

  / _ _ /o _mf_ _ _ m z k_ arc

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

  / _ _ /o _mf_ _ _ n v _ arc

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

  / _ _ /o _mf_ _ _ n y _ arc

  channel ORA_DISK_ : starting archive log

  restore to default destination

  channel ORA_DISK_ : restoring archive log

  archive log thread= sequence=

  channel ORA_DISK_ : restored backup piece

  piece handle=/data /flash_recovery_area/EYGLE/backupset

  / _ _ /o _mf_annnn_TAG T _ m jpo_ bkp

  tag=TAG T

  channel ORA_DISK_ : restore plete

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

  / _ _ /o _mf_ _ _ ngror_ arc thread= sequence=

  channel default: deleting archive log(s)

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

  / _ _ /o _mf_ _ _ ngror_ arc recid= stamp=

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

  / _ _ /o _mf_ _ _ m z k_ arc thread= sequence=

  media recovery plete

  Finished recover at : :

  RMAN> alter database open;

  database opened 

  RMAN> exit

  Recovery Manager plete

  七 最后检查数据恢复情况

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

  $ sqlplus / as sysdba

  SQL*Plus: Release Production on

  Tue Apr : :

  Copyright (c) Oracle All rights reserved   

  Connected to:

  Oracle Database g Enterprise Edition Release

   bit Production

  With the Partitioning OLAP and Data Mining options

  SYS AS SYSDBA on : : >select count(*) from t;  

  COUNT(*)

  

  

  SYS AS SYSDBA on : : >select count(*) from tt;

  COUNT(*)

  

  

  SYS AS SYSDBA on : : >

  SYS AS SYSDBA on : : >

相关参考

知识大全 Oracle10g恢复试验方法

Oracle认证:Oracle10g恢复试验方法  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!看了

知识大全 Oracle10G常用维护语句

Oracle10G常用维护语句  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  创建表空间    

知识大全 Oracle10g中current

Oracle10g中current  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  以下的文章主要

知识大全 Oracle10G启用闪回功能

Oracle10G启用闪回功能  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  [oracle@l

知识大全 Oracle10g废弃log

Oracle10g废弃log  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  在Oracleg中l

知识大全 Oracle10g的current

Oracle10g的current  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  前几天有一个朋

知识大全 Oracle10g中新的SQLoptimizerhints

Oracle10g中新的SQLoptimizerhints  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一

知识大全 Oracle10g新特性—选择性编译

Oracle10g新特性—选择性编译  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  Oracle

知识大全 Oracle10g临时表空间组

Oracle10g临时表空间组  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  Oracleg引进

知识大全 在Oracle10g里启动自动归档模式

在Oracle10g里启动自动归档模式  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!在Oracle