问题描述
这感觉像是一个愚蠢的问题,但我在 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 是否会在发生错误时回滚事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!