- 最后登录
- 2015-2-10
- 在线时间
- 32 小时
- 威望
- 11
- 金钱
- 188
- 注册时间
- 2012-6-27
- 阅读权限
- 10
- 帖子
- 18
- 精华
- 0
- 积分
- 11
- UID
- 540
|
1#
发表于 2012-7-10 10:22:38
|
查看: 5852 |
回复: 2
测试的内容参考的是 http://www.oracle-base.com/articles/11g/ddl-lock-timeout-11gr1.php
操作系统 RedHat 5
数据库版本
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
会话1 创建表并插入记录,但是不进行提交
SQL> CREATE TABLE lock_tab ( id NUMBER);
Table created.
SQL> INSERT INTO lock_tab VALUES (1);
1 row created.
SQL>
SQL> select * from lock_tab;
ID
----------
1
会话2
SQL> select * from lock_tab;
no rows selected
SQL> alter session set ddl_lock_timeout =10;
Session altered.
SQL> set timing on
SQL> set time on
10:03:37 SQL>
10:03:39 SQL> show parameter ddl_lock
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
ddl_lock_timeout integer 10
10:03:46 SQL>
10:03:56 SQL> ALTER TABLE lock_tab ADD ( description VARCHAR2(50));
会话2 hang 在这里了,并没有出现,
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
这样的错误。
请问一下 是我的环境的参数设置有问题导致没有测试出网页的结果吗?还是原本就是这样
会话的等待事件与锁的请求类型
select sid,username,event from v$session where username is not null;
SID USERNAME EVENT
---------- ------------------------------ ----------------------------------------
1 TEST SQL*Net message from client
33 SYS SQL*Net message from client
41 TEST enq: TX - row lock contention
SQL> select decode(request, 0, 'holder:', 'waiter:') holder,sid,id1, id2,lmode,request,type,ctime,block
2 from v$lock
3 where (id1, id2, type) in
4 (select id1, id2, type from v$lock where request > 0)
5 order by id1, request;
HOLDER SID ID1 ID2 LMODE REQUEST TY CTIME BLOCK
------- ---------- ---------- ---------- ---------- ---------- -- ---------- ----------
holder: 1 524307 639 6 0 TX 1080 1
waiter: 41 524307 639 0 4 TX 888 0 |
|