flashbackup闪回数据库

某时间删除了一个表
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.         

 

posted on 2015-09-23 19:59  侯志清  阅读(188)  评论(0编辑  收藏  举报

导航