Oracle误删除表数据后的恢复详解
测试环境:
SYSTEM:IBM AIX 5L Oracle Version:10gR2
1. undo_retention参数的查询与修改
使用show parameter undo命令查看当前的数据库参数undo_retention设置。
显示如下:
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS2
undo_retention(保持力),900单位是秒,即15分钟。
修改默认的undo_retention参数设置:SQL> ALTER SYSTEM SET undo_retention=10800 SCOPE=BOTH;
System altered.
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 10800
undo_tablespace string UNDOTBS2
undo_retention 10800,单位秒,即3小时。
2. oracle误删除表数据后的的快速恢复功能方法
2.1 方法一
通过oracle提供的回闪功能
exec dbms_flashback.enable_at_time(to_date('2011-04-15 08:21:00','yyyy-mm-dd hh24:mi:ss'));
set serveroutput on
DECLARE r_temp hr.job_history%ROWTYPE;
CURSOR c_temp IS SELECT * FROM hr.job_history;
BEGIN
OPEN c_temp;
dbms_flashback.disable;
LOOP
FETCH c_temp INTO r_temp;
EXIT WHEN c_temp%NOTFOUND;
insert into hr.job_history(EMPLOYEE_ID,JOB_ID,START_DATE,END_DATE) values (r_temp.EMPLOYEE_ID,r_temp.JOB_ID,r_temp.START_DATE,r_temp.END_DATE);
commit;
END LOOP;
CLOSE c_temp;
END;
这就是微学网-程序员之家为你提供的"Oracle误删除表数据后的数据恢复详解"希望对你有所帮助.本文来自网络,转载请注明出处:http://www.weixuecn.cn/article/6212.html