If you are a database administrator and facing issues while reconnecting log files to MDF files, read this blog. We have shared some easy ways to reconnect the log file to the MDF file.

Methods to Reconnect Log File to MDF File

Here in this blog, I am going to discuss two simple methods to reconnect SQL Log file to MDF database files. The methods are:

Let’s explain both methods separately.

SQL Server Management Studio (SSMS) to Reconnect Log File to MDF File

This is how you can easily reconnect LDF files with the MDF database files.

Reconnect Log File without the Transaction File

Step 1

Specify the DB name and the .MDF file location using the Create Database with Attach option script given below,

USE [master]
Go
CREATE DATABASE [Tester] ON
(FileName = N’C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Tester.mdf’)
For Attach
GO

Step 2

Once the script is executed, a message will display saying a new transaction log file was created.

Thanks!