Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Shrinking the model db logfile in sql server 2000 Expand / Collapse
Author
Message
Posted Saturday, January 12, 2013 12:22 PM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, July 9, 2014 8:50 AM
Points: 743, Visits: 1,542

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.




Post #1406403
Posted Saturday, January 12, 2013 2:37 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 2:48 PM
Points: 5,976, Visits: 12,887
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.


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

Post #1406417
Posted Saturday, January 12, 2013 4:13 PM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, July 9, 2014 8:50 AM
Points: 743, Visits: 1,542

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.



Post #1406419
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse