您的位置:首页 > 其它

11G在用EXP导出时,空表不能导出解…

2017-05-02 10:55 330 查看
http://wanwentao.blog.51cto.com/2406488/545154

 

 

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

 

[align=center][/align]
 

  该参数值默认是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


把查询结果导出,执行导出的语句

'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;

然后再执行

exp 用户名/密码@数据库名 file=/home/oracle/exp.dmp
log=/home/oracle/exp_smsrun.log

 

 

无法导入到指定表空间的问题

 

http://www.itpub.net/thread-1419499-1-1.html

 

 

平台 : WIN7

数据库:  11.2.0.1

想在imp的时候,导入到指定的表空间里,revoke unlimited, quota0 , quota unlimited
已经做了。

同样的操作,在LINUX5+10GR2上,没有任何问题,可以正常的imp到指定的表空间里,在11G里就报ORA-01536,不知道是什么原因,有知道请告知下,谢谢。

SQL> conn scott/tiger

Connected to Oracle
Database 11g Enterprise Edition Release 11.2.0.1.0

Connected as scott

SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME    
  
  
  
  
  
 TABLESPACE_NAME

------------------------------ ------------------------------

DEPT    
  
  
  
  
  
  
    USERS

EMP    
  
  
  
  
  
  
     USERS

BONUS    
  
  
  
  
  
  
   USERS

SALGRADE    
  
  
  
  
  
   USERS

SQL> create user test identified by test default tablespace
test;

User created

SQL> grant connect,resource,dba to test;

Grant succeeded

SQL> revoke unlimited
tablespace  from test;

Revoke succeeded

SQL> alter user test quota 0 on users;

User altered

SQL> alter user test quota unlimited on test;

User altered

C:\>ex
a79b
p scott/tiger file=f:/dept.dmp tables=dept

Export: Release 11.2.0.1.0 - Production on 星期日 4月 17 21:13:39
2011

Copyright (c) 1982, 2009, Oracle and/or its
affiliates.  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

已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

服务器使用 AL32UTF8 字符集 (可能的字符集转换)

即将导出指定的表通过常规路径...

. . 正在导出表    
  
  
  
  
  
  
    
DEPT导出了    
  
   4 行

EXP-00091: 正在导出有问题的统计信息。

EXP-00091: 正在导出有问题的统计信息。

导出成功终止, 但出现警告。

C:\>imp system/system fromuser=scott touser=test
file=f:\dept.dmp

Import: Release 11.2.0.1.0 - Production on 星期日 4月 17 21:17:59
2011

Copyright (c) 1982, 2009, Oracle and/or its
affiliates.  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

经由常规路径由 EXPORT:V11.02.00 创建的导出文件

警告: 这些对象由 SCOTT 导出, 而不是当前用户

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入

导入服务器使用 AL32UTF8 字符集 (可能的字符集转换)

. 正在将 SCOTT 的对象导入到 TEST

. . 正在导入表    
  
  
  
  
  
  
   "DEPT"

IMP-00058: 遇到 ORACLE
错误 1536

ORA-01536: 超出表空间 'USERS' 的空间限额

成功终止导入, 但出现警告。

但是表已经导进去了,表空间且还是USERS

SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME    
  
  
  
  
  
 TABLESPACE_NAME

------------------------------ ------------------------------

DEPT    
  
  
  
  
  
  
  
 USERS

 

最新进展:

改用expdp,impdp

在Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA 后就不动了,

查看v$session_wait ,

等待事件为:wait for unread message on broadcast channel

和该贴的症状一样:http://www.itpub.net/viewthread.php?tid=937231

该测试在LINUX5+10G下仍然没问题。。

难道11G的BUG还真不少?

修改deferred_segment_creation=false试试。应该帮你解决问题了。

 

-测试确实用这种方法可以解决(Superhao)

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: