ORACLE 11G中有个新特性,当表无数据时,不分配segment,以节省空间
解决方法如下:
1、所在的用户下创建查询生产分析表的语句如下:
select ‘analyze table ‘||table_name||’ compute statistics;’ from user_tables;
2、将查出的数据进行执行
3、处理空表 生成处理语句
select ‘alter table ‘||table_name||’ allocate extent;’ from user_tables where num_rows=0;
4、将查出的数据进行执行
5、查询所有空表
select table_name from user_tables where NUM_ROWS=0;
6、执行导出语句,导出表空间内所有表 (exp导出 owner 表示导出用户下的全部数据 file 导出文件存放的路径 text.dmp 导出dmp数据文件)
exp 用户名/密码@orcl file=D:\test.dmp owner=用户名
7、导入语句(imp 导入 file 文件路径 text.dmp 要导入dmp文件 full=y 导入该文件的全部数据)
imp 用户名/密码@orcl file=D:\text.dmp full=y