oracle导出指定用户下的数据库dmp文件过程中出现空表没有导出:
在11g的 oracle 数据库中,如果没有提前设置,空表导不出来。
解决方法:
1.首先,通过select 来生成修改语句:
select 'alter table '||table_name||' allocate extent;'
from user_tables where num_rows=0 or num_rows is
null;
2.然后,就在结果窗口里面生成了以下类似的sql语句:
alter table E2USER_STATE allocate extent;
alter table ENTERPRISE_E2USER allocate
extent;
alter table ENTERPRISE_INFO_TYPE allocate extent;
........
3.接着,执行步骤2的所有sql语句;
4.然后,执行exp命令导出数据库,
命令如下:exp 用户名/密码@数据库
owner=指定用户名 file=路径\文件名.dmp
log=./dmp.log
例如:exp
irsuat/irsuat@10.23.117.135:1521/orcl
owner=irsuat file=./irsuat.dmp log=./dmp.log
5.导出完毕以后,对比导出的表是否完全:
5.1
首先,在数据库中统计用户下表总数
select count(1) from
user_tables;
5.2
然后,在dmp.log日志中统计导出的表总数
5.3
如果导出的表总数不一致,需要进行下面操作
5.3.1首先,select table_name from
user_tables;查出用户下所有表名
5.3.1然后,在dmp.log日志中统计所有表名
5.3.3接着,使用对比工具查找没有导出的表名
5.3.4然后,
在数据库中执行 select row_nums from user_tables where table_name =
'table_name'; 查看表行数是否为空,
如果不为空的话需要执行 analyze table table_name USER_DEFINEINFO estimate
statistics sample 20 percent
完成以后再重复执行步骤2-4即可