Skip to main content

Recover a corrupted MS SQL database

I have not tried this, use with caution.

There is a manual solution to fix this problem, but you need to have Microsoft SQL Server Management Studio for that. If you have it, you need to follow the steps given below:
  • Open Microsoft SQL Server Management Studio on your system.
  • Now click on New Query button.
  • A new query page will be opened. Write the SQL scripts (shown below) on the page:
                    EXEC sp_resetstatus [YourDatabase]; 
                    ALTER DATABASE [YourDatabase] SET EMERGENCY  
                    DBCC checkdb ([YourDatabase]) 
                    ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE 
                    DBCC DATABASE ([YourDatabase], REPAIR_ALLOW_DATA_LOSS) 
                    ALTER DATABASE [YourDatabase] SET MULTI_USER 
  • Now click on Execute.

Obtained from https://semnaitik.wordpress.com/2014/02/22/how-to-repair-corrupted-ms-sql-database-file/

Comments

  1. The above source URL is no longer available. It has been redirected to this new source - http://wordpress.semnaitik.com/2014/02/22/repair-sql-database/

    ReplyDelete

Post a Comment

Popular posts from this blog

Javascript Form Validation

It's real simple. All you need to do is call a javascript function in a html  " onsubmit " in the form tag as a javascript return, like this       <form method="post" action="dosomething.php" onsubmit="return validateForm();"> If the code completes ok, the form is then sent to the page listed in "action" http://www.w3schools.com/js/js_form_validation.asp If the function specified in the onsubmit returns false, then the form is not sent to the page mentioned in action.