Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have corrupt DB and I'm trying to restore its .BAK file to a DB with the same name. 3

Status
Not open for further replies.

safiybasara62

Vendor
Apr 26, 2015
1
SA
OK, So I have a corrupt DB in MS SQL Server 2005. I cant load it, so I cant restore to it. I created a DB with its same name. I am pulling down the most recent .BAK file for the corrupt DB, hoping it will allow me to restore it to the new DB. Is this possible or do I need to do something else? Help...
 
Hi,

I will take a slightly different approach.

Restore the .bak file to a DB with a temp or different name.

Once fully restored, and you can certify that your data is fully restored, delete the corrupt DB and then rename the new DB to the name of the deleted DB.

That has always worked for me.
 
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.

Now you can see the file is not tagged as Suspect.

Some useful links from Internet space:

- great solutions and a lot of users who can share their knowledge about sql databases
Recovery Toolbox for SQL Server - in case any solution cant assist you, you make use of this tool
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top