oracle11g R2 出现新增的表在导出的时候报EXP-00011: xx does not exist

先来看一下例子。我们创建一张表T2。 
Sql代码   收藏代码
  1. SQL> create table t2 (n number);    
  2. Table created.    
  3. SQL> desc t2    
  4.  Name                                      Null?    Type    
  5.  ----------------------------------------- -------- ----------------------------    
  6.  N                                                  NUMBER   


尝试使用exp将此表导出。 

Sql代码   收藏代码
  1. D:\Temp>exp kamus/oracle tables=t2  
  2.    
  3. Export: Release 11.2.0.1.0 - Production on Fri Apr 16 18:11:51 2010  
  4.    
  5. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.  
  6.    
  7.    
  8. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production  
  9.    
  10. With the Partitioning, Oracle Label Security, Data Mining and Real Application Testing opt  
  11. ions  
  12. Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set  
  13.    
  14. About to export specified tables via Conventional Path ...  
  15. EXP-00011: KAMUS.T2 does not exist  
  16. Export terminated successfully with warnings.  

报错说这张表并不存在。这是让很多客户费解的地方,在测试库中创建应用的表结构,然后再将表结构exp到产品库中去,这是很多客户常用的方法,但是在11gR2中如果这些表是新创建的没有插入过任何一条记录,那么将会碰到上面这样的错误。 

原因在于11gR2中的新功能 – Deferred Segment Creation(延迟段创建),默认情况下这个功能是启用的。 

Sql代码   收藏代码
  1. SQL> show parameter DEFERRED_SEGMENT_CREATION    
  2. NAME                                 TYPE                 VALUE    
  3.   
  4. ------------------------------------ -------------------- --------------------    
  5.   
  6. deferred_segment_creation            boolean              TRUE   
SQL> 
延迟段创建的含义是当此新创建一个可能会有Segment的对象时(比如表、索引、物化视图等),如果这个对象中还没有任何记录需要消耗一个Extent,那么将不会在创建对象时自动创建Segment,这样做的好处无疑是在创建对象时大大提高了速度。 

对于上例中的T2表,我们在创建结束就立刻检查DBA_SEGMENTS视图,会发现没有任何记录。 

Sql代码   收藏代码
  1. SQL> select segment_name from user_segments where segment_name='T2';    
  2.  rows selected   

而对于exp程序而言,当仅仅存在Object的定义而没有相应的Segment时,就会报出EXP-00011对象不存在的错误。 

解决方法就很简单了,以下方法任选其一。 

1. 设置DEFERRED_SEGMENT_CREATION为FALSE,这样创建对象时就会自动创建Segment 

2. 在创建对象时,明确指定立刻创建Segment 

create table t2 (n number) SEGMENT CREATION IMMEDIATE; 

3. 使用expdp替代exp(Datapump本身就是Oracle10g以后的推荐工具) 

Sql代码   收藏代码
  1.     D:\Temp>expdp kamus/oracle tables=t2  
  2.    
  3. Export: Release 11.2.0.1.0 - Production on Fri Apr 16 18:14:41 2010  
  4.    
  5. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.  
  6.    
  7. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production  
  8.    
  9. With the Partitioning, Oracle Label Security, Data Mining and Real Application Testing opt  
  10. ions  
  11. Starting "KAMUS"."SYS_EXPORT_TABLE_01":  kamus/******** tables=t2  
  12. Estimate in progress using BLOCKS method...  
  13. Processing object type TABLE_EXPORT/TABLE/TABLE_DATA  
  14. Total estimation using BLOCKS method: 0 KB  
  15. Processing object type TABLE_EXPORT/TABLE/TABLE  
  16. . . exported "KAMUS"."T2"                                    0 KB       0 rows  
  17. Master table "KAMUS"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded  
  18. ******************************************************************************  
  19. Dump file set for KAMUS.SYS_EXPORT_TABLE_01 is:  
  20.   D:\ORACLE\ADMIN\ORCL\DPDUMP\EXPDAT.DMP  
  21. Job "KAMUS"."SYS_EXPORT_TABLE_01" successfully completed at 18:15:10  
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值