flashback database

1.闪回数据库的目的

    通过flashback database to timestamp/scn/log sequence命令来把数据库回到以前的时间点,SCN或者日志序列号上。闪回数据库跟recovery相似,但也有不同。闪回只能修复logical failure(逻辑错误),不能修复media failure(介质错误)。

2.闪回数据库的前提

  可以使用RMAN;

  版本10g及以上;

  数据库的控制文件不能是重建或者是从备份转储回来的;

  数据库必须要开archivelog;

  fast recovery area必须配置(闪回日志flashback log必须在此基础上才能创建)

  闪回打开的时间要早于目标时间 ,打开语句alter database flashback on(必须要正常关库,mount下打开

 数据库中不能有online tablespace的flashback off。闪回会失败。这时候要闪回需要把该表空间下数据文件offline,闪回后用restore、recovery恢复该文件。

3.数据文件状态对闪回操作的影响。How FLASHBACK DATABASE Responds to Data File Status Changes

If this data file operation occurred during the flashback window ... Then the FLASHBACK DATABASE command ...

Added

Removes the data file record from the control file.对于添加的数据文件仅从控制文件中把记录删除,不删除实体文件。

Dropped

Adds the data file to the control file, but marks it as offline and does not flash it back. You can then restore and recover the data file to the same time or SCN.

添加数据文件记录到控制文件,然后需要手动的restore、recovery该datafile

Renamed

Ignores the renaming. The data file retains its current name.

忽略掉改名,保留闪回前的名字

Resized

May fail. You can take the data file offline and then rerun the FLASHBACK DATABASE command. The data file is not flashed back. You can then restore and recover the data file to the same time or SCN.


可能失败,可以offline 该datafile,然后flashback。最后restore、recovery该文件。

Taken offline

Ignores the operation. The data file retains its current online status.

忽略闪回操作,保留闪回前的状态。

Brought online

Ignores the operation. The data file retains its current offline status.

忽略闪回操作,保留闪回前的状态。

Made read-only or read/write

Changes the status of the data file in the control file.

4.闪回后可以用read only的方式打开,查询看闪回到的状态是否满足需求。满足后可以用逻辑备份出数据,然后在mount下执行recover database,alter database open打开数据库到闪回前状态,再把数据导入进去。


参考http://blog.sina.com.cn/s/blog_a32eff280100zh24.html

你可能感兴趣的:(database,flashback)