Solved

deallocate segment space / reduce ASSM tablespace size

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
database upgrade 8 117
Fill Date time Field 12 25
Help with Oracle IF statment 5 27
Migration from sql server to oracle (IF then else condition ) 13 29
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

820 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