Solved

deallocate segment space / reduce ASSM tablespace size

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
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

747 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