Solution to the stuck problem when oracle Plsql executes update or delete

Today, I encountered an execution statement that has not been executed for a long time: delete table XXX where ......, but there is no problem when selecting. It was later discovered that the

There is no commit when select * from XXX for update, and Oracle locks the record.

 

 

It can be solved by: 

Query lock records first 

Sql code  

SELECT s.sid, s.serial# FROM v$locked_object lo, dba_objects ao, v$session s WHERE ao.object_id = lo.object_id AND lo.session_id = s.sid;  

 

then delete the lock record 

Sql code  

ALTER system KILL session 'SID,serial#';

Through the above sql, the problem is finally solved!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325612604&siteId=291194637