简体   繁体   English

有没有简单的方法可以恢复Azure SQL中误删的记录?

[英]Is there a simple way to recover accidentally deleted records in Azure SQL?

I have an azure sql database and I need to recover data (rows) that were accidentally deleted by a user a few months ago but were only noticed now.我有一个 azure sql 数据库,我需要恢复几个月前被用户意外删除但现在才注意到的数据(行)。 The Point in Time restore's don't go that far back unfortunately.不幸的是,时间点恢复不会 go。

There doesn't seem to be a clear way to do this, everything I've found so far is for mssql instances which this isn't.似乎没有明确的方法可以做到这一点,到目前为止我发现的所有内容都是针对 mssql 实例的,而这不是。

I am not an expert at azure or mssql so I would appreciate dumbed down answers if there possible.我不是 azure 或 mssql 的专家,所以如果可能的话,我将不胜感激。

You can restore to a point in time to another (new) database, the default backup retention is 7 days which will hopefully be enough to find your missing data.您可以恢复到另一个(新)数据库的某个时间点,默认备份保留期为 7 天,希望这足以找到您丢失的数据。

This blog post takes you through the necessary steps. 这篇博文将带您完成必要的步骤。

Depending on how much and how complex the missing data is there are a few ways to get the data back, eg anything from manually recreating the data, exporting via query explorer in the portal from the restored database and creating a script from the export locally, using a tool like visual studio data compare, SSMS, etc.根据丢失数据的数量和复杂程度,有几种方法可以恢复数据,例如手动重新创建数据、通过门户中的查询资源管理器从恢复的数据库导出以及从本地导出创建脚本,使用 visual studio 数据比较、SSMS 等工具。

Edit编辑

So to answer your edit, depending on the recovery model configured for SQL Server, point in time restore is supported as long as you have access to the transaction log for the time in question, this means either in the live logs or a backup of them.因此,要回答您的编辑,取决于为 SQL 服务器配置的恢复 model,只要您有权访问相关时间的事务日志,就支持时间点还原,这意味着在实时日志或它们的备份中. Transaction logs are truncated after being backed up hence if you have backups but not for the time you need then sadly you cannot get access to the lost data.事务日志在备份后会被截断,因此如果您有备份但没有在您需要的时候备份,那么遗憾的是您将无法访问丢失的数据。 Azure SQL databases are managed for you in full recovery mode with backups configured. Azure SQL 数据库以完全恢复模式为您管理,并配置了备份。

You can configure long term retention in Azure SQL as well as a number of days of log backups, this way if your log backups don't go back far enough you at least have a full backup for whatever points in time you configure.您可以在 Azure SQL 中配置长期保留以及多天的日志备份,这样如果您的日志备份不够远 go 您至少可以为您配置的任何时间点进行完整备份。

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

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