• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

How to Shrink MSSQL database log files?

T

Traged1

Guest
Customers are complaining that their MSSQL log files are well over 100MB, why is this happening and how can I fix/shrink it safely?
 
Logs should be truncated whenever you perform a full backup of the database. You can also manually truncate them. A script I found to do it a long time ago:

Code:
declare @dbname nvarchar(255)
set @dbname = 'yourdatabasenamehere'
backup log @dbname with truncate_only
DBCC SHRINKDATABASE (@dbname, 0)
 
Thanks I have tried doing a full backup of this database and it did not truncate the log file. How do I execute the above script? Do I save it as some kind of file and then execute it? If so what type of file should I name it?
 
If you run the code in Query Analyser, it should work. Strange that your database logs aren't being truncated during a backup.
 
I know I did it with Enterprise manager right on the server itself, and I made sure that the Option to truncate inactive log etnries was checked.
 
Yep, that worked, thanks. I certainly hope that I don't have to do this manually all the time for each of our 1000+ customers using PLESk for windows.
 
Another solution to avoid database log files grow in time is change the database recovery model to SIMPLE.

This will truncate log at each checkpoint.
 
Yes it appears that the recovery model on the troubled server are all set to full and not Simple, I switched them to simple recover model to solve the problem. Thanks.
 
What I do not understand is why this server is still setting up the databases using the FULL recover model, yet on a new server with PLESK 8.1 same as this server, it sets up the databases using the simple recover model? Also why is the auto close & auto shrink option not being set?
 
Back
Top