Solved

deallocate segment space / reduce ASSM tablespace size

Posted on 2010-09-15
4
864 Views
Last Modified: 2013-12-18
Hi.

I created a tablespace as ASSM and LMT with 16 M extent size. All segments are now created with 16M size  and made the tablespace size too big. It is right now around 3GB.

I later found that most of these segments have almost 80% unused blocks, Queries shown below.

Can you suggest what is the best way to reclaim space for this tablespace?  Looks like the only solution is to re-create the tablespace. Your answers will help.



set serveroutput on

declare
TOTAL_BLOCKS number;
TOTAL_BYTES number;
UNUSED_BLOCKS number;
UNUSED_BYTES number;
LAST_USED_EXTENT_FILE_ID number;
LAST_USED_EXTENT_BLOCK_ID number;
LAST_USED_BLOCK number;

begin
dbms_space.unused_space(
'ADMIN',
'JOB_DETAILS',
'TABLE',
TOTAL_BLOCKS,
TOTAL_BYTES,
UNUSED_BLOCKS,
UNUSED_BYTES,
LAST_USED_EXTENT_FILE_ID,
LAST_USED_EXTENT_BLOCK_ID,
LAST_USED_BLOCK);

dbms_output.put_line('OBJECT_NAME = FREELIST_T');
dbms_output.put_line('-----------------------------------');
dbms_output.put_line('TOTAL_BLOCKS = '||TOTAL_BLOCKS);
dbms_output.put_line('TOTAL_BYTES = '||TOTAL_BYTES);
dbms_output.put_line('UNUSED_BLOCKS = '||UNUSED_BLOCKS);
dbms_output.put_line('UNUSED BYTES = '||UNUSED_BYTES);
dbms_output.put_line('LAST_USED_EXTENT_FILE_ID = '||LAST_USED_EXTENT_FILE_ID);
dbms_output.put_line('LAST_USED_EXTENT_BLOCK_ID = '||LAST_USED_EXTENT_BLOCK_ID);
dbms_output.put_line('LAST_USED_BLOCK = '||LAST_USED_BLOCK);

end;
/

OBJECT_NAME = FREELIST_T
-----------------------------------
TOTAL_BLOCKS = 2048
TOTAL_BYTES = 16777216
UNUSED_BLOCKS = 1984
UNUSED BYTES = 16252928
LAST_USED_EXTENT_FILE_ID = 7
LAST_USED_EXTENT_BLOCK_ID = 219264
LAST_USED_BLOCK = 64

PL/SQL procedure successfully completed.

Also ran the below command:


ALTER TABLE ADMIN.JOB_DETAILS DEALLOCATE UNUSED

also tried to ALTER TABLE ... SHRINK SPACE command.
0
Comment
Question by:dbguy0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:POracle
ID: 33689873
Is there will be no future insert in this table? If more data going to be inserted in short period of time than I suggest not to go for deallocation as it  going to occupy free space.

Any way you can try this command.

Alter table tab_name deallocate unused keep keep_size;




0
 

Author Comment

by:dbguy0
ID: 33696384
I did that, no change the tablespace segment size is 16 M. I don't think table deallocations & shrinking have any effect on this. The only solution is export importing them into a new tablespace?
0
 
LVL 8

Accepted Solution

by:
POracle earned 250 total points
ID: 33698737
Yes, you are right.
Have to create new tablespace with smaller extent size and move object from older to new tablespace as there is only around single extent is allocated and lots of space free in it.( I don't know about situation in other segments so I assume same for all)

But, when you insert more data free space will be utilize. So if you sure that you are not going to use that space do above exercise.


0
 
LVL 15

Assisted Solution

by:Devinder Singh Virdi
Devinder Singh Virdi earned 250 total points
ID: 33781076
You cannot deallocate extraspace less than initial extents.
You can create another tablespace, and use ALTER TABLE MOVE command.
This will invalidate indexes and views. views are not the problem, but you need to rebuild the indexes.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question