锁儿's Blog

skip to my lou

导航

shink UNDO表空间若干步骤

Posted on 2007-04-06 10:39  锁儿  阅读(793)  评论(0编辑  收藏  举报
  1. 查看表空间占用量
    select tablespace_name,sum(bytes)/1024/1024/1024 GB from dba_data_files group by tablespace_name
     
    union all
    select tablespace_name,sum(bytes)/1024/1024/1024 GB from dba_temp_files group by tablespace_name order by GB;

    通常情况下,undo表空间占用量比较高,例(UNDOTBS1)

  2. 确认表空间UNDOTBS占用量
    select file_name,bytes/1024/1024 from dba_data_files where tablespace_name like 'UNDOTBS1';
  3. 检查UNDO Segment状态
    select usn,xacts,rssize/1024/1024/1024,hwmsize/1024/1024/1024,shrinks from v$rollstat order by rssize;
  4. 创建新的UNDO表空间
    create undo tablespace undotbs2;
  5. 切换UNDO表空间为新的UNDO表空间
    alter system set undo_tablespace=undotbs2 scope=both;
  6. 等待原UNDO表空间所有UNDO SEGMENT OFFLINE
    select usn,xacts,status,rssize/1024/1024/1024,hwmsize/1024/1024/1024,shrinks from v$rollstat order by rssize;
  7. 删除原UNDO表空间
    drop tablespace undotbs1 including contents;

    如果要级联删除系统文件,可使用
    drop tablespace undotbs1 including CONTENTS and datafiles;