unzip FY_Recover_Data.zip
SQL> @/home/oracle/FY_Recover_Data.pkg
select count(1) from scott.emp; –114688
truncate table emp;
select file_name
from dba_data_files f, dba_tables t
where t.owner = ‘SCOTT’
and t.table_name = ‘EMP’
and t.tablespace_name = f.tablespace_name;
—/u01/app/oracle/oradata/orcl/users01.dbf
select count(1) from scott.emp; –0
—-恢复
SQL> exec Fy_Recover_data.recover_truncated_table('SCOTT','EMP',1,null,null);22:17:37: Use existing Directory Name: FY_DATA_DIR22:17:37: Recover Table: SCOTT.EMP$22:17:37: Restore Table: SCOTT.EMP$$22:17:45: Copy file of Recover Tablespace: FY_REC_DATA_COPY.DAT122:17:45: begin to recover table SCOTT.EMP22:17:45: Use existing Directory Name: TMP_HF_DIR22:17:45: Recovering data in datafile /u01/app/oracle/oradata/orcl/users01.dbf22:17:45: Use existing Directory Name: TMP_HF_DIR22:18:07: 700 truncated data blocks found. 22:18:07: 114688 records recovered in backup table SCOTT.EMP$$22:18:07: Total: 700 truncated data blocks found. 22:18:07: Total: 114688 records recovered in backup table SCOTT.EMP$$22:18:07: Recovery completed.22:18:07: Data has been recovered to SCOTT.EMP$$
PL/SQL procedure successfully completed
下载工具 :http://www.hellodba.com/Download/FY_Recover_Data.zip