Question of the Week – DESTINI Profiler: How do I delete and recreate a new database transaction log file using Management Studio?

Questions of the Week are asked and answered in the Beck Technology Community. Anyone is encouraged to join the community to discover additional tips and tricks.

How do I delete and recreate a new database transaction log file using Management Studio?

This answer is provided by Mourace Black, Technical Solutions Analyst, posted on our Community as well as below.

When a database log file gets too large, it will impact the performance of the database and may affect backing-up/restoring or copying that databse in DataManager. When issues like this happens we can recreate a new log file by deleting  the old one creating a new one.

Before that is done the database should be backed up and saved.

Follow the steps below to recreate a new log file:

1. Select the database that have the large log file, right click > Task > Detatch

 

2. If there are no active connections to the database, then click OK.

 

3. Next right click the Database folder > Attach

 

4. Next click Add to attach the database file

 

5. Navigate to the folder where the database .mdf file is located and click OK. (the .log file will attaches with the .mdf file)

 

6. Select the log file and then “Remove” it. Next click OK.

 

7. If a new log file didn’t get created, then you can delete it manually after you detach the database. Navigate to the folder on your computer where the database files (mdf and ldf) are located. Select the Log file and delete it. Next repeat steps 3 – 6 and hit OK (only the mdf file will be attached).

 

8. Next check the size of the log file by right click the database > Properties > Files. The newly create log file will be 1(MB)