7/16/12

Shinking transactionlogs

Hey friends, I usually get questions and concerns like "how do I shrink this database", "the logfile is so big", "please help me". I got this splendid idea to write this topic when I got a question about shrinking a large database from a friend, so thanks Mostafa. This one is for you.

How do I shrink a database?
DBCC SHRINKDATABASE('databasename', 10)
-- 10 is the amount of percent free space in the database after the shrink operation

How do I shrink a transactionlog?
DBCC SHRINKFILE(2, 10)
-- 2 is the second file of the database, usually the transactionlog
-- 10 is the amount of percent free space in the file after the shrink operation

No comments:

Post a Comment