for update造成的鎖表以及解鎖

2021-10-01 20:36:52 字數 418 閱讀 4756

記錄一次生產由於for update導致無法操作表的情況

當使用select語句查詢表時,後面跟著for update,當沒有commit的話就會造成別人無法操作

select * from aa for update;
針對以上情況,解決方案如下:

select * from v$session t1, v$locked_object t2 where t1.sid = t2.session_id;
1111對應查詢出sid字段值,2222對應查詢出來的serial#字段值

alter system kill session '1111,2222';

for update造成的Oracle鎖表與解鎖

我遇到的情況 當使用select語句查詢表時,後面跟著for update select from table for update當修改表中資料,但是沒有commit就關掉pl sql,下次再開啟,執行帶for update的sql語句,就會卡死 一 鎖表 檢視鎖表程序sql語句 select f...

for update 鎖行和鎖表

錢包扣錢 事務中 事務 select balance from account where id 1 from update 判斷錢包是否大於需要扣除的金額,例如100 update account set balance balance 100 where id 1 提交事務在未提交事務之前,其他...

使用for update卡住鎖表的解決辦法

今天使用select from bd corp for update改了好幾次之後,突然執行n長時間都不行,馬上給用友打 我聽到了 鎖表 兩個字。們在運算元據庫的時候,有時候會由於操作不當引起資料庫表被鎖定,這麼我們經常不知所措,不知怎麼給這些表解鎖,在pl sql developer工具的的選單 ...