zoukankan      html  css  js  c++  java
  • system表空间爆满解决方法

     

    分类: Oracle

    问题描述:
    对数据库做检查,发现system表空间持续占满99%。使用如下语句查看:
    SQL> select b.tablespace_name "表空间",b.bytes/1024/1024 "大小M",(b.bytes-sum(nvl(a.bytes,0)))/1024/1024 "已使用M",substr((b.bytes-sum(nvl(a.bytes,0)))/(b.bytes)*100,1,5) "利用率" from dba_free_space a,dba_data_files b where a.file_id=b.file_id and b.tablespace_name='SYSTEM' group by b.tablespace_name,b.file_name,b.bytes order by b.tablespace_name;

    表空间            大小M        已使用M     利用率
    ------------- ----------     ----------     ----------
    SYSTEM             6770          6505         96.08%

    从dba_segments中找出占用SYSTEM表空间中排名前10位的大对象:
    SQL> col segment_name for a15;
    SQL> SELECT * FROM (SELECT SEGMENT_NAME, SUM(BYTES) / 1024 / 1024 MB FROM DBA_SEGMENTS WHERE TABLESPACE_NAME = 'SYSTEM' GROUP BY SEGMENT_NAME ORDER BY 2 DESC) WHERE ROWNUM < 10;

    SEGMENT_NAME     MB
    --------------------    ----------
    AUD$                         6016
    IDL_UB1$                    280
    SOURCE$                     80
    IDL_UB2$                     33
    C_TOID_VERSION#      24
    C_OBJ#_INTCOL#        18
    I_SOURCE1                   16
    ARGUMENT$               13
    C_OBJ#                         13
    JAVA$MC$                   12
    发现是AUD$审计表占用资源量大。为了避免对整体性能造成影响,决定把AUD$迁移到其他表空间
    解决步骤:
    1,新建aud_space表空间和aud_index索引表空间
    2,执行迁移命令,将AUD$表相关移到审计表空间中:
    SQL> alter table aud$ move tablespace aud_space;

    SQL> alter table audit$ move tablespace aud_space;

    SQL> alter index i_audit rebuild online tablespace aud_index;

    SQL> alter table audit_actions move tablespace aud_space;


    SQL> alter index i_audit_actions rebuild online tablespace aud_index;

    3,再此查看SYSTEM表空间使用状态:
    SQL> select b.tablespace_name "表空间",b.bytes/1024/1024 "大小M",(b.bytes-sum(nvl(a.bytes,0)))/1024/1024 "已使用M",substr((b.bytes-sum(nvl(a.bytes,0)))/(b.bytes)*100,1,5) "利用率" from dba_free_space a,dba_data_files b where a.file_id=b.file_id and b.tablespace_name='SYSTEM' group by b.tablespace_name,b.file_name,b.bytes order by b.tablespace_name;
    表空间            大小M        已使用M     利用率
    ------------- ----------     ----------     ----------
    SYSTEM             6770       792.3125     11.70
    可见SYSTEM表空间已经降下来了。
    4,为了安全起见,AUD$表数据目前3千多万,数据量大,后期考虑truncate此表,清空数据。
  • 相关阅读:
    poj 3616 Milking Time
    poj 3176 Cow Bowling
    poj 2229 Sumsets
    poj 2385 Apple Catching
    poj 3280 Cheapest Palindrome
    hdu 1530 Maximum Clique
    hdu 1102 Constructing Roads
    codeforces 592B The Monster and the Squirrel
    CDOJ 1221 Ancient Go
    hdu 1151 Air Raid(二分图最小路径覆盖)
  • 原文地址:https://www.cnblogs.com/lcword/p/8183094.html
Copyright © 2011-2022 走看看