Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Data Management

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « Checking for NULL values in all columns that allow NULLS in all the tablesSQL Server and High Availability »
    comments

    Today I woke up to a little over a hundred emails from one of my database servers letting me know that my resources were jumping around like a kangaroo. Actually, more like a boxing match with one...



    In the mix of those emails I also had alerts thrown stating,

    [database_name_withheld] has a status of Suspect, Cleanly Shutdown


    I actively monitor the state of the database being open or closed (which also shows status of suspect, recovering etc...) I recommend the same so you catch these situations. When I read the emails, I knew exactly what the setting was that had been set to true. "Auto Close"

    Why is this bad? Buck Woody (Blog | Twitter) tells us in his blog, "SQL Server Best Practices: AutoClose Should be Off"

    Basically, in the case of these alerts from my database server, what Buck explained is exactly what happened. This database that was created by some vendor software had the setting of Auto Close on. The software has a service running in the background and would poll for some data every five minutes or so and then close the connection it opened. Yes, that is a good thing that it closes the connections. But, what was happening was the resources on the server were going crazy due to consumption and releasing them every five minutes. Literally over and over again it would do this. This actually caused problems with the other databases and did exactly the opposite as you would think releasing resources would do.

    Luckily Auto Close is on the, "Kill" list and will be gone soon (but not soon enough). In my experience I haven’t found a use for it unless a database is opened once a month. Personally, I don’t have any databases like that but maybe they are really out there.

    Final thought – If you have a database that was recently created and you find Auto Close set to True, change it to False. It is a best practice, won’t hurt anything and will prevent things like this situation from coming up. Now lets see if I can restart this Saturday morning.

    About the Author

    Ted Krueger is a SQL Server MVP and has been working in development and database administration for 13+ years. Specialties range from High Availability and Disaster / Recovery setup and testing methods down to custom assembly development for SQL Server Reporting Services. Ted blogs and is also one of the founders of LessThanDot.com technology community. Some of the articles focused on are Backup / Recovery, Security, SSIS and working on SQL Server and using all of the SQL Server features available to create stable and scalable database services. @onpnt
    Social SitingsTwitterLinkedInLTD RSS Feed
    3963 views
    Instapaper

    7 comments

    Robert L Davis More importantly, how did it get set? Someone must have been dorking around with the database because that's not something that happens on its own.
    06/12/10 @ 08:38
    Comment from: Ted Krueger (onpnt) [Member]
    Ted Krueger (onpnt) Hi Robert, I went as far as doing a test install to the point this software does the DB create. It set it by default on the creation of the database. Not sure why the developers of the company thought that was necessary. Typically just a model setting somehow set on and then they created their DB without noticing the affects.

    Another note: this database server wasn't under my normal policy and now is. This was 100% the DBAs fault (me) on not catching it until it was a performance issue. So the end results, double check when databases are introduced into the servers.
    06/12/10 @ 09:11
    Comment from: SQLDenis [Member] Email
    SQLDenis Ted, do you use Policy-Based Management, if so maybe it would be good to add auto close to it
    06/12/10 @ 09:23
    Comment from: Ted Krueger (onpnt) [Member]
    Ted Krueger (onpnt) Not fully. I'm implementing it with my upgrade to 2008 over this summer. Right now I only have my job server and two others on 2008. prior it was done with my custom scripts (and some powershell). Really a PITA so I'm excited to get policy based management in.
    06/12/10 @ 09:28
    Comment from: Arjan Bakker [Visitor] · http://www.newnerds.com/
    Arjan Bakker I just found out that if you detach a database and then attach it again, in some cases the auto close option is set to true even if it was set to false before detaching it. This is the case on a server on which I installed SQL Server 2008 Express for testing purposes, but on another server with SQL Server 2008 Standard edition everything works fine.
    08/03/10 @ 10:39
    Comment from: Naomi Nosonovsky [Member]
    Naomi Nosonovsky Could be an option to check by SQLCop as well.
    10/07/10 @ 16:11
    Comment from: Ted Krueger (onpnt) [Member]
    Ted Krueger (onpnt) It is a detection in SQLCop
    10/07/10 @ 16:50

    Leave a comment


    Your email address will not be revealed on this site.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)