Oracle 11G的DDL_LOCK_TIMEOUT参数
浏览:1948次 出处信息
今天kaums给客户做培训11g新特性,发现还真的有不少挺好的新东西,但是以前没有怎么去关注的他们,在后续的几篇中,陆续整理处理.
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_lock_timeout参数
SQL> select * from v$version; BANNER --------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production PL/SQL Release 11.2.0.3.0 - Production CORE 11.2.0.3.0 Production TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production SQL> show parameter ddl_lock_timeout; NAME TYPE VALUE ------------------------------------ ---------- -------------- ddl_lock_timeout integer 0
ddl_lock_timeout默认值测试(同以前版本)
--会话1 SQL> set time on 10:27:57 SQL> create table t_xifenfei as 10:28:05 2 select * from dba_users; Table created. Elapsed: 00:00:00.08 10:28:17 SQL> delete from t_xifenfei where username=\'CHF\'; 1 row deleted. --会话2 SQL> set timing on SQL> ALTER TABLE T_XIFENFEI DROP COLUMN AUTHENTICATION_TYPE; ALTER TABLE T_XIFENFEI DROP COLUMN AUTHENTICATION_TYPE * ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired Elapsed: 00:00:00.01
设置ddl_lock_timeout超时测试
--会话1 10:28:17 SQL> delete from t_xifenfei where username=\'CHF\'; 1 row deleted. --会话2 SQL> ALTER SESSION SET ddl_lock_timeout=10; Session altered. Elapsed: 00:00:00.00 SQL> ALTER TABLE T_XIFENFEI DROP COLUMN AUTHENTICATION_TYPE; ALTER TABLE T_XIFENFEI DROP COLUMN AUTHENTICATION_TYPE * ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired Elapsed: 00:00:10.01
设置ddl_lock_timeout未超时测试
--会话2 SQL> ALTER SESSION SET ddl_lock_timeout=30; Session altered. Elapsed: 00:00:00.00 --会话1 10:30:00 SQL> COMMIT; Commit complete. Elapsed: 00:00:00.00 --会话2 SQL> ALTER TABLE T_XIFENFEI DROP COLUMN AUTHENTICATION_TYPE; Table altered. Elapsed: 00:00:07.91
在以前的版本中ddl操作是nowait等待,通过实验可以发现ddl_lock_timeout可以在一定程度上解决因为我们不清楚这个表是否有dml操作而导致ddl操作不能进行的情况,从一定程度上减少了自己去尝试ddl操作,或者查询相关视图然后找出相关会话,然后kill掉对应数据的情况,可以说是在修改表结构的时候一个很不错的新特性.
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
扫一扫订阅我的微信号:IT技术博客大学习
<< 前一篇:oracle列级权限控制
后一篇:为什么不要把用户表存储到SYSTEM表空间 >>
文章信息
- 作者:惜分飞 来源: 惜分飞
- 标签: DDL_LOCK_TIMEOUT
- 发布时间:2012-07-19 14:05:08
近3天十大热文
- [55] 如何拿下简短的域名
- [54] IOS安全–浅谈关于IOS加固的几种方法
- [53] Go Reflect 性能
- [53] Oracle MTS模式下 进程地址与会话信
- [51] android 开发入门
- [49] 图书馆的世界纪录
- [49] 读书笔记-壹百度:百度十年千倍的29条法则
- [46] 【社会化设计】自我(self)部分――欢迎区
- [38] 程序员技术练级攻略
- [31] 视觉调整-设计师 vs. 逻辑