oracle在11G这个版本中增添了一个新的参数:deferred_segment_creation,默认值为true,作用是延迟建表,对于新建之后从未插入过数据的表(插入数据后又删除所有数据的表不在此列)。可将其设置成false来让之后的表不使用延迟建表,但对于之前的表没用。在此提供一种其他方法的补充:
使用:select ‘alter table ‘||table_name||’ allocate extent;’ from user_tables where num_rows=0语句查出结果,结果中就是新建后未添加过诗句的表,将结果保存。
我保存成了.sql文件,内容如下:
prompt Importing table user_tables...
set feedback off
set define off
alter table COM_CONTACT_MECH allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_ATTRIBUTE allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_CONTACT_MECH allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_IDENTIFICATION allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_ROLE allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_STATUS allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_ROLE_TYPE allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_RR_PROFILE allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_RR_PROFILE_RELA allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_RR_PROFILR_DETAIL allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_CHGPASS_REC allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_EXCLUSE_ITEM allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LEVEL_GRANT_DEPTS allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LEVEL_GRANT_OBJECTS allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LEVEL_GRANT_ROLES allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LOCK_ACCOUNTS allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LOGIN_EXT allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LOGIN_LIMIT allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_NEED_APPROVE_ROLE allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_ROLE_APPROVE_RECORD allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_ROLE_RIGHT allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_SAFE_POLICY allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ACCOUNTS_DESKTOP allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ACCOUNTS_WIDGETS allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ACCOUNT_SHORT_CUT allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CACHE_REFRESH_DATE allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CONSIGN_REC allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CQ_COND allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CQ_COND_DEF allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_DROPBEAN_REFRESH_DATE allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ENTITY_AUDIT allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_HELP_BOOKMARK allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_MODIFY_DETAIL allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_MODIFY_LOG allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_OBJECT_CONSIGN allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_PROPERTY_AUDIT allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_REMOTE_APP allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_REMOTE_MENU allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ROLE_CONSIGN allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ROLE_GROUP allocate extent;');
insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_TABLE_INFO allocate extent;');
prompt Done.
直接执行这个文件是报错的,需要修改成如下格式:
alter table COM_CONTACT_MECH allocate extent;
alter table COM_PARTY_ATTRIBUTE allocate extent;
alter table COM_PARTY_CONTACT_MECH allocate extent;
alter table COM_PARTY_IDENTIFICATION allocate extent;
alter table COM_PARTY_ROLE allocate extent;
alter table COM_PARTY_STATUS allocate extent;
alter table COM_ROLE_TYPE allocate extent;
alter table EP_RR_PROFILE allocate extent;
alter table EP_RR_PROFILE_RELA allocate extent;
alter table EP_RR_PROFILR_DETAIL allocate extent;
alter table EP_R_CHGPASS_REC allocate extent;
alter table EP_R_EXCLUSE_ITEM allocate extent;
alter table EP_R_LEVEL_GRANT_DEPTS allocate extent;
alter table EP_R_LEVEL_GRANT_OBJECTS allocate extent;
alter table EP_R_LEVEL_GRANT_ROLES allocate extent;
alter table EP_R_LOCK_ACCOUNTS allocate extent;
alter table EP_R_LOGIN_EXT allocate extent;
alter table EP_R_LOGIN_LIMIT allocate extent;
alter table EP_R_NEED_APPROVE_ROLE allocate extent;
alter table EP_R_ROLE_APPROVE_RECORD allocate extent;
alter table EP_R_ROLE_RIGHT allocate extent;
alter table EP_R_SAFE_POLICY allocate extent;
alter table EP_SYS_ACCOUNTS_DESKTOP allocate extent;
alter table EP_SYS_ACCOUNTS_WIDGETS allocate extent;
alter table EP_SYS_ACCOUNT_SHORT_CUT allocate extent;
alter table EP_SYS_CACHE_REFRESH_DATE allocate extent;
alter table EP_SYS_CONSIGN_REC allocate extent;
alter table EP_SYS_CQ_COND allocate extent;
alter table EP_SYS_CQ_COND_DEF allocate extent;
alter table EP_SYS_DROPBEAN_REFRESH_DATE allocate extent;
alter table EP_SYS_ENTITY_AUDIT allocate extent;
alter table EP_SYS_HELP_BOOKMARK allocate extent;
alter table EP_SYS_MODIFY_DETAIL allocate extent;
alter table EP_SYS_MODIFY_LOG allocate extent;
alter table EP_SYS_OBJECT_CONSIGN allocate extent;
alter table EP_SYS_PROPERTY_AUDIT allocate extent;
alter table EP_SYS_REMOTE_APP allocate extent;
alter table EP_SYS_REMOTE_MENU allocate extent;
alter table EP_SYS_ROLE_CONSIGN allocate extent;
alter table EP_SYS_ROLE_GROUP allocate extent;
alter table EP_SYS_TABLE_INFO allocate extent;
执行修改后的文件之后,再用exp或者pl/sql导出的时候就能将空表导出了。