Shrink DB log file

Got frustrated with occupied disk space by SQL Server DB log file (.LDF) which keeps on increasing over period of time and eating of your disk space? Here is the solution:

1

2

3

4

5

6

7

8

--Replace DBNAME below by your database name

BACKUP LOG<strong>DBNAME</strong>

WITH TRUNCATE_ONLY

GO

DBCC SHRINKFILE(2,1,TRUNCATEONLY)

GO

DBCC SHRINKDATABASE(<strong>DBNAME</strong>,0)

GO

Know SQL Table stats??

The metrics for size of table: its record count, amounts of allocated & free space can proved to be interesting sometimes especially when planning any migration or optimization activities. Check this out: