ORACLE 11G使用exp或者pl/sql导出空表

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导出的时候就能将空表导出了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值