星空网 > 软件开发 > 数据库

数据库复习⑩

数据库复习⑩

2016年6月19日

13:40

Main Transactions 事务

1.Transaction Concept 事务的概念

A transaction is a unit of program execution that accesses and possibly updates various data items.

事务是并发控制的单位,是用户定义的一个操作序列。这些操作要么都做,要么都不做,是一个不可分割的工作单位。通过事务,SQL Server能将逻辑相关的一组操作绑定在一起,以便服务器保持数据的完整性。

2.事务的开始以及结束

事务通常是以BEGIN TRANSACTION开始,以COMMIT或ROLLBACK结束。

COMMIT表示提交,即提交事务的所有操作。具体地说就是将事务中所有对数据库的更新写回到磁盘上的物理数据库中去,事务正常结束。

ROLLBACK表示回滚,即在事务运行的过程中发生了某种故障,事务不能继续进行,系统将事务中对数据库的所有以完成的操作全部撤消,滚回到事务开始的状态。

3.ACID Properties事务的特性(ACID特性)

A:原子性(Atomicity)

Either all operations of the transaction are properly reflected in the database or none are

事务是数据库的逻辑工作单位,事务中包括的诸操作要么全做,要么全不做。

B:一致性(Consistency)

Execution of a transaction in isolation preserves the consistency of the database.

事务执行的结果必须是使数据库从一个一致性状态变到另一个一致性状态。一致性与原子性是密切相关的。

C:隔离性(Isolation)

Although multiple transactions may execute concurrently, each transaction must be unaware of other concurrently executing transactions. Intermediate transaction results must be hidden from other concurrently executed transactions.

一个事务的执行不能被其他事务干扰。

D:持续性/永久性(Durability)

After a transaction completes successfully, the changes it has made to the database persist, even if there are system failures.

一个事务一旦提交,它对数据库中数据的改变就应该是永久性的。

数据库复习⑩

4.Transaction State事务的状态

Active 初始化的状态

Partially committed 在最后一条语句被执行前的状态

Failed 正常的运行无法继续处理的状态

Aborted在事务被回滚,数据库中存储的数据状态回退到最原始的状态。

Committed 在成功完成该事务之后的状态

数据库复习⑩

5. Concurrent Executions事务的并发运行

Multiple transactions are allowed to run concurrently in the system. Advantages are:

increased processor and disk utilization

reduced average response time

多个事务允许同时在一个系统下运行,具有以下的优点:

增加处理器和磁盘的利用率

缩短了平均响应时间

6.Schedule 调度表/进度表

Schedule – a sequences of instructions that specify the chronological order in which instructions of concurrent transactions are executed

进度表是有顺序的指令集合,明确了并发调度时并发事务的指令执行的时间顺序。

数据库复习⑩

数据库复习⑩

数据库复习⑩

数据库复习⑩

7.Conflict Serializability 可串行化的

数据库复习⑩

检验是否可以串行化调度的方法:

Precedence graph 前驱图

数据库复习⑩

Recoverable Schedules可恢复的调度

数据库复习⑩

Cascading Rollbacks 级联回滚

数据库复习⑩

相关博文链接:http://www.cnblogs.com/zpfbuaa/p/5479733.html




原标题:数据库复习⑩

关键词:数据库

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

不同类型的卖家应有不同的亚马逊选品思路:https://www.ikjzd.com/articles/108796
新手卖家你是否真正理解“亚马逊爆款”的定义?:https://www.ikjzd.com/articles/108797
亚马逊Q&A里还有多少你不知道的事:https://www.ikjzd.com/articles/108798
内容SEO引流技法指南,零成本提升店铺流量:https://www.ikjzd.com/articles/10880
外贸实用英语大盘点,建议收藏!:https://www.ikjzd.com/articles/108801
外贸实用英语大盘点,建议收藏!:https://www.ikjzd.com/articles/108802
​TikTok发生了什么?美区增长首次停滞,准入管理力度加大:https://www.kjdsnews.com/a/1836407.html
2024年如何找到在TikTok上发帖的最佳时间:https://www.kjdsnews.com/a/1836408.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流