对于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