SQL Server事务,未提交的数据存放在哪里? [英] SQL Server transaction, where is uncommitted data held?

查看:229
本文介绍了SQL Server事务,未提交的数据存放在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与SQL Server中如何处理事务有关.

My question relates to how are transactions dealt with in SQL Server.

可以说我有一个用户定义的事务,其中包含很多数据,在该过程中数据存储在哪里?如果事务成功,它只会提交到数据库文件,但是它事先位于哪里.

Lets say I have a user defined transaction that contains a lot of data, where does that data get stored during that process? Its only committed to the database file if the transaction is successful but where does it reside beforehand.

  • 是否保留在创建事务的程序的内存中
  • 到SQL Server内存过程
  • 是否将其写入数据库的事务日志?
  • 临时文件或其他磁盘位置?

推荐答案

SQL Server使用 ARIES 预写日志记录.有关详细信息,请参见两相锁定将确保补偿操作始终可以自由进行.

SQL Server uses ARIES write-ahead logging. Details are described in How It Works: Bob Dorr's SQL Server I/O Presentation. Write-ahead logging requires every change made tot he data to eb described by a log record so that crash recovery can reconstruct the database. To rollback a transaction all that one has to do is to walk the log backward and generate a compensating action for every record generated by the transaction. This will in effect undo everything done by the transaction. Two phase locking will ensure that the compensating operation is always free to proceed.

另请参见在SQL Server内部事务日志,当然还有 ARIES:一种支持事务恢复的方法使用预写日志记录进行细粒度锁定和部分回滚.

这篇关于SQL Server事务,未提交的数据存放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆