假设我有500张表,如何快速对这500张表进行段压缩?

解决方案 »

  1.   

    select 'alter table '||table_name||' move compress;' from user_tables where xxxxxxxxxxx;得到一堆 alter table 表名 move compress; 的sql语句,放到sqlplus中执行即可。
      

  2.   

    用以下的命令:alter table <table_name> shrink space cascade;但在执行这个命令之前,你必须确保表所在的表空间是本地管理,并且段的管理方式是AUTO。否则,执行时是会出错的。你可以用以下的SQL语句获得命令:select 'alter table '||table_name || ' shrink space cascade ;' from user_tables;