Purging Space of Table and LOB segment

 Purging Space of Table and LOB segment


Get BIG Segments 

set linesize 190
col owner for a30
col segment_type for a30
col segment_name for a30
col tablespace_name for a30
select owner,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME, bytes/1024/1024/1024 from dba_segments order by bytes asc ;


Get Table Details

set linesize 190
col owner for a30
col table_name for a30
col column_name for a30
select owner,table_name,column_name from dba_lobs where segment_name='Segment_Name';


Create Directory

create or replace directory lob_seg as 'location';


Take backup of Table

expdp 'userid="/ as sysdba" directory=lob_seg dumpfile=log_file_%U.DMP logfile=lob_file_expdp.LOG tables=owner.table_name  parallel=8 filesize=10G metrics=Y exclude=STATISTICS'


Import backup into that Table

impdp  'userid="/ as sysdba" directory=lob_seg dumpfile=log_file_%U.DMP logfile=lob_file_imp.LOG tables=owner.table_name  metrics=Y parallel=8 TABLE_EXISTS_ACTION=TRUNCATE'


Comments