How to Recover and Restore Deleted MDF File?

SQL server database records and all objects created with the help of it like that of tables, procedures, views, functions are stored in a MDF file. It is an efficient backup solution that is used to restore a database from Mdf file, all lost and deleted information are recoverable post database crash. more important is the cases in which SQL server is to be transferred to another system. SQL server management studio with which SQL server is distributed is used to recover deleted mdf file, and here you can find information about how to recover deleted mdf file.

Since database record accounts for most critical data and information, recovering it essential and that has to be done in earliest possible time, which otherwise can have adverse impact on working of particular organization.

Following steps explain how to recover and restore database from mdf file

  • Windows ‘start’ button is to be clicked first of all, from there select ‘all programs and then SQL server from the list of ‘SQL server management studio’. With this SQL server client application will be opened.

  • On windows left corner ‘sql server name’ has to be selected and then click the ‘new query on management studio application. Upon this new window will be opened with connection enabled to SQL server.

  • • Now the code as ‘EXEC sp_attach_single_file_db @dbname=’RestoreDatabase’,@physname=n’C:\DBBackup.mdf’
    • GO

  • With this stored procedure ‘sp_attach_single_file_db’ will attach and restore backed up MDF file.

  • At last F5 key is to be pressed such that the command get executed and this may take certain minutes for restoring mdf file, determined by its size.

But, for situations other than this in which no backup is available or is corrupt or incomplete due to any reason, recovery of deleted mdf file is to be done. MS Sql database recovery software completely and very efficiently does this task. Also, being of read only attribute no data overwriting, deletion or changes as such is observed. So, if you have lost mdf files, triggers, procedures, views and functions associated, restore it now.