Avoiding the Autoclose and Autoshrink Options

In the Microsoft SQL Server 2000 Resource Kit, I read about a procedure that checks all databases for options that you should avoid. I understand why I should avoid options such as offline, DBO-use only, statistics off, truncate log on checkpoint, and so on. However, two of the options—autoclose and autoshrink—puzzle me.

Autoclose. Closing a file when it isn't in use sounds like a prudent thing to do. Yet I see files opening and closing all the time in the SQL Server error log, even when I know that I never use the database except for demos. Does viewing a list of databases in Enterprise Manager make the files open? Autoclose makes intuitive sense on databases that I use only occasionally as import staging areas and which I access for only a fraction of the time my online transaction processing (OLTP) database is in use. SQL Server Books Online (BOL) says that autoclose is automatically set to YES for the SQL Server Personal Edition and to NO for all other editions. Has this option been included only for the Personal Edition?

Autoshrink. The autoshrink option also sounds helpful. However, would using autoshrink on my import staging areas, where I bring in quantities of data for short periods of time, keep these areas small for backups?

Autoclose is available on all SQL Server 2000 editions. The amount of memory you save by using this option is relatively small but might be important on memory-constrained systems that use the Personal Edition. However, I wouldn't enable autoclose for the other editions because every time you try to access the database, the query will be slowed by the amount of load time it takes to mount the database. As for the question about your files opening and closing, yes, when you enumerate a database in Enterprise Manager, you access the database.

I don't recommend that you leave on autoshrink for production systems unless you really need to because it might kick in when your system is otherwise busy with production work and slow down the system. However, enabling this option is a good idea for desktop or remote systems that don't get a lot of DBA attention and whose databases could grow out of control before you have time to detect the problem.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottOur Experts will show you:
• Common SQL Server
Problems
• Best Practices for T-SQL
• SQL Server Integration
Services
• Database Development

Come See Michael Otey & Tim Ford in Person!

Early Registration Now Open

From the Blogs
May 21, 2013
blog

A Common Misconception about MAXDOP

Out of the box, SQL Server is (and has been) able to take advantage of multiple processors/cores without any effort on behalf of administrators....More
May 9, 2013
blog

My ISO 8601-Compliant Signature 2

My family recently just "officially" announced that we're in the process of adopting a child from South Africa. We're quite excited, of course, but there's a ton of paperwork to do—along with the need for gobs of signatures....More
May 8, 2013
blog

Use SSIS for ETL from Hadoop

In this blog post, Mark Kromer walks you through using SSIS as a way to use ETL techniques using Microsoft's Hadoop on Windows (HDInsight) as a source using Hive connectors...More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.