数据库事务(Transaction)概述

本文深入探讨数据库事务,介绍了事务的基本概念,强调其原子性、一致性、隔离性和持久性的ACID特性,并阐述了不同数据库系统(如Microsoft、Oracle、SYBASE)的事务管理方式。同时,讨论了事务的一致性问题与并发控制,以及事务处理的类型,包括自动、隐式和用户定义的事务,并提到了分布式事务及其对数据库性能的影响。
摘要由CSDN通过智能技术生成

一.什么是事务(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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值