SQL 23
Shrink Lob Segment By allan on 22nd October 2025 11:28:32 AM
  1. SET LINES 200
  2. SET pages 1000
  3. COLUMN c1 heading "Owner"  format a15
  4. COLUMN c2 heading "Name"   format a35
  5. COLUMN c3 heading "Type"   format a15
  6. COLUMN c4 heading "MB"      format 99999
  7.  
  8. SELECT
  9.   owner c1,
  10.   segment_name c2,
  11.   segment_type c3,
  12.   (bytes/1024/1024) c4
  13. FROM dba_segments
  14. WHERE tablespace_name='SYSAUX'
  15. AND (bytes/1024/1024) > 50
  16. ORDER BY c4 DESC;
  17.  
  18.  
  19. -- Enable row movement.
  20. EXEC dbms_pdb.exec_as_oracle_script('alter table bccollect.coll_todo enable row movement');
  21.  
  22. -- Recover space and amend the high water mark (HWM).
  23. EXEC dbms_pdb.exec_as_oracle_script('alter table bccollect.coll_todo shrink space');
  24.  
  25. -- Recover space, but don't amend the high water mark (HWM).
  26. EXEC dbms_pdb.exec_as_oracle_script('alter table bccollect.coll_todo shrink space compact');
  27.  
  28. -- Recover space for the object and all dependant objects.
  29. EXEC dbms_pdb.exec_as_oracle_script('alter table bccollect.coll_todo shrink space cascade');

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.