如何防止SQL Server LocalDB自动关闭? [英] How to prevent SQL Server LocalDB auto shutdown?

查看:304
本文介绍了如何防止SQL Server LocalDB自动关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SQL Server 2012 Express LocalDB.如果实例没有活动,实例似乎会在10分钟后自动停止.有一种干净的方法可以使实例永久运行吗?

I'm using SQL Server 2012 Express LocalDB. Instances seem to stop automatically after 10 minutes if there is no activity on them. Is there a clean way to keep an instance running forever?

推荐答案

可以通过T-SQL使用'user instance timeout'选项配置超时:

The timeout is configurable via T-SQL with 'user instance timeout' option:

sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'user instance timeout', 5;
GO

超时以分钟表示,最大值为65535.我很确定您需要在设置实例后重新启动它.并且不要尝试将其设置为0,它只会使实例在启动后立即关闭,这将使得很难将值重新设置为有用的:-).

The timeout is expressed in minutes and has a maximum value of 65535. I'm pretty sure you need to restart the instance after setting it. And don't try setting it to 0, it will just make the instance shut down immediately after starting, which will make it hard to set the value back to something useful :-).

来源:此BOL文章包含有关用户实例的其他有用信息也适用于LocalDB实例.

Source: this BOL article containing other useful information on User Instances that are applicable to LocalDB instances as well.

最后的评论

如果您需要始终运行并可以在计算机启动时启动的东西,则可以考虑使用常规的,基于服务的SQL Server Express实例.

If you need something that's always running and starts whenever a computer starts you might just consider using regular, service-based, instance of SQL Server Express.

这篇关于如何防止SQL Server LocalDB自动关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆