Oracle Large LOB Segments Report

This script displays the size of large LOB (Large Object) segments in the database. It joins DBA_LOBS and DBA_SEGMENTS to show owner, table, column, segment name, tablespace, and size in MB, helping DBAs identify large LOB storage consumers.

oraclesqlstorage-tablespacesv1.0.0
0 stars0 downloads13 views0 comments
By OracleDba • Created

Code

(29 lines)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- -----------------------------------------------------------------------------------
-- File Name    : https://oracle-base.com/dba/monitoring/large_lob_segments.sql
-- Author       : Tim Hall
-- Description  : Displays size of large LOB segments.
-- Requirements : Access to the DBA views.
-- Call Syntax  : @large_lob_segments (rows)
-- Last Modified: 12/09/2017
-- -----------------------------------------------------------------------------------
SET LINESIZE 500 VERIFY OFF
COLUMN owner FORMAT A30
COLUMN table_name FORMAT A30
COLUMN column_name FORMAT A30
COLUMN segment_name FORMAT A30
COLUMN tablespace_name FORMAT A30
COLUMN size_mb FORMAT 99999999.00

SELECT *
FROM   (SELECT l.owner,
               l.table_name,
               l.column_name,
               l.segment_name,
               l.tablespace_name,
               ROUND(s.bytes/1024/1024,2) size_mb
        FROM   dba_lobs l
               JOIN dba_segments s ON s.owner = l.owner AND s.segment_name = l.segment_name
        ORDER BY 6 DESC)
WHERE  ROWNUM <= &1;

SET VERIFY ON

General Comments(0)

Tip: Click on a line number in the code to add a line-specific comment

No general comments yet. Be the first to comment!