如题所述
FlashbackDatabase功能与RMAN的不完全恢复有点类似, 可以把整个数据库回退到过去的某个时点的状态,这个功能依赖于Flashbacklog日志。 优点是比RMAN更快速和高效。因此FlashbackDatabase可以看作是不完全恢复的替代技术。
启动数据库到mount状态。
开启数据库flashback闪回查询,然后启动数据库到open状态。
创建flashback还原点 SQLcreate restore point b4 guarantee flashback database;
解锁scott用户,删掉该用户的emp表; drop table emp purge;
关闭数据库,启动数据库到mount状态
在mount阶段闪回数据库到删除emp表之前的状态 SQLflashback database to timestamp to_timestamp('2014-12-08 11:31:00','yyyy-mm-dd hh24:mi:ss');
启动数据库到readonly状态,查看emp表是否存在,此时发现emp已经回来了。 SQLalter database open read only;
到shell终端下导出找回的表格。 $exp scott/tiger tables=emp file=emp.dmp
再次关闭数据库,然后启动到mount状态。
再次闪回数据库到删除emp表之后,关闭数据库之前。 SQLflashback database to timestamp to_timestamp('2014-12-08 12:00:00'),'yyyy-mm-dd hh24:mi:ss'); 闪回之后使用resetlogs方式打开数据库。
查看scott下的emp表,不存在。
回到shell终端,导入emp表 $imp scott/tiger file=emp tables=emp
再次检查emp表。
启动数据库到mount状态。
开启数据库flashback闪回查询,然后启动数据库到open状态。
创建flashback还原点 SQLcreate restore point b4 guarantee flashback database;
解锁scott用户,删掉该用户的emp表; drop table emp purge;
关闭数据库,启动数据库到mount状态
在mount阶段闪回数据库到删除emp表之前的状态 SQLflashback database to timestamp to_timestamp('2014-12-08 11:31:00','yyyy-mm-dd hh24:mi:ss');
启动数据库到readonly状态,查看emp表是否存在,此时发现emp已经回来了。 SQLalter database open read only;
到shell终端下导出找回的表格。 $exp scott/tiger tables=emp file=emp.dmp
再次关闭数据库,然后启动到mount状态。
再次闪回数据库到删除emp表之后,关闭数据库之前。 SQLflashback database to timestamp to_timestamp('2014-12-08 12:00:00'),'yyyy-mm-dd hh24:mi:ss'); 闪回之后使用resetlogs方式打开数据库。
查看scott下的emp表,不存在。
回到shell终端,导入emp表 $imp scott/tiger file=emp tables=emp
再次检查emp表。
温馨提示:答案为网友推荐,仅供参考