5

I have a production DB in SQL server and wanted to put the final touches after the functionality is completed. prior to shipping it out i want to make sure i have some clean up in the SQL server DB and truncate and shrink log files?

can i have a nightly job run to truncate logs and shrink files?

this is what i have so far: MY RECOVERY MODEL IS SIMPLE

ALTER proc [dbo].[UTIL_ShrinkDB_TruncateLog] as

-- exec sp_helpfile BACKUP LOG PMIS WITH TRUNCATE_ONLY

DBCC SHRINKFILE (PMIS, 1)

DBCC SHRINKFILE (PMIS, 1)

13
  1. Don't truncate or shrink your log files.
  2. See point 1

Why do you think this is a good idea?

With simple recovery, the internal log entries are removed periodically (ready to be reused) but the file requires no more processing.

The log file is the size it is because of your day to day activities. If you shrink the log file you'll end up with poor performance.

  • 3
    Also read: sqlskills.com/blogs/paul/post/… – Eric Humphrey - lotsahelp Feb 28 '11 at 19:05
  • @Eric Humphrey: Thanks, I was poking around there earlier for some reference material but didn't see this one. – gbn Feb 28 '11 at 19:06
  • this doesn't help me understand how to keep my log file for a DB in check and from growing or being out of control. – kacalapy Mar 1 '11 at 16:52
  • @kacalapy: your log file should not be growing if recovery model is simple. if it is, let it grow for a while to let it find it's natural size. If it keeps growing you have a problem, say with open transactions – gbn Mar 1 '11 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.