设为首页 加入收藏

TOP

使用Flashback Database进行数据表级别的定点恢复(二)
2015-11-10 12:17:39 来源: 作者: 【 】 浏览:12
Tags:使用 Flashback Database 进行 数据 级别 定点 恢复
? ? 1? ? ? ? ? 1? ? ? ? ? 1? 65536000? ? ? 1350353 19-六月-15? NORMAL


/u01/app/fast_recovery_area/ORA11G/flashback/o1_mf_br7bfdjj_.flb? ? ? ? ? ? ? ? ? ? ? ? ? 2? ? ? ? ? 1? ? ? ? ? 1? 65536000? ? ? ? ? ? 0? ? ? ? ? ? RESERVED


3、故障发生模拟


下面模拟故障场景,用户test下面有若干段对象。


SQL> select owner, tablespace_name, count(*) from dba_segments where owner='TEST' group by owner, tablespace_name;?


OWNER? TABLESPACE_NAME? ? ? ? ? ? ? ? ? COUNT(*)


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


TEST? ? ? TESTTBL? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 5


误删除几张数据表。


SQL> drop table test.emp;


Table dropped


SQL> drop table test.dept;


Table dropped


此时数据库SCN和时间信息如下:


SQL> select current_scn, flashback_on from v$database;


CURRENT_SCN FLASHBACK_ON


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


? ? 1351835 YES


SQL> select sysdate a from dual;


A


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


19-六月-15 13:54:20


4、恢复操作


下面进行过去test.emp和test.dept数据的寻找。首先,关闭数据库,进行Flashback闪回数据库到未发生故障时间点。


SQL> shutdown immediate;


Database closed.


Database dismounted.


ORACLE instance shut down.


SQL> startup mount


ORACLE instance started.


Total System Global Area? 372449280 bytes


Fixed Size? ? ? ? ? ? ? ? ? 1364732 bytes


Variable Size? ? ? ? ? ? 289410308 bytes


Database Buffers? ? ? ? ? 75497472 bytes


Redo Buffers? ? ? ? ? ? ? ? 6176768 bytes


Database mounted.


直接在mount状态闪回到过去时间点,之后以read only(注意:这个很重要,关系能否回到原点状态)打开数据库。


SQL> flashback database to timestamp to_date('2015-6-19 13:35:00','yyyy-mm-dd hh24:mi:ss');


Flashback complete.


SQL> alter database open read only;


Database altered.


登录闪回版本数据库,查看被删除数据表是否存在。


SQL> conn sys/xxx@ora11g as sysdba


Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.4.0?


Connected as SYS


SQL> select owner, tablespace_name, count(*) from dba_segments where owner='TEST' group by owner, tablespace_name;


OWNER? TABLESPACE_NAME? ? ? ? ? ? ? ? ? COUNT(*)


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


TEST? ? TESTTBL? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 5


下面就清晰很多,可以以数据表(Schema也可以)为目标,导出数据。


[oracle@SimpleLinux ~]$ expdp \"/ as sysdba\" dumpfile=test_part.dmp tables=test.emp,test.dept


Export: Release 11.2.0.4.0 - Production on Fri Jun 19 14:07:38 2015


Copyright (c) 1982, 2011, Oracle and/or its affiliates.? All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production


With the Partitioning, Oracle Label Security, OLAP, Data Mining


and Real Application Testing options


ORA-31626: job does not exist


ORA-31633: unable to create master table "SYS.SYS_EXPORT_TABLE_05"


ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95


ORA-06512: at "SYS.KUPV$FT", line 1038


ORA-16000: database open for read-only access


数据泵(Datapump)显然是不行,因为expdp/impdp是工作在后台的数据工具,启动作业起码需要创建一张作业主表。这个对于只读状态数据库显然不行。


退而求其次,使用exp工具,小巧简单。


[oracle@SimpleLinux ~]$ exp \"/ as sysdba\" file=test_part.dmp tables=test.emp,test.dept


Export: Release 11.2.0.4.0 - Production on Fri Jun 19 14:22:33 2015


Copyright (c) 1982, 2011, Oracle and/or its affiliates.? All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production


With the Partitioning, Oracle Label Security, OLAP, Data Mining


and Real Application Testing options


Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set


About to export specified tables via Conventional Path ...


Current user changed to TEST


. . exporting table? ? ? ? ? ? ? ? ? ? ? ? ? ? EMP? ? ? ? 14 rows exported


. . exporting table? ? ? ? ? ? ? ? ? ? ? ? ? DEPT? ? ? ? ? 4 rows exported


Export terminated successfully without warning

首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Oracle RMAN实现“一键式”表空间.. 下一篇闪回版本查询Flashback Version Q..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: