How do I shrink log files in SQLServer 7.0

  • Hi guys,

    I'm trying to shrink log files in SQL Server 7.0. where I couldn't find an option similar to 2000 or 2005! Please tell me how do I go ahead in Enterprise Manager. Also, tried my hand with DBCC ShrinkFile, but nothing seems to be happening when I run the SQL statement, it just returns the following values:columns "'DbId,FileId,CurrentSize,MinimumSize,UsedPages,EstimatedPages"

    Help me guys!!

    Thanks in advance!

  • I cannot remember if there was an option to shrink files via EM in SQL 7 as I always did it via QA. If there is is I would think its right click the databases then under tasks.

    The result you received from dbcc shrinkfile is the result you will always get. If the file did not shrink it is because the last virtual log file is used (see BOL for info on this)

    to see it it is used run dbcc loginfo(dbname), a value of 2 in the status field means the virtual log is used, so check to see the value in the last row returned.

    You will need to cycle this out, best way is to backup the log, sometimes just running the shrink twice does it.

    the shrinkfile command should look like this

    dbcc shrinkfile(logicallogfilename,size) where size is in MB

    All the above is for info only. If you are ok on disk space don't bother to shrink the log file. If this is a one off shrink because its blown up after a one off job, just shrink it to a size it will need to be to support normal functionality.


  • Thanks for the reply brother!!

    DBCC Loginfo() did return a value 2 in the status field in the last row.

    So I guess, shrinking the TLog is possible only when the active part of the TLog is at the beginning of the log file, whereas here it is at the last!!

    Okie Dokie!! I'll see if I can release space by deleting some temp data.

    Thanks again for your advice!

  • Cobra,

    what do you mean by this?

    Okie Dokie!! I'll see if I can release space by deleting some temp data.

    deleting data in the database itself wont wrap round the log file, you need to actually backup or truncate the log file, then shrink. If you truncate the log take a full backup afterwards.


Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply