[Oracle] EXP无法导出延迟段创建的表 [转帖]_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3356 | 回复: 0   主题: [Oracle] EXP无法导出延迟段创建的表 [转帖]        下一篇 
wayne
注册用户
等级:中校
经验:1690
发帖:221
精华:0
注册:2011-7-21
状态:离线
发送短消息息给wayne 加好友    发送短消息息给wayne 发消息
发表于: IP:您无权察看 2011-9-8 21:06:07 | [全部帖] [楼主帖] 楼主

对于11g中使用了延迟段创建方式创建的表,如果导出时刻表的段没有被创建,那么EXP不会导出这张表。

检查测试如下:

SQL> create table t_defer (id number, name varchar2(30));

Table created.

SQL> create table t_imme (id number, name varchar2(30)) segment creation immediate;

Table created.

SQL> select table_name, segment_created from user_tables;

TABLE_NAME SEG

------------------------------ ---
T_IMME YES
T_DEFER NO


下面通过EXP进行导出:

[oracle@DB11G ~]$ exp yangtk/yangtk file=seg_defer.dmp log=seg_defer.log buffer=2048000
Export: Release 11.2.0.1.0 - Production on Wed Aug 24 14:11:39 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user YANGTK
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user YANGTK
About to export YANGTK's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export YANGTK's tables via Conventional Path ...
. . exporting table T_IMME 0 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
[oracle@DB11G ~]$ exp yangtk/yangtk file=defer.dmp log=defer.log tables=t_defer buffer=2048000
Export: Release 11.2.0.1.0 - Production on Wed Aug 24 14:12:42 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
EXP-00011: YANGTK.T_DEFER does not exist
Export terminated successfully with warnings.
[oracle@DB11G ~]$ exp yangtk/yangtk file=defer.dmp log=defer.log tables=t_defer buffer=2048000 direct=y recordlength=65534
Export: Release 11.2.0.1.0 - Production on Wed Aug 24 14:13:04 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
About to export specified tables via Direct Path ...
EXP-00011: YANGTK.T_DEFER does not exist
Export terminated successfully with warnings.
[oracle@DB11G ~]$ expdp yangtk/yangtk dumpfile=seg_defer.dp logfile=seg_defer_expdp.log directory=d_output
Export: Release 11.2.0.1.0 - Production on Wed Aug 24 14:13:36 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "YANGTK"."SYS_EXPORT_SCHEMA_01": yangtk/******** dumpfile=seg_defer.dp logfile=seg_defer_expdp.log directory=d_output
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
. . exported "YANGTK"."T_DEFER" 0 KB 0 rows
. . exported "YANGTK"."T_IMME" 0 KB 0 rows
Master table "YANGTK"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for YANGTK.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/dmp/seg_defer.dp
Job "YANGTK"."SYS_EXPORT_SCHEMA_01" successfully completed at 14:14:33


可以看到,无论是使用常规路径还是直接路径,即使直接指定表名,也无法导出延迟段创建的表,而数据泵导出则没有这个问题。

对于已经设置了延迟段创建,又希望EXP导出的时候可以导出所有表,可以通过下面的简单方法:

SQL> begin
2 for i in (select table_name from user_tables where segment_created = 'NO') loop
3 execute immediate 'alter table ' || i.table_name || ' allocate extent';
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> select table_name, segment_created from user_tables;
TABLE_NAME SEG
------------------------------ ---
T_IMME YES
T_DEFER YES


这时EXP就可以正确导出所有表了:

[oracle@DB11G ~]$ exp yangtk/yangtk file=seg_defer_2.dmp log=seg_defer_2.log buffer=2048000

Export: Release 11.2.0.1.0 - Production on Wed Aug 24 15:44:21 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)


About to export specified users ...

. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user YANGTK
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user YANGTK
About to export YANGTK's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export YANGTK's tables via Conventional Path ...
. . exporting table T_DEFER 0 rows exported
. . exporting table T_IMME 0 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.



该贴被蜀山战纪编辑于2015-12-3 16:28:27




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论