Wednesday, October 15, 2008

DBCC Shrinkfile

The code below shrinks the transaction log file to target size specified.

Use AdventureWorks
GO
DBCC Shrinkfile(filename, target_size)

filename is the logical name of the file to shrink
traget_size is the size of the transaction log file in megabytes to be shrunk. For example

Use AdventureWorks
GO
DBCC Shrinkfile(AdventureWorks_Log, 10)

The above code shrinks down the transaction log file named AdventureWorks_Log to 10MB

No comments: