一.什么是事务(Transaction)
Transaction Overview
A database transaction is a larger unit that frames multiple SQL statements. A transaction ensures that the action of the framed statements isatomicwith respect to recovery.
A SQL Modification Statement has limited effect. A given statement can only directly modify the contents of a single table(Referential Integrityeffects may cause indirect modification of other tables.) The upshot is that operations which require modification of several tables must involve multiple modification statements. A classic example is a bank operation that transfers funds from one type of account to another, requiring updates to 2 tables. Transactions provide a way to group these multiple statements in one atomic unit.
In SQL92, there is no BEGIN TRANSACTION statement. A transaction begins with the execution of a SQL-Data statement when there is no current transaction. All subsequent SQL-Data statements until COMMIT or ROLLBACK become part of the transaction. Execution of aCOMMIT StatementorROLLBACK Statementcompletes the current transaction. A subsequent SQL-Data statement starts a new transaction.
In terms of direct effect on the database, it is theSQL Modification Statementsthat are the main consideration since they change data. The total set of changes to the database by the modification statements in a transaction are treated as an atomic unit through the actions of the transaction. The set of changes either:
Is made fully persistent in the database through the action of the COMMIT Statement, or
Has no persis
数据库事务(Transaction)概述
最新推荐文章于 2023-08-22 20:26:33 发布
本文深入探讨数据库事务,介绍了事务的基本概念,强调其原子性、一致性、隔离性和持久性的ACID特性,并阐述了不同数据库系统(如Microsoft、Oracle、SYBASE)的事务管理方式。同时,讨论了事务的一致性问题与并发控制,以及事务处理的类型,包括自动、隐式和用户定义的事务,并提到了分布式事务及其对数据库性能的影响。
摘要由CSDN通过智能技术生成