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
254 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
  • 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now