Skip to Main Content
  • Questions
  • 24x7 databases that require table cleanup

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, John.

Asked: February 03, 2017 - 1:30 pm UTC

Last updated: February 07, 2017 - 4:21 pm UTC

Version: 11.2

Viewed 1000+ times

You Asked

Good Morning,

If database system always has DML table locks and queries running, how is it ever possible to perform the following table maintenance operations:

- alter table .... move
- alter table ... shrink space
- alter table ... shrink space compact

Oracle Errors out with the following on the "alter table ... move" :
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

And it just hangs there with the shrink space commands.

Thanks,

John

and Connor said...

1)

What is the justification for *doing* the maintenance in the first place. What metric is telling you "I need to reorg this table"

2)

Alter table shrink doesn't just "hang" - its doing work, and it has not locked the table whilst its doing so.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

john cantu, February 06, 2017 - 4:33 pm UTC

1) I just wanted to test all three methods. I suppose that it holds true that a reorg of a table is only really needed when something abnormal has occurred like the table growing significantly from the norm. Does this also hold true with basic LOBs?

2) I just realized the confusion here. A segment shrink cascade will not be affected by any uncommitted tranx on a table. However, when a shrink is done on a LOB like so:

alter table <> modify lob(col) (shrink space COMPACT);

The session waits on "enq: TX - row lock content" unlike when performing on the table segment which isn't affected by other session's uncommitted tranx.

Thanks,

John
Connor McDonald
February 07, 2017 - 4:21 pm UTC

Thanks for getting back to us. Good info on the lob too.

dbms_redefinition

Jeff, February 07, 2017 - 10:18 pm UTC

If you really need to do table maintenance on a running system, investigate the dbms_redefinition utility package.