美文网首页
oracle归档盘空间不足

oracle归档盘空间不足

作者: Reiko士兵 | 来源:发表于2019-02-03 16:27 被阅读0次

    参考链接

    一、 监控原因及监控阈值

    归档空间不足会导致oracle数据库的在线日志无法正常归档,进一步导致数据库的不可用。监控阈值为存放归档日志的磁盘利用率高于80%且可用空间小于1T;

    二、 监控阈值查询语句

    SET linesize 200
    
    SELECT USAGE,
           To_char(sysdate, 'yyyy-mm-dd hh24:mi:ss'),
           NAME,
           USABLE_FILE_MB
    FROM   (SELECT Round(( t.CAN_USE_TOTAL_MB - t.USABLE_FILE_MB ) / Decode(t.CAN_USE_TOTAL_MB, 0, 1,
                                                                                                t.CAN_USE_TOTAL_MB) * 100) AS USAGE,
                   d.diskgroup_type,
                   t.NAME,
                   t.USABLE_FILE_MB,
                   t.min_need_free_mb
            FROM   (SELECT p.NAME,
                           p.type,
                           p.TOTAL_MB,
                           p.REQUIRED_MIRROR_FREE_MB,
                           ( a.total_free_mb - p.REQUIRED_MIRROR_FREE_MB ) / Decode(p.TYPE, 'NORMAL', 2,
                                                                                            'HIGH', 3,
                                                                                            1) AS USABLE_FILE_MB,
                           ( p.TOTAL_MB - p.REQUIRED_MIRROR_FREE_MB ) / Decode(p.TYPE, 'NORMAL', 2,
                                                                                       'HIGH', 3,
                                                                                       1)      AS CAN_USE_TOTAL_MB,
                           Decode(Sign(a.min_need_free_mb - 1048576), -1, 1048576,
                                                                      a.min_need_free_mb)      AS min_need_free_mb
                    FROM   v$asm_diskgroup p,
                           (SELECT group_number,
                                   Min(free_mb) * Count(*) AS total_free_mb,
                                   32768 * Count(*)        AS min_need_free_mb
                            FROM   v$asm_disk
                            GROUP  BY group_number) a
                    WHERE  p.group_number = a.group_number) t,
                   (SELECT 'ARCH_DG'                              AS diskgroup_type,
                           Upper(Replace(a.DESTINATION, '+', '')) AS diskgroup_name
                    FROM   v$archive_dest a
                    WHERE  a.TARGET IN ( 'PRIMARY', 'LOCAL' )
                           AND A.STATUS = 'VALID'
                           AND a.valid_now = 'YES'
                           AND a.DESTINATION IS NOT NULL
                           AND a.DESTINATION <> 'USE_DB_RECOVERY_FILE_DEST'
                           AND a.dest_name <> 'STANDBY_ARCHIVE_DEST'
                    UNION
                    SELECT 'ARCH_DG'                        AS diskgroup_type,
                           Upper(Replace(p.VALUE, '+', '')) AS diskgroup_name
                    FROM   v$parameter p,
                           v$archive_dest a
                    WHERE  p.name = 'db_recovery_file_dest'
                           AND a.DESTINATION = 'USE_DB_RECOVERY_FILE_DEST') d
            WHERE  t.name = d.diskgroup_name)
    WHERE  USAGE >= 80
           AND USABLE_FILE_MB <= min_need_free_mb;
    
    

    相关文章

      网友评论

          本文标题:oracle归档盘空间不足

          本文链接:https://www.haomeiwen.com/subject/wrwysqtx.html