Oracle 官档 concepts 学习笔记 - 1 介绍部分 事务管理

1 官档原文

链接:Introduction to Oracle Database

Oracle Database is designed as a multiuser database. The database must ensure that multiple users can work concurrently without corrupting one another's data.

Transactions

transaction is a logical, atomic unit of work that contains one or more SQL statements.

An RDBMS must be able to group SQL statements so that they are either all committed, which means they are applied to the database, or all rolled back, which means they are undone.

An illustration of the need for transactions is a funds transfer from a savings account to a checking account. The transfer consists of the following separate operations:

  1. Decrease the savings account.

  2. Increase the checking account.

  3. Record the transaction in the transaction journal.

Oracle Database guarantees that all three operations succeed or fail as a unit. For example, if a hardware failure prevents a statement in the transaction from executing, then the other statements must be rolled back.

Transactions are one feature that set Oracle Database apart from a file system. If you perform an atomic operation that updates several files, and if the system fails checking account, then the files will not be consistent. In contrast, a transaction moves an Oracle database from one consistent state to another. The basic principle of a transaction is "all or nothing": an atomic operation succeeds or fails as a whole.


2 学习笔记

事务管理的初衷是为了在多用户环境并发场景下,维护数据的一致性。

事务是一个逻辑的,由一个或多个SQL组成的原子单元。这里的原子单元的意思是oracle在处理事务中的一组SQL时,要么所有的SQL全部执行成功,提交。要么所有的SQL全部执行失败,回滚,相当于没有做任何操作。

一个示例是在金融行业转账的场景,需要包括如下步骤:

1、转账账户扣款

2、收款账户收到钱

3、在事务日志中记录事务。

Oracle保证这个过程中所有的操作全部完成或者全部失败不做。比如:当一个SQL正在执行,突然发生硬件损坏,这时其它SQL也会被回滚。

事务是把数据库和文件系统分开的机制。当在操作系统层,执行一个原子性操作,修改几个文件,突然系统异常,这时被修改的这几个文件会不一致。相反,事务是把数据库的状态从一种一致性状态移动到另一种一致性状态。

这里基本的原则是一个事务的原子操作作为整体,要么全部执行成功,要么全部失败不做。


3 单词

atomic unit   /əˈtɒmɪk/ 原子单元

illustration   /ˌɪləˈstreɪʃ(ə)n/  示例

saving account 存款账号

checking account 支票账号

halfway through 已经完成一半,处于中间阶段

学习需要持之以恒,循序渐进。如果理解有偏差的,欢迎您的指点!非常感谢!


 

  • 17
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值