oracle 11g用exp导出不了空表
之前已经遇到这个用exp导出不了空表的问题,就用最笨的方法插入一条再删除掉再exp就可以了,今天发现还可以设置数据库的一个参数就OK了(不过已经创建的表还是不行的)
解决方法
1、insert一行,再rollback就产生segment了。
该方法是在在空表中插入数据,再删除,则产生segment。导出时则可导出空表。
2、设置deferred_segment_creation 参数,刚把设置的历史记录下来了。
Microsoft Windows [版本 5.2.3790]
(C) 版权所有 1985-2003 Microsoft Corp.
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期三 5月 25 18:23:45 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> 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。
需注意的是:该值设置后对以前导入的空表不产生作用,仍不能导出,只能对后面新增的表产生作用。如需导出之前的空表,只能用第一种方法。
先查询一下当前用户下的所有空表
select table_name from user_tables where num_rows=0;
用以下这句查找空表,并把重分配空间的执行语句生成
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0
alter table MSG_TYPE allocate extent;
alter table MSG_QUICK_REPLY allocate extent;
alter table MSG_BLACKLIST allocate extent;
alter table MSG_IMAGE allocate extent;
alter table ACCIDENT_DOUBT allocate extent;
alter table R_MSG_TEXT_VEHICLE allocate extent;
alter table FENCE_CROSS_HISTORY allocate extent;
执行一下,DONE
相关评论