Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if oracle gets stuck when executing the update statement?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the oracle implementation of update statements stuck how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian with you to understand.

problem

During development, the program stopped when debug reached a sql statement of update, and then I tried it on plsql and found that plsql had been showing that it was being executed and waited for a long time without any results. But the strange thing is that other select statements can be executed.

Causes and solutions

In fact, only update cannot execute other statements because of the record lock. In oracle, commit is required after the update or insert statements are executed. If the connection is forcibly closed without commit, oracle will lock the submitted record. Because of the transaction added to my java program, I forced the project to be terminated halfway through the debug, which led to no transaction commit, so oracle locked the record of the update entry in the code. It can be solved by the following two steps:

1. First query the locked record

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

two。 And then delete it.

ALTER system KILL session 'SID,serial#' thank you for reading this article carefully. I hope the article "what to do when oracle gets stuck when executing update sentence" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report