如题:
     公司有个表空间tbs,
     我在使用alter tablespace tbs coalesce; 对其进行收缩时发现无效。
     现在需要对其进行重建。
     
    我的步骤是:
    
    alter tablespace tbs offline;
    drop tablespace tbs including contents and datafiles; 
    create tablespace tbs
    datafile 路径 size 2000M  reuse autoextend on next 1m maxsize unlimited;        这方法或步骤行不? 如不行,大家提供下方法或思路,谢谢!

解决方案 »

  1.   

    alter   tablespace   xxx   coalesce只能把相邻的空余数据块连成一些比较大的空块,但是不会移动当前的数据块
    收缩表空间我就知道2种:一、exp导出,然后imp导入。二、alter   database   datafile   'D:\mahanso.dbf   '   resize   200m; 但是目前第二种我还没测试成功过,我之前的tablespace用第二种只能扩大,不到缩小。
    注:对表空间操作,要做好相应的备份工作。
      

  2.   

    一、还是先exp用户,在imp比较有效。
    二、前段时间我的笔记本的表空间文件达到了100G,想用resize的方法,收缩一下,发现基本不起作用,后来分析原因,是因为表空间在长时间的使用中,会产生很多碎片。
    三、楼主没有提到数据的问题,如果数据不想要了,直接删除就行;如果想要数据,就先exp吧,在重建表空间。
    也可以重建数据文件:--删除数据文件
    alter tablespace drop datafile filename;
    --添加数据文件
    alter tablespace add datafile filename size 500M autoextend on next 50M;