Hi All,
One of my databases has .ldf file that is bigger in size than .mdf file. Is it a problem? If yes, what can cause this problem? And how to fix it? I looked at all the other ones and the .ldf files are smaller than .mdf files. Thanks.You probably forgot to change the Recovery Model from FULL to SIMPLE. After you've fixed that, dump the transaction log. From Query Analyzer
ALTER DATABASE myDb SET RECOVERY SIMPLE
GO
BACKUP LOG myDb WITH TRUNCATE_ONLYBe sure to change myDb to your database name.
-PatP|||Thank you.|||...Except doing so will not change the size of the log device.
Right-click on the database and see if you have any LOG (and FULL for that matter) backups done. After confirming that you have, determine what is the business requirement for database recoverability after a failure (1 hour, 6 hours, 24 hours, or "I don't care"), determine the volume of activity against the database (you can use perfmon Transactions/sec counter), and set up a transaction log dump job. Set up an alert to notify you when the space used on the log device exceeds the full size of the data device, and run for a day under this set of settings. Only then you can intelligently say what the actual size of the log should be, and can safely shrink the file to that size.|||...Except doing so will not change the size of the log device.Hmmm... Maybe I mis-read the description of the TRUNCATE_ONLY option in the BOL for BACKUP LOG (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ba-bz_35ww.asp), but it sure looks like it will reduce the size of the device. Empirically, it works as described in BOL for me.
I will agree with you (rdjabarov) that a DBA should not willy-nilly truncate the log or change the logging options. This is definitely something that should be considered before you just blindly hack away.
-PatP
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment