Querying the size of a table with LOB fields in an Oracle database

Source: Internet
Author: User

Note: Because LOB fields have separate LOB segment to store, it is not possible to query only dba_segments for tables with LOB fields.
The following script comes from:
How to Compute the Size of a Table containing Outline clobs and blobs[article ID 118531.1]
Modified: Changed to NVL (SUM (s.bytes), 0)
sql> col "Total TABLE SIZE" format 99999999999999
---Note: The following SQL can be executed directly. To make it easier to copy the script, it does not post the SQL statement's log, but instead puts the SQL statement at execution time. select  (SELECT NVL (SUM (s.bytes), 0)                       &NBSP ;                          ,         &NB Sp                            /     -- The Table Segment size  from dba_segments s  WHERE s.owner = UPPER (' LC0019999 ') and        (S .  Segment_name = UPPER (' Zwpzk ')) +  (SELECT NVL (SUM (s.bytes), 0)                                          ,         &N Bsp                          ,         &NB Sp      -the Lob Segment size  from Dba_segments S, DBa_lobs l  WHERE s.owner = UPPER (' LC0019999 ') and        (l.segment_name = S.segment_name and L.ta Ble_name = UPPER (' Zwpzk ') and L.owner = UPPER (' LC0019999 ')) +  (SELECT NVL (SUM (s.bytes), 0)       &NBSP ;                          ,         &NB Sp                          ,         &NB Sp              --the Lob Index size  from Dba_segments S, dba_indexes i  wher E S.owner = UPPER (' LC0019999 ') and        (i.index_name = s.segment_name and I.table_name = UPPER (' Zwpz K ') and Index_type = ' LOB ' and I.owner = UPPER (' LC0019999 '))   "Total TABLE SIZE" from DUAL; Total TABLE SIZE----------------3571869286sql> select 3571869286/1024/1024/1024 from DUAL;35718692864/1024/1024/1            024--------------------------     3.3265625 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.