SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Shrinking the model db logfile in sql server 2000


Shrinking the model db logfile in sql server 2000

Author
Message
Jpotucek
Jpotucek
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1640 Visits: 1677
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.



george sibbald
george sibbald
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10710 Visits: 13687
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.

---------------------------------------------------------------------
Jpotucek
Jpotucek
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1640 Visits: 1677
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.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search