1. @/home/oracle/FY_Recover_Data.SQL
創(chuàng)建需要的package
[oracle@localhost oradata]$ sqlplus / as sysdba
我們提供的服務(wù)有:成都網(wǎng)站設(shè)計、成都做網(wǎng)站、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、湯旺ssl等。為1000+企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的湯旺網(wǎng)站制作公司
SQL*Plus: Release 11.2.0.4.0 Production on Thu May 17 00:43:59 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @/home/oracle/FY_Recover_Data.SQL
Package created.
Package body created.
2. 創(chuàng)建測試數(shù)據(jù):
create table scott.test_emp tablespace users as select * from scott.emp;
truncate table scott.test_emp
3. 執(zhí)行腳本:
注意路徑:“/u01/app/oracle/oradata/orcl/”最后的”/”不能缺少
DECLARE
tgtowner VARCHAR2(30);
tgttable VARCHAR2(30);
datapath VARCHAR2(4000);
datadir VARCHAR2(30);
rects VARCHAR2(30);
recfile VARCHAR2(30);
rstts VARCHAR2(30);
rstfile VARCHAR2(30);
blksz NUMBER;
rectab VARCHAR2(30);
rsttab VARCHAR2(30);
copyfile VARCHAR2(30);
BEGIN
tgtowner := 'SCOTT'; --table owner
tgttable := 'TEST_EMP'; --table name
datapath := '/u01/app/oracle/oradata/orcl/'; --必須和test.t1表所在的數(shù)據(jù)文件的目錄相同
datadir := 'FY_DATA_DIR'; --oracle中目錄的名字,可以修改
fy_recover_data.prepare_files(tgtowner,
tgttable,
datapath,
datadir,
rects,
recfile,
rstts,
rstfile,
blksz);
fy_recover_data.fill_blocks(tgtowner,
tgttable,
datadir,
rects,
recfile,
rstts,
8,
tgtowner,
tgtowner,
rectab,
rsttab,
copyfile);
fy_recover_data.recover_table(tgtowner,
tgttable,
tgtowner,
rectab,
tgtowner,
rsttab,
datadir,
datadir,
recfile,
datadir,
copyfile,
blksz);
END;
執(zhí)行完成之后,會看到scott用戶下多了表:
SQL> select table_name, tablespace_name from dba_tables where owner = 'SCOTT';
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
DEPT USERS
EMP USERS
BONUS USERS
SALGRADE USERS
TEST_EMP$ FY_REC_DATA
TEST_EMP$$ FY_RST_DATA
TEST_EMP USERS
7 rows selected.
分享名稱:使用fy_recover_data恢復(fù)truncate表的數(shù)據(jù)
文章分享:http://chinadenli.net/article30/pipjso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、用戶體驗、品牌網(wǎng)站制作、網(wǎng)站設(shè)計公司、網(wǎng)站維護、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)