码迷,mamicode.com
首页 > 数据库 > 详细

闪回数据库

时间:2015-12-31 13:05:28      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:闪回db

查询当前的SCN:

SQL> select current_scn from v$database;


CURRENT_SCN

-----------

    1170420


清空表(truncate表后是不能进行闪回表的)

SQL> truncate table tom.t;


Table truncated.


SQL> select * from tom.t;


no rows selected


关闭实例启动到mount状态:

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;      

ORACLE instance started.


Total System Global Area  417546240 bytes

Fixed Size                  2228944 bytes

Variable Size             318770480 bytes

Database Buffers           88080384 bytes

Redo Buffers                8466432 bytes

Database mounted.


闪回数据库到SNC 1170420:

SQL> flashback database to scn 1170420;


Flashback complete.


只读方式打开数据库,查询数据是否恢复:

SQL> alter database open read only;


Database altered.


SQL> select * from tom.t;


        ID NAME

---------- --------------------

         3 mark3

         1 mark1

         2 mark2


关闭数据库,以resetlogs方式打开数据库:

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.


Total System Global Area  417546240 bytes

Fixed Size                  2228944 bytes

Variable Size             318770480 bytes

Database Buffers           88080384 bytes

Redo Buffers                8466432 bytes

Database mounted.

SQL> alter database open resetlogs;


Database altered.


SQL> select current_scn from v$database;


CURRENT_SCN

-----------

    1170730


SQL> 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

SQL> 


闪回数据库

标签:闪回db

原文地址:http://4538453.blog.51cto.com/4528453/1730249

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!