开发者

Undo table updates in SQL Server 2008

I updated a table in my SQL Server 2008 by accident, I was updating a table from another by copying cell by cell, but I have overwritten the original table. Is there a way that I can restore my table contents as it was开发者_如何学编程?


This tool says it can do it, a bit pricey though. There is a trial period, maybe that will be long enough to get your data back:

http://www.apexsql.com/sql_tools_log.asp?_kk=log%20explorer&_kt=49fb8026-ca7c-4c5e-bb06-99ee95393472&gclid=CPWP48T3i6ICFY1a2godtTS7UQ


No. If you commited the transaction, the only way to restore the original table is by getting it from your latest backup.


if you have only a backup then restore that to another database and move just the table over (this way no other tables will be affected). If you have also transaction log backups then you can also do a point in time restore


I've heard that there are some tools that might be able to undo certain actions in certain circumstances. Here's a link to an interesting article about how to minimize data loss in these circumstances and it includes links to some tools.

You might want to ask this question at ServerFault as well as some sysadmins might know better.


Check this link. It shows how to restore values using transaction log

https://www.experts-exchange.com/articles/28199/How-to-recover-deleted-rows-in-SQL-Server.html

The article shows how we can recover deleted data if it happens accidently. We can recover deleted rows if we know the time when data is deleted. We can achieve this goal using LSN ( Log Sequence Numbers ). It shows an example of restoring deleted rows by checking the transaction log with LSN values. For updates use 'LOP_MODIFY_ROW'.

After deleting rows check the log using the following query

Select [Current LSN] LSN], [Transaction ID], Operation, Context, AllocUnitName
FROM
fn_dblog(NULL, NULL)
WHERE Operation  = 'LOP_DELETE_ROWS'

Based on the transactionID and number of rows affected, filter the result set. Then use RESTORE DATABASE to restore the values from log.

NOTE: It is best to do this restoration as soon as you realize the accidental modification/deletion. The more the operations happening in a database there is high probability that the transaction log values might get overwritten.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜