Recover and Restore MDF without LDF

The SQL server MDF file comprises of entire information about company’s database, inclusive of tables, stored procedures, user accounts etc. the file can more or less be considered as a backup of the entire database. Likewise, there is LDF file called as log file backup. During usual database restoration process both MDF and LDF files are restored. Though it is possible to restore MDF without LDF i.e. the logs and get the database tables and stored procedures back for access.

The need to recover MDF without LDF arises in several cases on account of the fact that DBCC REBUILD_LOG does not support repairing the log files. However the utility of recovering db from mdf without ldf makes it simple to get access to corrupt or lost data. One needs to follow the below described steps to accomplish this task-

  • From Start button – go to programs and choose SQL server and then SQL Server management studio, which is the primary component of the application responsible for coordinating different aspects of the database.

  • From windows left corner select the database name and after right clicking the database server name and choose ‘new query’ option. This is where using one of the stored procedure mdf restore can be done.

  • For this following command has to be entered in console –

sp_attach_single_file_db @dbname =’database_name’, @physname =’mdf_location’   Where, database name refers for the name for the database to used after being restored Mdf_location stands for server hard drive location where mdf is stored and it is to be full path file location

Now, with F5 key execute the SQL stored procedure and very after this database will be restored to your server and you can check this out be refreshing the console and finding your name in list of database server name.

However failure of the very attempt to restore mdf without ldf in the way described or if could not be made possible completely or appropriately it is suggested trying out other advanced mdf repair process, that makes use of sophisticated algorithms and exhaustive scanning means to fix any issue observed and retrieve database records and information back.