Home SQL Server How to truncate a SQL Server Data file

How to truncate a SQL Server Data file


How to truncate a SQL Server Data file.

While working with SQL Server, for some reason your database log file (.ldf file) keeps increasing in size.
to reduce the size of the log file … I just followed the below mentioned steps.

Open Microsoft SQL Server Management Studio
Select and Right click on your database then Select Properties.
Click on Options and Change the recovery model to Simple.
Click OK. as per the image – 1

Image – 1

Right click on the selected database for which you are trying to reduce the log file size.
Select Tasks > Shrink > Database.
Click OK. as per image – 2

Image – 2

You are now in Shrink Database page and Here you can see Database name and Database size
Currently allocated space must be in GB’s and available free space must be 1%.
in the image – 3 it’s the picture of after shrinking the database log file.

Image – 3

so now click Ok to run execution.. it will take some time depending up on how large is the log file.
once done now click ok and come out of Srink database page.
and change back the recovery model to full.

Right click on the database.
Select Properties.
Click on Options.
Change the recovery model to Full.
Click OK. as per image – 4

Image – 4

You may also like: Failed to connect to MySQL at with user root cannot connect to MySQL server on (10060)



Please enter your comment!
Please enter your name here

Exit mobile version