Solved

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

Posted on 2009-07-14
7
281 Views
Last Modified: 2012-05-07
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...
0
Comment
Question by:daunavan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24855577
>> So I have a corrupt DB in MS SQL Server 2005.

Do you mean your Database or a database backup. If it is database, then you can repair the database using

DBCC CHECKDB ( ur_db_name , repair_options )

Kindly replace repair_options with any one of the options below
REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD

Kindly note that ALLOW_DATA_LOSS repairs the database by correcting out incorrect records. So you need to be careful on this.

More info below:

http://msdn.microsoft.com/en-us/library/ms176064.aspx

>> 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?

If the database is corrupted and if you have the *.bak files available, then you can delete the current and create the new database right.
Make sure you take a tail backup of existing database (corrupt) so that you wont lose transactions done after you take your backup.

Hope this helps
0
 

Author Comment

by:daunavan
ID: 24855613
I can not run SQL commands on it becuse I can not atttach it to the SQL server. How else can I fix a broken DB that will not connect?
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24855727
If your *.bak file is corrupt, then you have to try out some third party tools like this:

http://www.apexsql.com/sql_tools_recover.asp
http://www.red-gate.com/products/SQL_Log_Rescue/index.htm
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:daunavan
ID: 24855761
OK, the problem is not with the BAK file. I have corrupt MDF / LDF and it will not load so I can not associate it with the SQL server and therefore can not repair it. I was trying to use a new DB, with its same name, and no data, to then load and try to restore the BAK data to it. But this did not work I am at a loss.
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24856572
>> I have corrupt MDF / LDF and it will not load so I can not associate it with the SQL server

Then we can handle it...

1. Try to attach the database without specifying the LDF file. If it attaches then the LDF file is corrupt and you will lose only your uncommitted transactions and no issues with it.

2. If it doesn't attach, then your MDF file is corrupt and you can use some third party tools to repair MDF files so that you can restore your database. Please find below the tool which might help you out.

http://www.repairmdf.com/sql-mdf-repair.php

Kindly note that repairing MDF file may or may not loss some data.
Hope this helps
0
 

Author Closing Comment

by:daunavan
ID: 31603554
rrjegan17 is a saint!!!! You saved my life and my sanity. I can never thank you enough!
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24861435
Welcome and glad to help you out..
Hope your DB is restored, Up and Running now..
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question