首页 > 数据库技术 > 详细

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

时间:2018-12-02 11:03:31      阅读:182      评论:0      收藏:0      [点我收藏+]

执行下面语句:

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语句执行就可以了。

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

原文:https://www.cnblogs.com/itcui/p/10052255.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!