Database recovery after truncate command

  • Hello Friends,

    I got a query from one of my team member’s friend. Here is the scenario :

    SQL server Version : SQL 2005

    Database Recovery Model : Simple

    Issue : Jr. DBA has run a truncate command on a table having 1 mn rows (confused on similar naming convention between production / dev) . After knowing the mistake, he requested for data recovery.

    Unfortunately, the database is quite old, 2 Weeks back.

    Any Ideas ??

    Thanks,

    Chetan

  • Unless the truncate was run in a transaction that has not yet been committed or there's a recent backup to restore, that data is not coming back.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • @Gila

    Truncate command was not in transaction.

  • Then the only way would be to restore the database from backup.

  • This was removed by the editor as SPAM

  • prettsons (2/13/2013)


    If you don't have backup then you can also try third party SQL Database Recovery Software to repair your database. First try software demo version.

    Except that the database wasn't damaged.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Find the most recent backup prior to the truncate.

    Restore the database temporarily with a different name, such as "ProductionDB_20130115Backup" to identify what it is.

    Copy the table from ProductionDB_20130115Backup to ProductionDB.

    When you are confident you no longer need the restored database, delete ProductionDB_20130115Backup.

    Better than nothing I would think.

Viewing 7 posts - 1 through 6 (of 6 total)

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