Oracle 11G在用EXP 导出时,空表不能导出的解决

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:486

Oracle 11G在用EXP 导出时,空表不能导出的解决11G中有个新特性,当表无数据时,不分配segment,以节省空间解决方法:  1、insert一行,再rollback就产生segment了。该方法是在在空表中插入数据,再删除,则产生segment。导出时则可导出空表。   2、设置deferred_segment_creation 参数[backcolor=rgb(254, 254, 255)]show parameter deferred_segment_creation

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation boolean TRUE
SQL> alter system set deferred_segment_creation=false;

系统已更改。

SQL> show parameter deferred_segment_creation

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation boolean FALSE[table=97%]

  该参数值默认是TRUE,当改为FALSE时,无论是空表还是非空表,都分配segment。  需注意的是:该值设置后对以前导入的空表不产生作用,仍不能导出,只能对后面新增的表产生作用。如需导出之前的空表,只能用第一种方法。 3、先查询一下当前用户下的所有空表select table_name from user_tables where NUM_ROWS=0;用以下这句查找空表select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0把查询结果导出,执行导出的语句'ALTERTABLE'||TABLE_NAME||'ALLOCATEEXTENT;'
-----------------------------------------------------------
alter table AQ$_AQ$_MEM_MC_H allocate extent;
alter table AQ$_AQ$_MEM_MC_G allocate extent;
alter table AQ$_AQ$_MEM_MC_I allocate extent;
alter table AQ$_AQ_PROP_TABLE_T allocate extent;
alter table AQ$_AQ_PROP_TABLE_H allocate extent;
alter table AQ$_AQ_PROP_TABLE_G allocate extent;
alter table AQ$_AQ_PROP_TABLE_I allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_T allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_H allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_G allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_I allocate extent;'ALTERTABLE'||TABLE_NAME||'ALLOCATEEXTENT;'
-----------------------------------------------------------
alter table AQ$_SYS$SERVICE_METRICS_TAB_T allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_H allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_G allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_I allocate extent;然后再执行[font="][color=rgb(85, 85, 85)]exp [color=rgb(85, 85, 85)]用户名/密码@数据库名 file=/home/oracle/exp.dmp log=/home/oracle/exp.log
[font="][color=rgb(85, 85, 85)]exp tjy_chtrans/tjy_chtrans@ORCL file=/tmp/tjy_chtrans
[font="]-20150525.dmp owner=tjy_chtrans
[font="]buffer=4096000 feedback=10000;
成功

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】