【闪回】基于SCN闪回数据库

在已启动闪回数据库功能的基础上进行的测试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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值