DDL_LOCK_TIMEOUT的作用

251 篇文章 6 订阅
237 篇文章 8 订阅

11g的DDL_LOCK_TIMEOUT参数的作用,从字面上看,就是DDL获取锁的超时时间。

先看下官方文档的介绍:

DDL_LOCK_TIMEOUT

Property Description
Parameter type Integer
Default value 0
Modifiable ALTER SESSION
Range of values 0 to 1,000,000 (in seconds)
Basic No

DDL_LOCK_TIMEOUT specifies a time limit for how long DDL statements will wait in a DML lock queue. The default value of zero indicates a status of NOWAIT. The maximum value of 1,000,000 seconds will result in the DDL statement waiting forever to acquire a DML lock.
If a lock is not acquired before the timeout period expires, then an error is returned.


从解释看,很好理解,该参数表示了执行DDL语句时需要等待DML锁的超时时间,默认0表示当无法立即获得DML锁时,会立即抛出NOWAIT,并且支持session级修改。


实验:

SQL> show parameter ddl_lock_timeout

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
ddl_lock_timeout     integer 0

SQL> desc t;

 Name     Null?           Type
 ----------------------------------------- -------- ----------------------------
 TID             NOT NULL NUMBER(38)
 CLS_NAME     NOT NULL VARCHAR2(30)


session1:

SQL> update t set cls_name='a' where tid=1;

0 rows updated.


session2:

SQL> drop table t;

drop table t
           *
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

Elapsed: 00:00:00.00


session2:

SQL> alter session set ddl_lock_timeout = 10;

Session altered.


SQL> drop table t;
drop table t
           *
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

Elapsed: 00:00:10.01

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值