In 10g, if you are trying to make DDL changes on a busy object, you’re met with:
ORA-00054: resource busy and acquire with NOWAIT specified
If you google how to fix this, your told to re-run the transaction, or find out what’s locking the object. If your trying to make schema changes on a live system in a scripted/automated way, you dont want to interfere with production processes and you need to deal with re-running the transaction in an automated way. This is the solution.
- DECLARE resource_busy EXCEPTION;
- PRAGMA EXCEPTION_INIT(resource_busy, -54);
- PROCEDURE try_change IS
- EXECUTE IMMEDIATE 'alter table .....';
- EXCEPTION WHEN resource_busy THEN try_change;