Oracle是否会因错误而回滚事务? [英] Does Oracle roll back the transaction on an error?

查看:419
本文介绍了Oracle是否会因错误而回滚事务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是一个愚蠢的问题,但是我在有关事务管理的Oracle概念指南中看到以下内容:

This feels like a dumb question, but I see the following in the Oracle concepts guide on transaction management:

以下任何一项交易结束 发生以下情况:

A transaction ends when any of the following occurs:

用户发出COMMIT或ROLLBACK 没有SAVEPOINT子句的语句.

A user issues a COMMIT or ROLLBACK statement without a SAVEPOINT clause.

用户运行DDL语句,例如 创建,删除,重命名或更改.如果 当前交易包含任何DML 语句,Oracle首先提交 事务,然后运行并提交 DDL语句作为一个新的,单一的 结单交易.

A user runs a DDL statement such as CREATE, DROP, RENAME, or ALTER. If the current transaction contains any DML statements, Oracle first commits the transaction, and then runs and commits the DDL statement as a new, single statement transaction.

用户与Oracle断开连接.这 当前事务已提交.

A user disconnects from Oracle. The current transaction is committed.

用户进程异常终止. 当前交易已滚动 回来.

A user process terminates abnormally. The current transaction is rolled back.

我要解释的最后一点是,如果我发出一个有错误的查询,交易将被回滚吗?

Am I to interpret the last point to mean that if I issue a query that has an error, the transaction will get rolled back?

推荐答案

在此上下文中,用户进程"是指在客户端计算机上运行的,与Oracle建立连接的进程.换句话说,如果您正在使用应用程序A(SQL*Plus,TOAD等)连接到Oracle,则用户进程是SQL*Plus,TOAD等.交易,该​​交易将被回滚.一旦PMON发现客户端已死亡,这就会发生,这可能会花费一些时间-Oracle区分用户进程的失败和不向其发出命令的用户进程的失败并不总是一件容易的事.那一刻.

"User process" in this context is referring to the process running on the client machine that creates the connection to Oracle. In other words, if you are using Application A (SQL*Plus, TOAD, etc.) to connect to Oracle, the user process is SQL*Plus, TOAD, etc. If that user process dies while you were in the middle of a transaction, that transaction will be rolled back. This will happen as soon as PMON discovers that the client has died which may take a bit of time-- it isn't always trivial for Oracle to distinguish the failure of a user process from a user process that just isn't issuing commands at the moment.

这篇关于Oracle是否会因错误而回滚事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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