zoukankan      html  css  js  c++  java
  • oracle 查询 LOB 字段大小

    select distinct ab.TABLE_NAME,
                    ab.SEGMENT_NAME,
                    ab.TABLESPACE_NAME,
                    ab.OWNER,
                    sum(ac.BYTES / 1024 / 1024 / 1024) GB
      from dba_lobs ab, DBA_SEGMENTS ac
     where ab.OWNER IN (SELECT USERNAME
                          FROM DBA_USERS A
                         WHERE A.account_status = 'OPEN'
                           AND A.default_tablespace NOT IN
                               ('SYSTEM',
                                'USERS',
                                'SYSAUX',))
       and ab.SEGMENT_NAME = ac.segment_name
       and ab.OWNER = ac.owner
    --and ab.TABLESPACE_NAME = 'LOB_DATA'
     group by ab.TABLE_NAME, ab.SEGMENT_NAME, ab.TABLESPACE_NAME, ab.OWNER
     order by 5 desc

    ---针对单表(分区表)查询 单个分区LOB 字段大小

    SELECT DLP.TABLE_NAME,
           DLP.COLUMN_NAME,
           DLP. PARTITION_NAME,
           DS.BYTES / 1024 / 1024 / 1024 GB
      FROM DBA_LOB_PARTITIONS DLP
      LEFT JOIN DBA_SEGMENTS DS
        ON (DLP.LOB_PARTITION_NAME = DS.PARTITION_NAME)
     WHERE DLP.TABLE_NAME = 'T_TEST
       AND DS.SEGMENT_NAME = 'SYS_LOB0000318949C00003$$';

    ---汇总----查询LOB字段每个分区的使用量
    select w.partition_name, w.gg, r.partition_name, r.table_name
    from (SELECT round(sum(bytes / 1024 / 1024 / 1024), 2) gg,
    e.segment_name,
    q.partition_name,
    e.TABLE_NAME
    FROM DBA_SEGMENTS Q, dba_lobs e
    WHERE Q.segment_name = e.SEGMENT_NAME
    and e.TABLESPACE_NAME = 'LOB_DATA'
    group by e.segment_name, q.partition_name, e.TABLE_NAME
    order by 1 desc) w,
    dba_lob_partitions r
    where w.gg > 1
    and r.lob_partition_name = w.partition_name
    order by r.partition_name

  • 相关阅读:
    PAT乙级1002. 写出这个数 (20)
    PAT乙级1001. 害死人不偿命的(3n+1)猜想 (15)
    HDU 4520 小Q系列故事——最佳裁判
    POJ 3414 Pots(BFS)
    POJ 1118 Lining Up
    POJ 2484 A Funny Game
    POJ 2231 Moo Volume
    HDU 5718 Oracle(高精度)
    FZU 1502 Letter Deletion(DP)
    HDU 1564 Play a game
  • 原文地址:https://www.cnblogs.com/ss-33/p/9146730.html
Copyright © 2011-2022 走看看