How to undo a delete operation in SQL Server 2005?

后端 未结 6 1586
轮回少年
轮回少年 2020-12-11 10:13

Our Test DB is suddenly missing rows. We want them back.

Is there a way to sift through everything that has happened to the database today? Each SQL statement? I pre

相关标签:
6条回答
  • 2020-12-11 10:51

    You need a third-party tool to do this. The tool has to be able to go into the transaction logs and view the log entries so you can see what happened. I haven't used any of these tools, but I'd try Red Gate's SQL Log Rescue for starters. Give it a try:

    http://www.red-gate.com/products/SQL_Log_Rescue/index.htm

    0 讨论(0)
  • 2020-12-11 10:56

    As stated here

    The SQL Database Recovery Tool Repairs utility also recovers deleted table records from corrupt SQL database. You can restore all your deleted records without affecting the existing table data and original hierarchy. It also allows saving the recovered data in a newly created table, below the original table. This helps in differentiating between recovered deleted records in the new table and original table.

    0 讨论(0)
  • 2020-12-11 10:57

    [late answer but hopefully useful]

    There is a way to recover deleted rows using transaction log but only if you use 3rd party tools and only of your database is in full recovery mode.

    Dell (formerly Quest) has Toad for SQL Server and ApexSQL has ApexSQL Log and ApexSQL Recover that can also read t-log and recover data. Unfortunately Log Rescue from Red Gate can only read logs on SQL Server 2000.

    There is also a way to read t-log using undocumented dbcc log command. See more details here.

    Considering you already have database backups you can restore these in separate database and then use one of many data comparison tools that exist on the market to insert missing data into production database. Of course this can only recover data delete prior to creating a backup.

    0 讨论(0)
  • 2020-12-11 11:04

    You can undo a transaction by using Rollback command in SQL Server. But, you need to know the transaction can be rolledback if the transaction were performed within Begin transaction.

    0 讨论(0)
  • 2020-12-11 11:08

    I'd give ChronicDB a try which has a free version rather than pay for Red Gate

    http://chronicdb.com/blogs/undelete_from_whoops

    0 讨论(0)
  • 2020-12-11 11:16

    You can do this with some of Red Gate's tools, but it costs. Take a look at SQL Log Rescue.

    Otherwise, I'd be tempted to do a restore.

    0 讨论(0)
提交回复
热议问题