zoukankan      html  css  js  c++  java
  • 数据库复习⑩(忍不住 附带数据库题库链接)

    数据库复习⑩

    2016年6月19日

    13:40

    最后一期不再更新。

    感谢大家的支持!!!祝学习进步,考试顺利!!!

    题目链接:http://pan.baidu.com/s/1jIhgHFo

    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.

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

    clip_image002

    4.Transaction State事务的状态

    Active 初始化的状态

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

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

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

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

    clip_image004

    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

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

    clip_image006

    clip_image008

    clip_image010

    clip_image012

    7.Conflict Serializability 可串行化的

    clip_image014

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

    Precedence graph 前驱图

    clip_image016

    Recoverable Schedules可恢复的调度

    clip_image018

    Cascading Rollbacks 级联回滚

    clip_image020

    传送至数据库标签:http://www.cnblogs.com/zpfbuaa/tag/SQL/

  • 相关阅读:
    数据库基本概念
    Python语言特性之5:自省
    Python语言特性之4:类变量和实例变量
    Python语言特性之3:@staticmethod和@classmethod
    Python语言特性之2:元类
    Python语言特性之1:函数参数传递
    基础数学与算法学习
    推荐系统资料
    MySQL相关
    Python科学计算包模块的安装(ubuntu)
  • 原文地址:https://www.cnblogs.com/zpfbuaa/p/5598011.html
Copyright © 2011-2022 走看看