I have not tried this, use with caution.
Obtained from https://semnaitik.wordpress.com/2014/02/22/how-to-repair-corrupted-ms-sql-database-file/
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
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/
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