oracle断开连接行为 [英] oracle disconnect behaviour

查看:249
本文介绍了oracle断开连接行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长时间运行后连接断开会怎样?

What will happen if connection is lost during long operation?

例如,有一条select语句需要几分钟才能完成,并且在执行过程中连接会丢失.它会继续执行还是会停止?

For example there is a select statement that takes several minutes to complete and connection is lost during its execution. Will it continue execution or will be stopped?

对于delete语句:客户端断开连接时,它会执行到最后还是被中断?数据将发生什么:它将提交或回滚,需要多长时间?

For a delete statement: will it be executed to its finish or interrupted when client disconnects? What will happen to the data: will it be committed or rolled back, how soon?

对于ddl操作:我运行了很长时间的alter table tbl_name move操作,当客户端失去连接时会发生什么?会继续执行还是会中断?

For a ddl operation: I have a long running alter table tbl_name move operation, what will happen to it when client loses connection? Will continue execution or will be interrupted?

推荐答案

我假设我们在谈论的是类似于客户端应用程序崩溃或网络连接断开的情况,而不是该应用程序正在运行的情况.干净断开连接,因为在事务打开时无法进行干净断开连接,更不用说在语句运行时进行干净断开连接了.

I'm assuming that we're talking about something akin to the client application crashing or the network connection getting dropped rather than a situation where the application is doing a clean disconnect since you cannot do a clean disconnect while a transaction is open let alone while a statement is running.

通常,该语句将在服务器上运行完成(SELECT的完成"是它可以返回客户端请求的第一组行的点,该行可能需要也可能不需要执行该语句完整).然后,服务器将尝试将结果准备就绪的事实传达回客户端.当它没有得到响应时(等待ACK数据包可能要花几分钟时间),它知道客户端进程已死,并开始回滚未提交的事务(释放所有事务).交易持有的锁).如果您在事务中对数据库进行了更改(即完成了插入,更新和/或删除操作),那么回滚所做的更改所需的时间与最初生成更改所需的时间一样长.

In general, the statement will run to completion on the server (where "completion" for a SELECT is the point at which it can return the first set of rows the client requested which may or may not require executing the statement in its entirety). The server will then attempt to communicate the fact that the result is ready back to the client. When it doesn't get a response back (it may take a few minutes to time out waiting for the ACK packet), it knows that the client process is dead and begins the process of rolling back the uncommitted transaction (which releases all the locks held by the transaction). If you have made changes to the database as part of your transaction (i.e. you have done inserts, updates, and/or deletes), it can take as long to roll back the changes as it took to generate the changes in the first place.

这篇关于oracle断开连接行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆