SQL Database is corrupted....... plz help.

By shahtisaipur ·
Respected Sir,

unfortunately hard disk of my system is damaged, now i recovered my database. but it cannot be attached again to SQL management studio 2005.
the error is myfile.mdf is not a primary database file. (SQL server , error 5171)

plz sir help me...

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Corruption in SQL server database can happen due to

by jason31burns In reply to SQL Database is corrupted ...

Any uncertain like virus attack, power failure, hardware issue, OS malfunction, sudden system shutdown, so on. When a SQL server data file (.mdf) is corrupt then DBAs can try several methods to repair and recover data from it.

• Run DBCC CHECKDB: It checks & reports all the error message in errorlog, if there is any problem with the database. Try to analyze & understand the error message logged in the errorlog. Re-run DBCC CHECKDB with the recommended minimum repair option to repair the file.
Detailed information about DBCC CHECKDB is available here:

• Restore from backup: If above command fails to fix the error message the try to restore the database from clean backup.
• 3rd party tool: Try 3rd party Recovery Toolbox for SQL Server to recover data from corrupt mdf file.

Most of the software have demo version that shows the preview of corrupt SQL server data file.

Collapse -

You may Restore your sql data from Database by using:

by ericschweizer In reply to SQL Database is corrupted ...

Open Enterprise Manager, expand your server group and then expand the desired server.

Navigate to the "Databases" folder and right-click on the database you wish to restore.

Hover over "All Tasks" within the pop-up menu and then select the "Restore Database" menu item.

Ensure the "Database" radio button is selected and that the desired database is listed in both the "Restore as database" and the "Show backups of database" drop-down lists.

Select a backup set to restore from the "First backup to restore" and then mark the check boxes up to the date and time you want to restore to.

Click the "OK" button to start the restore process, and then click "OK" again once the process has completed.

Collapse -

Solution of SQL Database corruption and MDF file

by johan.mark25 In reply to SQL Database is corrupted ...

Don't worry SQL Repair Software was specially designed to recover such types of database corrupt file. I have also used this software and I god good result. this software support multiple MDF file recovery options and you can recover keys, triggers, indexes and stored procedures. this software is supported by all SQL Server versions. you can download and run free trial version visit -

Collapse -

Solution to recover Corrupt SQL Database

by cathrinegarcia24 In reply to SQL Database is corrupted ...

As SQL Server database is dominating the enterprise market as the most preferred database management system.But the issue arise that this application is not immune to corruption.Mostly these database get corrupted due to virus attack, power failure etc.
User can go for manual solutions :-
1. Run Hardware diagnose
2. Restore From Backup
3. Run DBCC CHECKDB command
But in most cases above mentioned fails as sometimes backup not maintained or a threat of losing data using DBCC CHECK command terrify the user .
So the best alternative is to use a third party tool for this and for your problem can visit this will provide you the necessary steps.
Thanks & Regards

Collapse -

Resolve form here

by ljburrows471 In reply to SQL Database is corrupted ...
Collapse -

SQL is different from MS Access

by naresh.p1007 In reply to Resolve form here

What I am of the opinion is :

.mdb and .ldb are two different file extensions
SQL and MS Access are two different entities. Thus, the way of handling solutions should be different.

Hope to get a proper solution for the original question.

Collapse -

Informative Video

by daniel.jones.0543 In reply to SQL Database is corrupted ...

I have found an informative video that shows how to fix SQL Server error 5171, must watch from here:

Related Discussions

Related Forums