简体   繁体   English

在SQL数据库SNAPSHOT和SQL数据库之间?

[英]Between SQL Database SNAPSHOT and SQL Database?

I'm just wondering what's the difference between a SQL database snapshot and a regular SQL database? 我只是想知道SQL数据库快照和常规SQL数据库之间有什么区别? Can someone out there would like to help me understand the difference between the two? 外面有人可以帮助我了解两者之间的区别吗?

Thanks in advance. 提前致谢。

A snapshot is a read-only copy of another database, made at a point in time. 快照是在某个时间点创建的另一个数据库的只读副本。 Any changes to the original database cause the version of the data when the snapshot was taken to get written to the file used by the snapshot. 对原始数据库的任何更改都会导致在拍摄快照以将其写入快照所使用的文件时,导致数据的版本变化。 Therefore, there's a performance hit involved, but it can be very useful for knowing exactly what your database looked like at some point in the past (when you told the snapshot to be created). 因此,这涉及到性能上的损失,但是对于准确了解数据库在过去的某个时刻(当您告诉要创建快照时)的外观可能非常有用。

It's definitely worth noting that the snapshot contains no data of its own when first created, as it can reference the original database for it, at least until the original database is changed. 绝对值得注意的是,快照在首次创建时不包含其自身的数据,因为它可以为其引用原始数据库,至少在更改原始数据库之前。

When a snapshot is first created, it is an empty shell that delegates all queries (a snapshot is read only) to the original database. 首次创建快照时,它是一个空外壳,将所有查询(快照是只读的)委派给原始数据库。

As changes are made to the original database, the pages involved are copied to the snapshot. 在对原始数据库进行更改时,涉及的页面将复制到快照。 Queries of the snapshot at this point will be performed on a logical database that is the result of layering the pages in the snapshot over those in the original database. 此时将在逻辑数据库上执行快照查询,这是快照中的页面比原始数据库中的页面分层的结果。

The effect is that the snapshot appears to be a complete copy of the original database that was made at the same time as the snapshot was created. 结果是快照看起来像是在创建快照的同时创建的原始数据库的完整副本。

One scenario in which this can be useful is in deploying changes. 一种可能有用的方案是部署更改。 The snapshot can be a very inexpensive form of insurance if something goes wrong. 如果出现问题,快照可以是一种非常便宜的保险形式。 Assuming that only a subset of the pages within the original database were modified during the deployment, only that subset of the pages will need to be copied back from the snapshot to the original database during a restore. 假设在部署过程中仅修改了原始数据库中的一部分页面,则在还原过程中仅需要将该页面的一部分从快照复制回原始数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM