会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
SSL的工作学习问题整理
起的比鸡早,睡的比猫晚
博客园
首页
新随笔
联系
订阅
管理
通过SQL存储过程对SQLSERVER进行配置
/**/
///
<summary>
///
SQL服务器配置
///
</summary>
///
<param name="serverName">
服务器名称
</param>
private
void
SetSQLServerConfiguration(
string
serverName)
{
using
(SqlConnection connection
=
new
SqlConnection(
this
.ConnectionString(serverName)))
{
connection.Open();
/**/
/*
sp_configure (Transact-SQL)
显示或更改当前服务器的全局配置设置。
=================================
* show advanced options 选项show advanced options 选项用来显示
* sp_configure 系统存储过程高级选项。当 show advanced options
* 设置为 1 时,可以使用 sp_configure 列出高级选项。默认值为 0。
* 该设置将立即生效,无需重新启动服务器。
*
*
* 使用 min server memory 和 max server memory 这两个服务器内存
* 选项可以重新配置 Microsoft SQL Server 实例所使用的缓冲池的内存量 (MB)。
* 默认情况下,SQL Server 的内存要求会根据可用系统资源的情况动态地变化。
* min server memory 的默认设置是 0,max server memory 的默认设置是 2147483647。
* 可为 max server memory 指定的最小内存量为 16 兆字节 (MB)。
* RECONFIGURE (Transact-SQL)
* 更新使用 sp_configure 系统存储过程更改的配置选项的当前已配置值
* (sp_configure 结果集中的 config_value 列)。由于有些配置选项需
* 要服务器停止并重新启动才能更新当前运行的值,因此 RECONFIGURE
* 并不总是为已更改的配置值更新当前运行的值(sp_configure 结果集中的 run_value 列)。
==================================
*/
this
.ExecuteSQLCommand(connection,
"
sp_configure 'show advanced options', 1
"
);
this
.ExecuteSQLCommand(connection,
"
RECONFIGURE WITH OVERRIDE
"
);
this
.ExecuteSQLCommand(connection,
"
sp_configure 'min server memory (MB)', 128
"
);
this
.ExecuteSQLCommand(connection,
"
RECONFIGURE WITH OVERRIDE
"
);
}
}
posted on
2009-10-07 21:30
forrestsun
阅读(
149
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部