简体   繁体   English

从SQL Server备份文件中删除记录

[英]Delete records from SQL Server backup file

It is an insane idea to delete records from backup since the notion of backup is to serve on disaster. 从备份中删除记录是一个疯狂的想法,因为备份的概念是为灾难服务的。 But in our case, data deletion is a valid use-case. 但是在我们的例子中,数据删除是一个有效的用例。

Requirement: in brief, we are in need of a system which is capable of deleting a specific record from an active database instance and from all its backups. 要求:简而言之,我们需要一个能够从活动数据库实例及其所有备份中删除特定记录的系统。

We have a fully functional internal system which is capable of performing the mentioned requirement of deleting data from active database. 我们有一个功能齐全的内部系统,能够执行上述从活动数据库中删除数据的要求。 But what we don't know is how to do the same agonist all these database backups. 但是我们不知道如何对所有这些数据库备份执行相同的激动剂。

Question: 题:

  • Is it possible to find a specific record from a backup? 是否可以从备份中找到特定记录?
  • Is there any predefined schema or data allocation style within SQL Server backup file, which allow us to isolate a specific record? SQL Server备份文件中是否有任何预定义的架构或数据分配样式,可用来隔离特定记录?
  • Can you share any thoughts or experience you have on such style of deletion? 您可以分享您对这种删除样式的想法或经验吗?

Note: we take 2 full backup daily and store a week worth (14 in total) at any point in time. 注意:我们每天进行2次完整备份,并在任何时间存储一个星期(总共14次)。

I do understand the business concept of "deleted everywhere". 我确实了解“到处删除”的业务概念。

I do not know of any way to do this. 我不知道有什么办法。 I do not believe the format of the backup is even published. 我不相信备份的格式甚至不会发布。 That doesn't mean that someone hasn't hacked it, but it certainly isn't a broadly known capability. 这并不意味着没有人破解它,但是它当然不是一种广为人知的功能。

I think that, in order to do this, you will need to securely wipe all copies of backups and take new backups. 我认为,为此,您将需要安全地擦除所有备份副本并进行新备份。 You then lose the point in time recovery capability. 然后,您将失去时间点恢复功能。

Solution : The way that I would address this business requirement is to recover each backup, delete the desired record(s), secure wipe the backup media (or destroy the old media and use new media), and then take a new backup of THAT recovered version. 解决方案 :我要解决此业务需求的方法是恢复每个备份,删除所需的记录,安全擦除备份媒体(或销毁旧媒体并使用新媒体),然后进行新的THAT备份恢复的版本。 That will give you a point in time recovery of that data without the specific record(s). 这样可以在没有特定记录的情况下及时恢复该数据。

You can't modify the contents of a .bak file. 您无法修改.bak文件的内容。 You shouldn't want to do that either. 您也不应该这样做。 If you want to restore to a specific point in time you should use the Full recovery model and take differential and log backups instead of just full backups. 如果要还原到特定的时间点,则应使用完全恢复模型,并进行差异备份和日志备份,而不仅仅是完整备份。

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

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