oracle 11不能导出空表的详细解决方法
select t.table_name,t.num_rows from user_tables t select table_name from user_tables where NUM_ROWS=0; 若查询的空表数相同
1.先找出空表 select ‘alter table ‘||table_name||’ allocate extent;’ from user_tables where num_rows=0 2. 对空表执行容量替换,即执行下面sql语句,例如(红字为要替换的表名): alter table TBL_1 allocate extent; alter table TBL_2 allocate extent; alter table TBL_3 allocate extent; alter table TBL_4 allocate extent; ……
1、创建一个函数: create or replace function count_rows(table_name in varchar2, owner in varchar2 default null) return number authid current_user IS num_rows number; stmt varchar2(2000); begin if owner is null then stmt := ‘select count() from “’||table_name||’”’; else stmt := 'select count() from "’||owner||’"."’||table_name||’"’; end if; execute immediate stmt into num_rows; return num_rows; end;
2、执行下面语句,找出实际空表数 select table_name, count_rows(table_name) nrows from user_tables order by nrows
3、对空表执行容量替换,即执行下面sql语句,例如(红字为要替换的表名): alter table TBL_1 allocate extent; alter table TBL_2 allocate extent; alter table TBL_3 allocate extent; alter table TBL_4 allocate extent;
链接: https://blog.csdn.net/iwes_c/article/details/78337597?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param.