• 【Oracle】查看带Lob字段的表大小


      Oracle中,对表上的lob字段是单独存储的,所以使用segment_name = 表名的时候,只能统计非 lob 字段的数据大小,无法统计上lob字段的。

      为了方面统计,在MOS上找到一篇参考文章:

    How to Compute the Size of a Table containing Outline CLOBs and BLOBs (文档 ID 118531.1)

    相关的SQL语句如下:

    SELECT
     (SELECT SUM(S.BYTES)                                                                                                                   -- The Table Segment size
      FROM DBA_SEGMENTS S
      WHERE S.OWNER = UPPER('&SCHEMA') AND
           (S.SEGMENT_NAME = UPPER('&TABNAME'))) +  (SELECT SUM(S.BYTES)                                                             -- The Lob Segment Size
      FROM DBA_SEGMENTS S, DBA_LOBS L
      WHERE S.OWNER = UPPER('&SCHEMA') AND
           (L.SEGMENT_NAME = S.SEGMENT_NAME AND L.TABLE_NAME = UPPER('&TABNAME') AND L.OWNER = UPPER('&SCHEMA'))) +  (SELECT SUM(S.BYTES)    -- The Lob Index size
      FROM DBA_SEGMENTS S, DBA_INDEXES I
      WHERE S.OWNER = UPPER('&SCHEMA') AND
           (I.INDEX_NAME = S.SEGMENT_NAME AND I.TABLE_NAME = UPPER('&TABNAME') AND INDEX_TYPE = 'LOB' AND I.OWNER = UPPER('&SCHEMA')))
      "TOTAL TABLE SIZE"
    FROM DUAL;
  • 相关阅读:
    将军与妓
    LINUX SHELL
    LINUX FTP
    Java API的常用包
    PYTHON LOGGING模块
    json转xml
    xml转json
    PYTHON DJANGO学习笔记
    PYTHON爬取66影视的电影下载链接,有搜索功能
    JAVA PROPERTIES配置文件使用方法
  • 原文地址:https://www.cnblogs.com/bxhsdy/p/13356228.html
Copyright © 2020-2023  润新知