Oracle 9i 使用flashback 恢复数据的案例:
用户反应执行地执行了错误update表matchbill.check_cmp_acct_total3操作,希望DBA帮助恢复到update之前的状态,经过以下操作成功恢复了数据。
1.grant execute on sys.dbms_flashback to
2.login as user
3.SQL>create table flash_back1 as select * from matchbill.check_cmp_acct_total3 where 1=2;
3.SQL>exec dbms_flashback.enable_at_time(to_date('20060308 15:00:00','yyyymmdd hh24:mi:ss'));
4.SQL>
declare
CURSOR c_temp IS
SELECT * FROM matchbill.check_cmp_acct_total3;
v_row c_temp%ROWTYPE;
BEGIN
OPEN c_temp;
DBMS_FLASHBACK.DISABLE;
LOOP
FETCH c_temp
INTO v_row;
EXIT WHEN c_temp%NOTFOUND;
INSERT INTO matchbill.flash_back1
VALUES
(v_row.ACCT_ID,
v_row.DESCRIPTION);
END LOOP;
CLOSE c_temp;
COMMIT;
END;
/
PL/SQL procedure successfully completed.
SQL> select count(1) from matchbill.flash_back1;
COUNT(1)
----------
278794
注意:利用flashback只能恢复在一定时间段内的数据,越早发现越容易恢复
阅读(618) | 评论(0) | 转发(0) |