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
276 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
passing parameter in sql procedure 9 70
Why is the output of this function is like this? 4 47
SQL query with cast 38 67
date diff with Fiscal Calendar 4 86
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…
In this article I will describe the Copy Database Wizard 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.

751 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