一、问题原因:
11G中有个新特性,当表无数据时,不分配segment,以节省空间
1、insert一行,再rollback就产生segment了。
该方法是在在空表中插入数据,再删除,则产生segment。导出时则可导出空表。
2、设置deferred_segment_creation 参数
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
该参数值默认是TRUE,当改为FALSE时,无论是空表还是非空表,都分配segment。
需注意的是:该值设置后对以前导入的空表不产生作用,仍不能导出,只能对后面新增的表产生作用。如需导出之前的空表,只能用第一种方法。
二、解决方法:
1、先查询一下所有用户下的所有空表
select table_name from all_tables where NUM_ROWS=0;
当前用户下的表
select table_name from user_tables where NUM_ROWS=0;
2、用以下这句查找空表
所有用户:
select'alter table '||owner||'.'||table_name||' allocate extent;'from all_tables where num_rows=0;
当前用户:
select'alter table '||table_name||' allocate extent;'from user_tables where num_rows=0;
把查询结果导出,执行导出的语句
-----------------------------------------------------------
alter table SYS.PROXY_ROLE_DATA$ allocateextent;
alter table SYS.UET$ allocate extent;
alter table SYS.PROXY_DATA$ allocateextent;
alter table SYS.FET$ allocate extent;
alter table SYS.OBJERROR$ allocate extent;
alter table SYS.UGROUP$ allocate extent;
alter table SYS.SUPEROBJ$ allocate extent;
alter table SYS.REFCON$ allocate extent;
alter table SYS.VIEWCON$ allocate extent;
alter table SYS.OBJPRIV$ allocate extent;
alter table SYS.DEFROLE$ allocate extent;
alter table SYS.ECOL$ allocate extent;
alter table SYS.EV$ allocate extent;
alter table SYS.EVCOL$ allocate extent;
alter table SYS.LINK$ allocate extent;
alter table SYS.RECYCLEBIN$ allocateextent;
alter table SYS.IND_ONLINE$ allocateextent;
alter table SYS.JIJOIN$ allocate extent;
alter table SYS.JIREFRESHSQL$ allocateextent;
alter table SYS.TRIGGERCOL$ allocateextent;
alter table SYS.TRIGGERJAVAF$ allocateextent;
alter table SYS.TRIGGERJAVAS$ allocateextent;
alter table SYS.TRIGGERJAVAC$ allocateextent;
alter table SYS.TRIGGERJAVAM$ allocateextent;
alter table SYS.VIEWTRCOL$ allocate extent;
alter table SYS.TRIGGERDEP$ allocateextent;
alter table SYS.INDREBUILD$ allocateextent;
alter table SYS.COMPRESSION$ allocateextent;
alter table SYS.TRANSIENT_IOT$ allocateextent;
alter table SYS.SQL$ allocate extent;
alter table SYS.SQL$TEXT allocate extent;
alter table SYS.SQLOBJ$AUXDATA allocateextent;
alter table SYS.OBJECT_USAGE allocateextent;
alter table SYS.ERROR$ allocate extent;
alter table SYS.NCOMP_DLL$ allocate extent;
alter table SYS.ASSEMBLY$ allocate extent;
alter table SYS.DIANA_VERSION$ allocateextent;
alter table SYS.PENDING_TRANS$ allocateextent;
alter table SYS.PENDING_SESSIONS$ allocateextent;
alter table SYS.PENDING_SUB_SESSIONS$allocate extent;
…………………
3、然后再执行
exp用户名/密码@数据库名file=/home/oracle/exp.dmp log=/home/oracle/exp_smsrun.log 成功!