Recreate broken Database



  • Here is the scenario - I have a Database that is suffering from Error 824, dbcc checkdb repair_allow_loss has not rectified it and unfortunately the Backups are also corrupt.

    However, I am able to query the individual tables and it spits out Data.

    I do have a Schema only backup of the Database - however when I try to insert into the new DB using a select query from the old DB, it errors because some of the tables have auto-increment rows.

    Ideally, I'd just use SSMS to generate scripts to re-create the Database - but all those functions currently fail because the DB isn't healthy.

    The main thing I care about is getting the Data out of the Tables of the broken DB and into one that is working.

    If someone can advise how to do this for a single Table, then I can loop through all the tables and fix it.



  • To close this out @amtwo 's solution SET IDENTITY_INSERT tab1 ON/OFF was the solution.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2