由于Oracle 11g的 延迟段创建的新特性,导致在没有数据插入时,Oracle是不会分配数据段的,进而导致exp 是不能导出11g数据库的空表的。当然采用expdp就不存在这个问题了。expdp hr/hr schemas=hr dumpfile=expdp.dmp directory=dbtestconn hr/hrselect TABLE_NAME,NUM_ROWS from user_tables;
TABLE_NAME NUM_ROWS
------------------------------ ----------
LOCATIONS 23
EMP_1 0
PART_TIME_EMPLOYEES 0
TEST3 5
TEST1 5
TEST 5
PC_WELL_TEST 2
PC_ALARM_SORT_TEST 1
MVIEW_PC_WELL_TEST 2
MV_CAPABILITIES_TABLE 14
T 0
TEST2
SYS_EXPORT_SCHEMA_01
SYS_EXPORT_SCHEMA_02
HOURLY_EMPLOYEES 0
COUNTRIES 25
ADMIN_EXT_EMPLOYEES
ADMIN_WORK_AREA
EMPLOYEES 107
DEPARTMENTS 27
DIGITS 2
REGIONS 4
JOB_HISTORY 10
JOBS 1924 rows selected.
为什么这里的num_rows为空呢?
那是因为表刚建立,数据字典中还没有这个表相关的统计信息呢。SQL> select "alter table "||table_name||" allocate extent;" from user_tables wherenum_rows=0
"ALTERTABLE"||TABLE_NAME||"ALLOCATEEXTENT;"
-----------------------------------------------------------
alter table PART_TIME_EMPLOYEES allocate extent;
alter table EMP_1 allocate extent;
alter table T allocate extent;
alter table HOURLY_EMPLOYEES allocate extent;所以对于网上一些在oracle11g上先使用手工分配extent 再使用exp来导数据库,在实际上效果不怎么地,反而是多次一举直接使用expdp来导oracle 11g数据库中空表来的方便多了。
当然对那些要从11g导低版本,还是可以的采用这个办法,但是要注意,要么对所有相关的表进行分析系,然后使用上述那个批量脚本。或者不分析表,直接手工用ue编辑分配extent的命令。SQL> select TABLE_NAME,NUM_ROWS from user_tables where NUM_ROWS=0; TABLE_NAME NUM_ROWS
------------------------------ ----------
PART_TIME_EMPLOYEES 0
EMP_1 0
T 0
HOURLY_EMPLOYEES 0
补充信息:USER_TABLES describes the relational tables owned by the current user. Its columns (exceptfor OWNER) are the same as those in ALL_TABLES. To gather statistics for this view, use theDBMS_STATS package.收集表的统计信息:
analyze table xxx compute statistics;
or
exec dbma_stats.gather_table_stats("USER", "TABLE");
推荐阅读:RedHat Linux 5 & CentOS 5下Oracle 10g安装详解 http://www.linuxidc.com/Linux/2013-08/88928.htmCentOS 6.3(x32)下安装Oracle 10g R2 http://www.linuxidc.com/Linux/2012-11/74253.htmLinux-6-64下安装Oracle 12C笔记 http://www.linuxidc.com/Linux/2013-07/86805.htm更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12MySQL之INNODB表空间(共享、独立)impdp fail with ORA-31623相关资讯 Oracle 11g导出空表 Oracle导出空表
- Oracle 导出空表的可用方法 (08月03日)
- Oracle 11g不能导出空表的多种解决 (05/24/2015 11:43:38)
- Oracle 11g导出空表方法 (02/10/2013 15:07:35)
| - Oracle 11g 导库导不出空表问题 (08/19/2015 19:55:58)
- Oracle 11g导出空表、少表的解决办 (12/03/2014 19:27:56)
|
本文评论 查看全部评论 (0)