Make IT Complete

Technical Ramblings From an IT Professional

Entries for the ‘SQL Server’ Category

Shrinking a database log file

Sometime, it looks impossible to shrink the Trucated Log file. Following code always shrinks the Trucated Log File to minimum size possible.
This script should allow you to shrink a DB log file.
USE DatabaseName
GO
            DBCC SHRINKFILE(<TransactionLogName>, 1)
    BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
            DBCC SHRINKFILE(<TransactionLogName>, 1)

Can not open Activity Monitor on MSSQL2005

I have been unable to open the Activity Monitor on MSSQL 2005.  I get a message that I do not have privialges or the connection has timed out.  The later is the case as I am an admin on the server.

Shrinking tempdb

From time to time we find that the tempdb database grows to a very large size.  This database should maintain itsself but of course things that should don’t.
Here is the method that I use to shrinl the tempdb when it has grown out of control.
dbcc shrinkdatabase (tempdb, 10)
I often find that I need to run [...]