标签:varchar2 alt where off 导入 字典 objects 修改 生成
生成测试表
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_03 as select * from tab_01;
truncate table tab_03;
恢复的步骤为:
OFFLINE表所在的表空间
生成数据字典:unload dict
扫描数据:scan extent
恢复表:unload table username.tablename object auto
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> scan extent tablespace 4
ODU> unload table liang.tab_03 object auto
Auto mode truncated table.
Unloading table: TAB_03,object ID: 87361
Unloading segment,storage(Obj#=87361 DataObj#=87361 TS#=4 File#=4 Block#=218 Cluster=0)
10000 rows unloaded
将测试表所在的users表空间online:
SQL> alter tablespace users online;
使用imp导入数据
imp liang/chengce243 file=data/LIANG_TAB_03.dmp
生成测试表
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_03 as select * from tab_01;
truncate table tab_03;
恢复的步骤为:
OFFLINE表所在的表空间
生成数据字典:unload dict
扫描数据:scan extent
恢复表:unload table username.tablename object auto
set linesize 160
col name for a40
select ts#,file#,rfile#,name from v$datafile;
把查询结果贴到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> scan extent tablespace 4
ODU> unload table liang.tab_03 object auto
Auto mode truncated table.
Unloading table: TAB_03,object ID: 87361
Unloading segment,storage(Obj#=87361 DataObj#=87361 TS#=4 File#=4 Block#=218 Cluster=0)
10000 rows unloaded
将测试表所在的users表空间online:
SQL> alter tablespace users online;
使用imp导入数据
imp liang/chengce243 file=data/LIANG_TAB_03.dmp fromuser=liang touser=liang
参考文档:http://www.laoxiong.net/category/odu
odu恢复truncate 表
标签:varchar2 alt where off 导入 字典 objects 修改 生成
原文地址:https://www.cnblogs.com/liang545621/p/12611580.html