menu
Delete SQL Server Database Transaction Log File - KDataScience
Delete SQL Server Database Transaction Log File - KDataScience
Quick and easy step by step procedure to Delete SQL Server Database Transaction Log File

Delete SQL Server Database Transaction Log File - KDataScience

There are situations when the size of the SQL Server Database Transaction Log (.ldf) file becomes very large, occupying a lot of space on the disk. One way is to shrink database files. But when this method fails and there is hardly any change in the size of the .ldf file, then you go with another method. In this method, we delete the transaction log file and create a new file for the database with minimum size.

 

In this method, first, take a backup of the database and detach the database. Then, we delete the transaction log file and attach the database again. 

 

Given below are the steps to delete SQL Server Database Transaction Logfile: –

 

 

delete SQL Server Database Transaction Logs<img class="aligncenter wp-image-10008 size-full" src="https://www.kdatascience.com/wp-content/uploads/2019/11/delete-SQL-Server-Database-Transaction-Logs.png" alt="delete SQL Server Database Transaction Logs" width="468" height="311" srcset="https://www.kdatascience.com/wp-content/uploads/2019/11/delete-SQL-Server-Database-Transaction-Logs.png 468w, https://www.kdatascience.com/wp-content/uploads/2019/11/delete-SQL-Server-Database-Transaction-Logs-300x199.png 300w" sizes="(max-width: 468px) 100vw, 468px" />

 

 

Right-click on a database. Click on Tasks- BackUp.

 

Delete SQL Server Database Transaction Log File<img class="aligncenter wp-image-9890 size-full" src="https://www.kdatascience.com/wp-content/uploads/2019/11/Backup-the-database.png" alt="Delete SQL Server Database Transaction Log File" width="722" height="721" srcset="https://www.kdatascience.com/wp-content/uploads/2019/11/Backup-the-database.png 722w, https://www.kdatascience.com/wp-content/uploads/2019/11/Backup-the-database-150x150.png 150w, https://www.kdatascience.com/wp-content/uploads/2019/11/Backup-the-database-300x300.png 300w, https://www.kdatascience.com/wp-content/uploads/2019/11/Backup-the-database-100x100.png 100w, https://www.kdatascience.com/wp-content/uploads/2019/11/Backup-the-database-550x550.png 550w" sizes="(max-width: 722px) 100vw, 722px" />

 

 

Right-click on the database and click detach.

 

Delete SQL Server Database Transaction Log File<img class="aligncenter wp-image-9893 size-full" src="https://www.kdatascience.com/wp-content/uploads/2019/11/Detach-the-database.png" alt="Delete SQL Server Database Transaction Log File" width="746" height="557" srcset="https://www.kdatascience.com/wp-content/uploads/2019/11/Detach-the-database.png 746w, https://www.kdatascience.com/wp-content/uploads/2019/11/Detach-the-database-300x224.png 300w" sizes="(max-width: 746px) 100vw, 746px" />

 

 

 

 

Delete SQL Server Database Transaction Log File<img class="aligncenter wp-image-9898 size-full" src="https://www.kdatascience.com/wp-content/uploads/2019/11/Attach-the-database-again.png" alt="Delete SQL Server Database Transaction Log File" width="497" height="438" srcset="https://www.kdatascience.com/wp-content/uploads/2019/11/Attach-the-database-again.png 497w, https://www.kdatascience.com/wp-content/uploads/2019/11/Attach-the-database-again-300x264.png 300w" sizes="(max-width: 497px) 100vw, 497px" />

 

 

In the Attach box, click ADD.

 

Delete SQL Server Database Transaction Log File<img class="aligncenter wp-image-10020 size-full" src="https://www.kdatascience.com/wp-content/uploads/2019/11/Delete-SQL-Server-Database-Transaction-Log-File-1.jpg" alt="Delete SQL Server Database Transaction Log File" width="958" height="757" srcset="https://www.kdatascience.com/wp-content/uploads/2019/11/Delete-SQL-Server-Database-Transaction-Log-File-1.jpg 958w, https://www.kdatascience.com/wp-content/uploads/2019/11/Delete-SQL-Server-Database-Transaction-Log-File-1-300x237.jpg 300w, https://www.kdatascience.com/wp-content/uploads/2019/11/Delete-SQL-Server-Database-Transaction-Log-File-1-768x607.jpg 768w" sizes="(max-width: 958px) 100vw, 958px" />

 

 

This method is helpful to reduce database size effectively by deleting the old large transactional log file and creating a new .ldf file with minimum errors.

Save my name, email, and website in this browser for the next time I comment.

KDataScience Solutions Private Limited 304, Suneja Towar 1, District Center, Janakpuri, New Delhi-110058


Copyright © KDataScience Solutions Pvt. Ltd.
Privacy Policy   |  Terms And Conditions