Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to shrink SQL logs manually.  (Read 3149 times)

0 Members and 1 Guest are viewing this topic.

lathu_official

  • Guest
How to shrink SQL logs manually.
« on: January 04, 2014, 02:05:43 pm »
To check exactly how much space the logs are taking up you can run the following SQL cmd:

SELECT * FROM <database>.sys.sysfiles


Or you could just as easily right-click the database and check file sizes from there.


To fix this I simply changed the recovery mode from FULL to Simple for the databases, but without a backup of the databases themselves the logs wouldn’t truncate.  Doing a backup from the right-click menu won’t truncate them either.  Since I wasn’t really worried about backing up the database itself I could just force SQL Server to truncate the logs.  I ran the following command to shrink the log file:

DBCC SHRINKFILE('<database_log>')

With <database_log> being the name of the database log file you want to shrink.  That solves that problem.With <database_log> being the name of the database log file you want to shrink.  That solves that problem.

---------
Thanks..