Dear All, Hi. I have a server with the following installed: Windows server 2008 R2 SP1 SQL Server 2008 R2 My production database was mydb The production database files were stored as below : 1 mydb.ndf file was stored at C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mydb.ndf 2 mydb.mdf and mydb.ldf files were stored at D:\myfolder Due to some reasons the Hard disk crashed and I lost my C:\ drive leaving me with only the .mdf and .ldf database files. I have re-installed the Windows server 2008 R2 SP1 and SQL Sever 2008 R2. Now when I try to re-attach mydb, by following method : Right click Databases-Attach-Add, select the .mdf file and click OK I get the following error : Unable to open the physical file C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\mydb.ndf. Operating system error 2: 2The system cannot find the file specified. Microsoft SQL Server, Error : 5120 My Query : How can I recover/restore the database from just .mdf and .ldf files ? I've tried the following : 1 Creating a mydb.ndf file and saving at the same location but SQL server is not able to map it to mydb.mdf. 2 Creating a new mydb and over-writing mydb.mdf and mydb.ldf to the newly created location. Please advice a solution as this recovery is very crucial for me.
Detach you database. Overwrite the mdf and ldf files you've restored from your backup with your files from the D: drive. Reattach the database.
There is no guarantee that this will work or if it works, that your database is in a state where you can continue to work with.
If that doesn't work then there is an option to try to restore database using SQL Server Recovery Toolbox. It is a powerful tool for data recovery. They have a demo version. So you can check it works in your situation or not.
http://www.oemailrecovery.com/sql_repair.html
Stellar Phoenix SQL Server Recovery which recovers the overall existing SQL database objects like Table, Triggers, Stored Procedure, Views, Rules and XML data types also.
To recover corrupt or damaged MDF files, used more reliable software Kernel for SQL Database Recovery Tool. This software recovers all tables, stored procedure, functions, views, rules, triggers and associated Primary Key, Unique keys, data types & all other components. To know more detail click here - http://www.sqlrepair.org/
- Check the logs to find out which database it is failing on exactly
- Open SQL Management Studio. Look for the database name that was referenced in the logs.
- Check to see if it is there, if it is, check to see if it holds any data or tables. If the database is empty, have the customer delete it
- Restart SQL Services
If the above given method fails to fix your error, then you can take the help of MDF Recovery Software to fix your error. For more information about the software and download the demo version, visit: http://www.sqlmdfviewer.org/recovery/
485 views
Usually answered in minutes!
×