<span class="kwd">SELECT</span><span class="pln">
owner</span><span class="pun">,</span><span class="pln"> table_name</span><span class="pun">,</span><span class="pln"> TRUNC</span><span class="pun">(</span><span class="pln">sum</span><span class="pun">(</span><span class="pln">bytes</span><span class="pun">)/</span><span class="lit">1024</span><span class="pun">/</span><span class="lit">1024</span><span class="pun">/</span><span class="lit">1024</span><span class="pun">)</span><span class="pln"> GB
</span><span class="kwd">FROM</span>
<span class="pun">(</span><span class="kwd">SELECT</span><span class="pln"> segment_name table_name</span><span class="pun">,</span><span class="pln"> owner</span><span class="pun">,</span><span class="pln"> bytes
</span><span class="kwd">FROM</span><span class="pln"> dba_segments
</span><span class="kwd">WHERE</span><span class="pln"> segment_type </span><span class="kwd">in</span> <span class="pun">(</span><span class="str">'TABLE'</span><span class="pun">,</span><span class="str">'TABLE PARTITION'</span><span class="pun">)</span>
<span class="kwd">UNION</span> <span class="kwd">ALL</span>
<span class="kwd">SELECT</span><span class="pln"> i</span><span class="pun">.</span><span class="pln">table_name</span><span class="pun">,</span><span class="pln"> i</span><span class="pun">.</span><span class="pln">owner</span><span class="pun">,</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">bytes
</span><span class="kwd">FROM</span><span class="pln"> dba_indexes i</span><span class="pun">,</span><span class="pln"> dba_segments s
</span><span class="kwd">WHERE</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">segment_name </span><span class="pun">=</span><span class="pln"> i</span><span class="pun">.</span><span class="pln">index_name
</span><span class="kwd">AND</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">owner </span><span class="pun">=</span><span class="pln"> i</span><span class="pun">.</span><span class="pln">owner
</span><span class="kwd">AND</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">segment_type </span><span class="kwd">in</span> <span class="pun">(</span><span class="str">'INDEX'</span><span class="pun">,</span><span class="str">'INDEX PARTITION'</span><span class="pun">)</span>
<span class="kwd">UNION</span> <span class="kwd">ALL</span>
<span class="kwd">SELECT</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">table_name</span><span class="pun">,</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">owner</span><span class="pun">,</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">bytes
</span><span class="kwd">FROM</span><span class="pln"> dba_lobs l</span><span class="pun">,</span><span class="pln"> dba_segments s
</span><span class="kwd">WHERE</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">segment_name </span><span class="pun">=</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">segment_name
</span><span class="kwd">AND</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">owner </span><span class="pun">=</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">owner
</span><span class="kwd">AND</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">segment_type </span><span class="kwd">IN</span> <span class="pun">(</span><span class="str">'LOBSEGMENT'</span><span class="pun">,</span><span class="str">'LOB PARTITION'</span><span class="pun">)</span>
<span class="kwd">UNION</span> <span class="kwd">ALL</span>
<span class="kwd">SELECT</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">table_name</span><span class="pun">,</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">owner</span><span class="pun">,</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">bytes
</span><span class="kwd">FROM</span><span class="pln"> dba_lobs l</span><span class="pun">,</span><span class="pln"> dba_segments s
</span><span class="kwd">WHERE</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">segment_name </span><span class="pun">=</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">index_name
</span><span class="kwd">AND</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">owner </span><span class="pun">=</span><span class="pln"> l</span><span class="pun">.</span><span class="pln">owner
</span><span class="kwd">AND</span><span class="pln"> s</span><span class="pun">.</span><span class="pln">segment_type </span><span class="pun">=</span> <span class="str">'LOBINDEX'</span><span class="pun">)</span>
<span class="com">---WHERE owner in UPPER('&owner')</span>
<span class="kwd">GROUP</span> <span class="kwd">BY</span><span class="pln"> table_name</span><span class="pun">,</span><span class="pln"> owner
</span><span class="kwd">HAVING</span><span class="pln"> SUM</span><span class="pun">(</span><span class="pln">bytes</span><span class="pun">)/</span><span class="lit">1024</span><span class="pun">/</span><span class="lit">1024</span> <span class="pun">></span> <span class="lit">10</span> <span class="com">/* Ignore really small tables */</span>
<span class="kwd">ORDER</span> <span class="kwd">BY</span><span class="pln"> SUM</span><span class="pun">(</span><span class="pln">bytes</span><span class="pun">)</span> <span class="kwd">desc</span>