Rollback data

  • I have run the update query in ssms without doing begin transaction.

    Are there any way to rollback the updated data?

  • Do you have a back up of the database?

    _____________________________________________________________________
    Disclaimer - The opinions expressed by the mouth are not necessarily those of the brain

  • prashant-507002 (12/9/2011)


    I have run the update query in ssms without doing begin transaction.

    Are there any way to rollback the updated data?

    If you already ran the statement there is no way except restore database. SSMS has default commit for transactions.

  • prashant-507002 (12/9/2011)


    I have run the update query in ssms without doing begin transaction.

    Are there any way to rollback the updated data?

    Hope it wasn't a production database.


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Are there any session point like oracle database to which we can rollback?

  • To be honest, I'm not sure you'll get the answer you're looking for here (i.e. Do steps x, y and z and you will magically have your original data back).

    As Cadavare said - I sincerely hope it isnt a production system!

    This can only be handled using a combination of regular backups and properly considering what you're doing before you hit F5!

    _____________________________________________________________________
    Disclaimer - The opinions expressed by the mouth are not necessarily those of the brain

  • prashant-507002 (12/9/2011)


    Are there any session point like oracle database to which we can rollback?

    They are there but you have to define them in transactions. It's called save points.

    SAVE TRANSACTION (Transact-SQL)

    http://msdn.microsoft.com/en-us/library/ms188378.aspx

  • Actually this action was done by a developer.

    And i have find out the solution for. Server is live and i can not restore the backup.

  • Restore the backup to a seperate database, identify the rows which were updated incorrectly, and write a query to reverse the action.

    _____________________________________________________________________
    Disclaimer - The opinions expressed by the mouth are not necessarily those of the brain

  • prashant-507002 (12/9/2011)


    Actually this action was done by a developer.

    And i have find out the solution for. Server is live and i can not restore the backup.

    I am sorry but both of you are in serious trouble... 🙁

  • I think your only option is restore most recent backup to a different database, and then extract the lost data from the restored backup and re-insert it to the original database.

    Or if you are in full recovery model investigate one of the commercial log readers to rescue what you deleted from the logs - if you are in simple recovery this is not an option.

    Good luck

    Mike

  • TedT (12/9/2011)


    Restore the backup to a seperate database, identify the rows which were updated incorrectly, and write a query to reverse the action.

    Restore means FULL + Diff (if any) + Logs (Point-in-Time before the update command)

  • Are there any tools available to rollback data?

  • Before you worry anout tools what recovery model is the db in?

    Redgate do one - http://www.red-gate.com/products/dba/sql-log-rescue/

    I have not used it personally but have heard good reports

    Mike

  • There are various things you can do to monitor what is happening on your database, and give yourself enough information to roll back mistakes.

    Try looking into:

    Change Data Capture (CDC) http://msdn.microsoft.com/en-us/library/bb522489.aspx

    Using triggers for auditing:http://www.codeproject.com/KB/aspnet/ImplementingAudit.aspx

    _____________________________________________________________________
    Disclaimer - The opinions expressed by the mouth are not necessarily those of the brain

Viewing 15 posts - 1 through 15 (of 58 total)

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