闪回数据库(Flashback Database)
作者:网络转载 发布时间:[ 2013/10/14 13:53:12 ] 推荐标签:
示例1:删除表的部分数据后,使用闪回数据库的方法恢复
|
SQL> create table test_flashback as select * from emp; --创建表
Table created.
SQL> select dbms_flashback.get_system_change_number from dual; --记录删除数据前scn
GET_SYSTEM_CHANGE_NUMBER
------------------------
1069396
SQL> delete from test_flashback where deptno=20; --删除数据
5 rows deleted.
SQL> commit;
Commit complete.
SQL> startup mount exclusive --启动到mount exclusive状态
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2217992 bytes
Variable Size 557844472 bytes
Database Buffers 276824064 bytes
Redo Buffers 2396160 bytes
Database mounted.
SQL> flashback database to scn 1069396; --闪回到删除数据之前,还可以用时间戳闪回如:
Flashback complete. --flashback database to to_timestamp('2013-10-8 18:02:34','YYYY-MM-DD HH24:MI:SS')
SQL> alter database open read only; ?--以read only 方式打开检查数据库是否闪回成功,如不成功考虑其他形式的闪回
Database altered.
SQL> select * from scott.test_flashback where deptno=20;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
SQL> startup
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2217992 bytes
Variable Size 557844472 bytes
Database Buffers 276824064 bytes
Redo Buffers 2396160 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
|
--闪回数据库之后,后做一次全备
本文内容不用于商业目的,如涉及知识产权问题,请权利人联系SPASVO小编(021-61079698-8054),我们将立即处理,马上删除。

sales@spasvo.com