首页 > 数据库技术 > 详细

flashbackup闪回数据库

时间:2015-09-23 21:02:50      阅读:585      评论:0      收藏:0      [点我收藏+]
某时间删除了一个表
SQL> delete test1;

50000 rows deleted.

1、关闭数据库,启动到mount状态(abort数据库能快速关闭,但是可能会丢数据)
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount;

2、基于时间戳闪回数据库(20:55)
SQL> flashback database to timestamp to_timestamp(2015-09-22 20:55:00,yyyy-mm-dd hh24:mi:ss);

Flashback complete.
3、以只读模式打开数据库
SQL> alter database open read only;

Database altered.

4、查看表是否闪回
SQL>select count(*) from test1;

  COUNT(*)
----------
     50000
5、上述说明20:55分数据库是没有删除的,而数据库其他的表也有读写数据,所以尽可能的闪回到表被删除的那个时间的临界点

6、关闭数据库
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount;

7、基于时间戳闪回数据库(20:59)
SQL> flashback database to timestamp to_timestamp(2015-09-22 20:59:00,yyyy-mm-dd hh24:mi:ss);

Flashback complete.

8、以只读模式打开数据库
SQL> alter database open read only;

Database altered.

9、查看表是否存在
SQL> select count(*) from test1;

  COUNT(*)
----------
         0
10、重复执行基于时间闪回数据库(20:57)
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount;
SQL> flashback database to timestamp to_timestamp(2015-09-22 20:57:00,yyyy-mm-dd hh24:mi:ss);

Flashback complete.
SQL> alter database open read only;

11、查看表是否存在
SQL> select count(*) from test1;

  COUNT(*)
----------
     50000

12、以RESETLOGS模式打开数据库,让数据库日志重置
SQL> alter database open resetlogs;

Database altered.         

 

flashbackup闪回数据库

原文:http://www.cnblogs.com/houzhiqing/p/4833378.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!