Manage LOB Segment in Oracle Database

Check the table having LOB segment in the Oracle Database

set pagesize 200
set lines 200
set long 999
col owner for a15
col table_name for a20
col column_name for a21
select a.owner,a.table_name,a.column_name, data_type
from dba_lobs a, dba_tab_columns b
where a.column_name=b.column_name
and a.table_name = b.table_name
and a.owner = b.owner
and b.owner not in ('SYS','SYSTEM','DBSNMP','WMSYS','XDB','AUDSYS','MDSYS');

Check Space usage by LOB column

SELECT s.bytes FROM dba_segments s JOIN dba_lobs l USING (owner, segment_name)
WHERE l.table_name = '&table_name';

Check actual space used by LOB

SELECT nvl((sum(dbms_lob.getlength( &lob_column ))),0) AS bytes FROM &table_name;

Move LOB segment to another tablespace

-- Find the lob segment details
select table_name,COLUMN_NAME,SEGMENT_NAME,TABLESPACE_NAME from dba_lobs where
OWNER='HR';
-- Move to new tablespace
alter table HR.DOCUMENT move lob (PROOF) store as SYS_LOB0000100201C00011$$ ( tablespace USERS);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.