生成测试表
conn liang/chengce243
create table tab_01(id int,name VARCHAR2(128));
insert into tab_01
select OBJECT_ID,OBJECT_NAME
from dba_objects where rownum<=10000;
commit;
create table tab_04 as select * from tab_01;
delete tab_04 where id<500;
commit;
恢复的步骤为:
OFFLINE表所在的表空间
将参数unload_deleted设置为YES
生成数据字典:unload dict
恢复表: unload table username.tablename
ONLINE表所在的表空间
set linesize 180
col FILE_NAME for a50
col VALUE for a8
select ts#,file_id fno#,file_id rfno#,file_name,value
from V$tablespace t,dba_data_files d,v$parameter p
where t.name=d.tablespace_name
and p.name='db_block_size';
把查询结果贴到control.txt;
修改配置文件config.txt output_format 为 DMP
[oracle@hncdf odu]$ cat config.txt
byte_order little
block_size 8192
db_timezone -7
client_timezone 8
data_path data
charset_name ZHS16GBK
ncharset_name AL16UTF16
output_format DMP
lob_storage infile
clob_byte_order little
OFFLINE表所在的表空间
SQL> alter tablespace users offline;
做一个Checkpoint,让ODU能够读到最新的数据字典数据。
SQL> alter system checkpoint;
ODU> unload dict
ODU> unload table liang.tab_04
Unloading table: TAB_04,object ID: 87364
Unloading segment,storage(Obj#=87364 DataObj#=87364 TS#=4 File#=4 Block#=274 Cluster=0)
10000 rows unloaded
将测试表所在的users表空间online:
SQL> alter tablespace users online;
使用imp导入数据
imp liang/chengce243 file=data/LIANG_TAB_04.dmp
参考文档:http://www.laoxiong.net/category/odu