Help it takes forever to open the SQL Server Log!

Leave a comment

January 24, 2018 by Kenneth Fisher

Just to be very clear, I’m talking about the SQL Server Log, not database logs. Sometimes this is called the Error Log (and in fact the text files containing the data are named ERRORLOG, ERRORLOG.1, etc) although it contains a lot more information than just errors. And just to make things even more nice and confusing the GUI calls it the “SQL Server Logs”.

I did a homework assignment a few months back to read the log. I’m going to assume that you either have done your homework or already know what was involved.

Now if you’ve reviewed the logs (typically because you have a problem, or maybe you actually check them periodically for possible issues) you’ve probably had occasions where it took forever for the information to load into the GUI. There are a couple of reasons for this. The log information is broken out into multiple text files. A new file is created each time the SQL Instance is cycled (re-started). Now imagine how large that file can get when your server has been up for a month? Or 6 months? It can take quite a while to load all of that information into a GUI.

So what’s the solution? Restart SQL Server on a regular basis? Uh, no. That’s a fairly significant step for something like this. The common practice that I’ve seen (I hesitate to call it “best”) is to recycle your log on a daily basis. Just create a job that runs sp_cycle_errorlog on a daily basis.

Now your the log files will contain a manageable amount of information. An added benefit is that if you had a problem on Thursday you can open the log for just that day. There is, however, a fairly important thing to remember here. By default SQL Server only keeps 6 log files! That means if you are cycling your log every day you have less than a week’s worth of information available. You can fix this by telling SQL Server to keep more logs.

You’ll note I have it set to keep 32 files. This way I have at least a months worth of information. It’s probably more than I need, but for my personal box, that’s what I chose. For your company, it’s going to depend on your needs. You can keep up to 99 files but that seems a bit excessive to me. Of course, these files aren’t all that large (usually) so it’s up to you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2,442 other followers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: