Shrinking the model db logfile in sql server 2000

  • i have a long-neglected sql server 2000 instance and the logfile for the model database has grow out of control.

    the model db was in full recovery mode for who knows how long with no transaction log backups being run against it. the model db database file is under 1MB but the logfile is 160GB.

    Not sure what the best course of action is here..

    a full backup of the model DB is running now but it's just spinning (not finishing).

    should I cancel it and attempt a TLOG backup?

    or shrink the log like this:

    --sp_helpdb to verify log size, FileID and recovery Mode of the log

    sp_helpdb [mydatabase]

    --If necessary, change recovery mode to Simple

    Use [mydatabase]

    alter database [mydatabase] set recovery simple

    --Backup LOG with NO_LOG

    Use [mydatabase]

    BACKUP LOG [mydatabase] WITH NO_LOG

    --Shrink log file

    Use [mydatabase]

    DBCC SHRINKFILE (2)

    --If necessary, change recovery mode back to FULL

    Use [mydatabase]

    alter database [mydatabase] set recovery FULL

    --be sure to perform a FULL database backup when completed

    and then leave put it in simple recovery mode and leave it there?

    any guidance would be appreciated.

  • there would normally not be enough activity against the model database to cause log growth so something is running against the model database that probably should not be, you need to find out what that is.

    If the full backup is still running it suggests the active part of the log is large and that is being backed up as well. I would be tempted to kill the backup and find out what is running against the model database.

    Once you have that tidied up you can switch to simple then back to full or as it is SQL2000 run backup log with truncate_only. you probably want to keep model in full mode as other databases are created from it.

    ---------------------------------------------------------------------

  • Thank you!!!

    The full backup finally finished then I ran a TLOG backup with _nolog and shrunk the logfile - then left the model db in simple mode.

    this old sql server 2000 instance only hosts one legacy app so i'm not worried about any databases being added.

    thanks for your help and guidance.

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

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