Table Reorg / DBMS_REDEFINITION [message #659691] |
Fri, 27 January 2017 09:15  |
jesuisantony
Messages: 166 Registered: July 2006 Location: Chennai
|
Senior Member |
|
|
All - I can see a table which can go for a re-org. I found this by comparing NUM_ROWS*AVG_ROW_LEN (DBA_TABLES) with segment_size (DBA_SEGMENTS).
I was able to see there are a list of options to do the re-org (like):
TABLE MOVE
TABLE SHRINK
EXPORT/IMPORT
CTAS
DBMS_REDIFNITION
I would like to know the benefit of using DBMS_REDFINITION for reorg against the other options which would not require downtime. To me it looked like a complex task. We have the option to do the TABLE SHRINK and this does not require a downtime for the table.
However, I am unable to understand the purpose of using DBMS_REDEFINITION for reorg. Can someone help me to understand it? Is it option that a DBA needs to use at some point of time?
Regards,
Antony
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Table Reorg / DBMS_REDEFINITION [message #659824 is a reply to message #659712] |
Tue, 31 January 2017 07:04   |
|
If your application allows downtime go for datapump or exp/imp. If you can afford to have CTAS, you can go for redef which is CTAS internally while you can update table but make sure of datatype limitation. If you analyze the table to have issue around the HWM, go for shrink option.
However, each approach should be driven by Business need.
|
|
|
|
|
|
|
|
|
|
|
Re: Table Reorg / DBMS_REDEFINITION [message #665366 is a reply to message #665363] |
Fri, 01 September 2017 08:22   |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
I agree with John Watson. You can do a shrink while your users are using the messages table. This allows you to do the shrink with NO downtime. Do the following
First find out if Row Movement is turned on in the messages table by using the following query
select row_movement from user_tables where TABLE_NAME = 'MESSAGES';
If it is DISABLED then do all three commands. If it is ENABLED then ONLY do the shrink command
ALTER TABLE MESSAGES ENABLE ROW MOVEMENT;
ALTER TABLE MESSAGES SHRINK SPACE;
ALTER TABLE MESSAGES DISABLE ROW MOVEMENT;
The one downside of turning ROW MOVEMENT on is that the ROWID's of the table will change. However you should NEVER store the ROWID's anyway.
Make sure to test this on your test server first.
[Updated on: Fri, 01 September 2017 08:26] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Table Reorg / DBMS_REDEFINITION [message #665466 is a reply to message #665437] |
Wed, 06 September 2017 10:21  |
jesuisantony
Messages: 166 Registered: July 2006 Location: Chennai
|
Senior Member |
|
|
DBMS_SPACE.SPACE_USAGE shows that 95% of the data size is in FULL BLOCKS section. Other 25% range size is ignorable As well, the TAB$ shows PCTUSED is 40% while we are using ASSM though.
I am doing a comparison between distinct DBMS_ROWID.ROWID_BLOCK_NUMBER and . These sizes are closer to each other.
This makes me conclude that Quote:NUM_ROWS*AVG_ROW_LEN from DBA_TABLES is not an ideal information to compare the segment size.
I don't think there is any corruption with the BITMAPS as the table was newly created as part of the REORG.
|
|
|