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
A 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:
-
Decrease the savings account.
-
Increase the checking account.
-
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 已经完成一半,处于中间阶段
学习需要持之以恒,循序渐进。如果理解有偏差的,欢迎您的指点!非常感谢!