在已启动闪回数据库功能的基础上进行的测试:
http://space.itpub.net/685769/viewspace-749364
一、在scott用户下创建一张表
SYS@ORA11GR2>conn scott/tiger
Connected.
SCOTT@ORA11GR2>create table fbdb_scn as select to_date('20121014','yyyymmdd') as dd from dual;
Table created.
SCOTT@ORA11GR2>select * from fbdb_scn;
DD
-------------------
2012-10-14 00:00:00
SCOTT@ORA11GR2>
二、记录当前SCN,并删除scott用户
SCOTT@ORA11GR2>conn / as sysdba
Connected.
SYS@ORA11GR2>select current_scn from v$database;
CURRENT_SCN
-----------
1152481
SYS@ORA11GR2>
SYS@ORA11GR2>drop user scott cascade;
User dropped.
SYS@ORA11GR2>
三、将数据库启动到mount状态下
SYS@ORA11GR2>startup mount force;
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
SYS@ORA11GR2>
四、基于SCN执行闪回数据库命令
SYS@ORA11GR2>flashback database to scn 1152481;
Flashback complete.
SYS@ORA11GR2>
五、闪回完成,因为我们是明确指定SCN的,所以,我们可以直接OPEN数据库,此时会有个提示,要求必须以RESETLOGS or NORESETLOGS 方式打开数据库
SYS@ORA11GR2>alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SYS@ORA11GR2>
六、以resetlogs方式OPEN数据库
SYS@ORA11GR2>alter database open resetlogs;
Database altered.
SYS@ORA11GR2>
七、验证闪回数据库
SYS@ORA11GR2>conn scott/tiger
Connected.
SCOTT@ORA11GR2>select * from fbdb_scn;
DD
-------------------
2012-10-14 00:00:00
SCOTT@ORA11GR2>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/685769/viewspace-749412/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/685769/viewspace-749412/