undo query in sql server

  • Please i need help !!!!!!

    I runned a query in query analizer and then i realised that i updated the wrong table,

    Can I undo the query ? all i have is tha database and the transaction file, but no backup before the query.

    Thanks

  • Do you have a full back up some time before the problem? Do you have full transaction log backup upto the current transaction log?

    If you have, you can back up the transaction log first.

    restore the full back of db first;

    Apply differential backup after that if you have any

    Applly all transaction log backups except the last one WITH NO RECOVERY

    Applly the last trasanction log STOP AT the time you made the mistake

    (Check the restore syntax in BOL)

     

  • That restores the entire database to that point in time. If there are other transactions in other tables after the error that you still want, you'll have to take a few extra steps.

    Perhaps you should do the restore to a different DB.   Restore to "LiveDBName_09232005"  Then restore the logs to that. When finished, you can get the data you need and copy it to your live DB.

  • Thanks for your help but i didn't have a backup.

    Do you know a job vacancy? thanks

  • What is the recovery model of the database? If simple there's probably nothing you can do to get the situation right because the log gets truncated on every checkpoint so undo data won't be present in the log. If full or bulk_logged  you could use a third-party tool such as Log Explorer from Lumigent to generate undo data - under one condition - that log hasn't been truncated manually. I think it's worth trying.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply