Solved

deallocate segment space / reduce ASSM tablespace size

Posted on 2010-09-15
4
844 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now