Solve the stuck problem when oracle executes update


Solve the stuck problem when oracle executes update
 
When developing the project today, in order to test the execution effect of SQL in the project, I used PLSQL Developer to execute it, and continued to type the code without committing, and then when I used PLSQL Developer again, it may be due to network reasons, PLSQL Developer disconnected from the database connection And if it gets stuck, it will be forced to end. After the code was typed, the test was performed. After the project was executed, it had no effect and no response. After debugging, it was found that jdbc did not respond when executing SQL. I asked Mr. Gu to find out the reason. Because there is no commit when PLSQL Developer executes update, oracle locks the record. 
  www.2cto.com  
It can be solved by the following methods: 
Query the locked record 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 locked record 
SQL code  
ALTER system KILL session 'SID,serial#';

Due to similar problems encountered during development, the solution was searched online and can be used, so it is collected.

Guess you like

Origin blog.csdn.net/yangfande362/article/details/18184357