Sunday, January 6, 2013

DDL Lock timeout in Oracle 11.1 and above.

If you need to run DDL command (for example modify column size) for highly used (modified) table.  It could be difficult to get DDL command throught. To easier this in Oracle 11.1 and above you can use following command to set time which DDL command will wait to get lock in the table:
alter session set ddl_lock_timeout=<seconds_that_DDL_will_wait>;
for example set DDL to wait 60 seconds to get the lock in the table:
SQL> alter session set ddl_lock_timeout=60;

After this you can run DDL command to make table modification and DDL command will wait for 60 seconds to get table lock to make it changes. If it does not get table lock for that time it will give error. 

NOTE! Default value for ddl_lock_timeout is 0 (NOWAIT).
So it gives error straight if it does not get lock in the tables.

No comments:

Post a Comment