top

SQLSERVER AUTO_CLOSE选项

SQLSERVER AUTO_CLOSE选项

sql2000技术内幕

AUTO_CLOSE

When this option is set to ON (the default when SQL Server runs on Windows 98), the database is closed and shut down cleanly when the last user of the database exits, thereby freeing any resources. When a user tries to use the database again, it automatically reopens. If the database was shut down cleanly, the database isn't initialized (reopened) until a user tries to use the database the next time SQL Server is restarted. The AUTO_CLOSE option is handy for personal SQL Server databases because it allows you to manage database files as normal files. You can move them, copy them to make backups, or even e-mail them to other users. However, you shouldn't use this option for databases accessed by an application that repeatedly makes and breaks connections to SQL Server. The overhead of closing and reopening the database between each connection will hurt performance.

默认是关闭的

当auto_close选项设置为ON的时候,当最后一个用户退出数据库的时候,数据库就会clean shutdown并关闭,因而释放资源

当一个用户再次尝试使用数据库的时候,数据库会自动重新打开。

如果数据库是clean shutdown的,那么数据库在重新打开的时候reopen不需要重新初始化直到一个用户在下次sqlserver重启的时候尝试使用数据库

auto_close只为sqlserver个人版准备,因为这允许你作为正常文件去管理数据库文件

你能移动数据文件在关闭SQL Server的情况下,使用复制数据文件的方法去备份数据库,或者甚至发电邮去通知其他用户

然而,你的程序重复建立连接和打断连接而使用auto_close选项。关闭和重开数据库连接会造成性能上的下降

 

posted @   桦仔  阅读(1628)  评论(0编辑  收藏  举报
编辑推荐:
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
点击右上角即可分享
微信分享提示