SQLTeam.com | Weblogs | Forums

Shrink the log file in a desired size

sql2008

#1

How to shrink log file to desired size? Can you please post the script to do that for sql 2000. My log file is 8gb but less than 0.5gb is being used..i need to shrink the file to 750mb. Could you please help me how can i do this?


#2

you can simply use dbcc shrinkfile (, 750)

keep in mind that you will only shrink log file if you are sure that its not growth by any batch process or regular process. Otherwise it will just growth back to 8Gb as it you see now. Check your index maintenance job as most likely that might be the one that cause the growth of log.


#3

Remember to do a log backup/database backup before any attempt at shrinking.

Also is this SQL Server 2008 or SQL Server 2000 as stated in the question?


#4

USE [your_db_name]

DBCC SHRINKFILE( 2, 750 )