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.
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 (https://blog.sqlauthority.com)
4 Comments. Leave new
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.
I have the same question are you able to restore only the data files?