微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Oracle 11g导出空表、少表的解决办法

执行下面语句:

begin
  for obj in (select ‘alter table ‘||table_name||‘ allocate extent‘ objsql from user_tables where num_rows=0) loop
    execute immediate obj.objsql;
  end loop;
end;

==================================================================================

批量处理空表

       首先使用下面的sql语句查询一下当前用户下的所有空表

select table_name from user_tables where NUM_ROWS=0;

  然后用一下sql语句执行查询

select alter table ||table_name|| allocate extent;from user_tables where num_rows=0

  假设我们这里有空表TBL_1,TBL_2,TBL_3,TBL_4,则查询结果如下:

alter table TBL_1 allocate extent; alter table TBL_2 allocate extent; alter table TBL_3 allocate extent; alter table TBL_4 allocate extent;

  最后我们把上面的sql语句执行就可以了。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐