Restore or Attach Database Without Log File – SQL in Sixty Seconds #082

One of the most common question I get on blog is – how do I attach database without log file. I have previously blogged about it over here. I request you to read this blog post if you want a solution where you can learn how to attach database to SQL Server with the help of T-SQL.

Restore or Attach Database Without Log File - SQL in Sixty Seconds #082 82-attachdbwithoutlogfile-800x450

SQL SERVER – Attach mdf file without ldf file in Database

In today’s video blog post we will see how we can attach any database without log file to SQL Server.

I always wondered what is the common scenario when user need to do this particular operation. What would be the reason for attaching an only MDF file and not LDF file to the database? Well, after talking to quite a many users, I figured out there are three primary reasons for it.

  • Lots of people do not know that log file contains important transaction data and it is needed.
  • There are instances where the log file got so big and user never cared for its content and size. When they want to move the database to another instance, they would just want the MDF file to be moved to a different instance.
  • Log file got corrupted due to hardware failure.

Well, it does not matter which reason you are facing. You can always use the method displayed in the quick video to restore your database.

Reference: Pinal Dave (

SQL in Sixty Seconds, SQL Log, SQL Server, SQL Server Management Studio
Previous Post
PostgreSQL – Learn Online in a Single Day – PostgreSQL Learning Path
Next Post
SQL SERVER – Speed Up Performance Without Code Change

Related Posts

4 Comments. Leave new

  • Aaron Olson (@aarondolson)
    September 11, 2016 1:12 am

    What a life saver, will be bookmarking this for future use because it will…happen…again!

  • This title is misleading. It should say ‘how to attach a database without a log file’ and exclude ‘restore or’. I’m looking to restore a database from a backup (.bak) without the transaction log (.trn) file.


Leave a Reply