添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
魁梧的筷子  ·  DDL timeout parameter ...·  2 周前    · 
不要命的茶叶  ·  ORACLE-BASE - ...·  2 周前    · 
时尚的佛珠  ·  mysql DDL ...·  2 月前    · 
彷徨的香菇  ·  数据库>>云数据库 ...·  7 月前    · 
文武双全的圣诞树  ·  地名传说故事·  1 月前    · 
耍酷的沙滩裤  ·  13号线拆分图 - 百度·  2 月前    · 

DDL_LOCK_TIMEOUT : DDL With the WAIT Option

DDL commands require exclusive locks on internal structures. If these locks are not available some commands return with an "ORA-00054: resource busy" error message, which can be especially frustrating when trying to modify objects that are accessed frequently. To get round this Oracle 11g includes the DDL_LOCK_TIMEOUT parameter, which can be set at instance or session level using the ALTER SYSTEM and ALTER SESSION commands respectively.

The DDL_LOCK_TIMEOUT parameter indicates the number of seconds a DDL command should wait for the locks to become available before throwing the resource busy error message. The default value is zero. Create a new table and insert a row, but don't commit the insert.

create table lock_tab ( id number insert into lock_tab values (1);

Leave this session alone and in a new session modify the column. The "ORA-00054" error is returned immediately.

alter table lock_tab modify ( id number not null alter table lock_tab modify ( ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

Set the DDL_LOCK_TIMEOUT at session level to a non-zero value and attempt to modify the column again. The result is the same, but it takes 30 seconds before the error is returned.

alter session set ddl_lock_timeout=30; alter table lock_tab modify ( id number not null alter table lock_tab modify ( ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

If we repeat the ALTER TABLE command and commit the insert in the first session within 30 seconds, the ALTER TABLE will return a successful message.

alter table lock_tab modify ( id number not null Table altered.

For more information see:

  • DDL_LOCK_TIMEOUT
  • DDL_LOCK_TIMEOUT : DDL With the WAIT Option
  • Hope this helps. Regards Tim...

    Back to the Top.