Home  >  Article  >  Database  >  Oracle 11g R2新增参数:DDL_LOCK_TIMEOUT

Oracle 11g R2新增参数:DDL_LOCK_TIMEOUT

WBOY
WBOYOriginal
2016-06-07 17:05:501183browse

更新一个表时,在提交之前Oracle会在这个表上加上1个TM锁,确保表的结构不会改变。这个时候,如果另一个会话在该表格上执行alter

更新一个表时,在提交之前Oracle会在这个表上加上1个TM锁,确保表的结构不会改变。
这个时候,,如果另一个会话在该表格上执行alter或者drop命令,就会立即得到以下错误信息:

tony@ORA11GR2> drop table t;
drop table t
           *
第 1 行出现错误:
ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效

在Oracle11gR2中,可以设定DDL_LOCK_TIMEOUT参数让DDL等待。
例如在执行DROP TABLE之前,执行
alter session set ddl_lock_timeout=30;
让drop table等待30秒,如果30秒内,另外那个锁定待删除表格的会话提交或者回滚了事务,
这个drop table命令就会得到执行,否则就会在30秒后产生1个ORA-00054:错误。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn