📄 nowait.txt
字号:
ORA-00054 resource busy and acquire with NOWAIT specified
Cause: The NOWAIT keyword forced a return to
the command prompt because a resource was unavailable for
a LOCK TABLE or SELECT FOR UPDATE command.
Action: Try the command after a few minutes or
enter the command without the NOWAIT keyword.
使用NOWAIT将立刻返回一个错误信息,控制权回到用户。
不用NOWAIT,则LOCK住,控制权不会用户直到其它SESSION COMMIT!
--sqlplus1
lock table a in share mode;
--sqlplus2
declare
begin
lock table a in row exclusive mode nowait;
insert into a values ('9');
end;
ERROR 位于第 1 行:
ORA-00054: 资源正忙,要求指定 NOWAIT
ORA-06512: 在line 4
--出现如下err信息,不被lock住。控制立刻返回用户。
declare
begin
--lock table a in row exclusive mode nowait;
insert into a values ('9');
end;
----没err信息,被lock住。
结论:在lock机制中,可以用lock table table名 in .. mode nowait使数据并发冲突
时控制立刻返回用户。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -