SQLSERVER服务器配置

SQL code
服务器配置选项
--启动AWE
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'awe enable',1--启动AWE选项,用于支持超过4G内存 具体用法见笔记三
go
sp_configure
'show advanced options',0
reconfigure
go

--指定游标集中的行数
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'cursor threshold'--指定游标集中的行数,超过此行数,将异步生成游标键集
go
sp_configure
'show advanced options',0
reconfigure
go
/*配置选项 'show advanced options' 已从 0 更改为 1。请运行 RECONFIGURE 语句进行安装。
name minimum maximum config_value run_value
----------------------------------- ----------- ----------- ------------ -----------
cursor threshold -1 2147483647 -1 -1

配置选项 'show advanced options' 已从 1 更改为 0。请运行 RECONFIGURE 语句进行安装。
*/

--指定全文索引列的默认语言值
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'default full-text language'--2052代表简体中文,具体的查询联机丛书
go
sp_configure
'show advanced options',0
reconfigure
go
/*name minimum maximum config_value run_value
----------------------------------- ----------- ----------- ------------ -----------
default full-text language 0 2147483647 2052 2052
*/

--控制是否让触发器返回结果集
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'disallow results from triggers',1--1代表on
go
sp_configure
'disallow results from triggers',0--0代表off
go
sp_configure
'show advanced options',0
reconfigure
go
/*配置选项 'disallow results from triggers' 已从 1 更改为 1。请运行 RECONFIGURE 语句进行安装。
配置选项 'disallow results from triggers' 已从 1 更改为 0。请运行 RECONFIGURE 语句进行安装。
*/

--控制最初为创建索引分配的最大内存量
sp_configure 'index create memory', 4096
GO

--设置可用的锁的最大个数
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'locks'---要设置的话在后面加',数字'
go
sp_configure
'show advanced options',0
reconfigure
go
/*name minimum maximum config_value run_value
----------------------------------- ----------- ----------- ------------ -----------
locks 5000 2147483647 0 0
*/

--设置SQL进程可使用的工作线程数
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'max worker threads'--要设置的话在后面加',数字'
go
sp_configure
'show advanced options',0
reconfigure
go
/*name minimum maximum config_value run_value
----------------------------------- ----------- ----------- ------------ -----------
max worker threads 128 32767 0 0
*/

--指定一个查询在超时前等待所需资源的时间
sp_configure 'query wait',数字
go

--指定在SQL SERVER超时之前远程操作可以持续的时间
sp_configure 'remote query timeout',数字
go

--是否允许运行系统存储过程xp_cmdshell
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'xp_cmdshell',1
reconfigure
go
sp_configure
'show advanced options',0
reconfigure
go

--从运行SQL SERVER实例的本地或远程服务器上控制存储过程的执行
sp_configure 'show advanced options',1
reconfigure
go
sp_configure
'remote access',1 --1表示允许
reconfigure
go
sp_configure
'remote access',0 --0表示禁止
reconfigure
go
sp_configure
'show advanced options',0
reconfigure
go

---更多的查看联机丛书

--启动,暂停和停止本地的SQL SERVER 服务
net start MSSQLSERVER --启动
net pause MSSQLSERVER --暂停
net continue MSSQLSERVER ---继续被停止的服务
net stop MSSQLSERVER --停止


--查询服务器配置选项信息
select * from sys.configurations
go
--得到的结果中
configuration_id --配置选项的唯一ID
name --配置选项的名称
value --配置选项的值
minimum --配置选项的最小值
maximum --配置选项的最大值
value_in_use --配置选项当前使用的运行值
description --配置选项的说明
is_dynamic --等于1时表示需要执行reconfiguration语句才能生效的变量
is_anvanced --等于1时表示需要执行show advanced语句才能生效的变量

--也可以使用sp_configure查询服务器配置选项信息,只是参数有所不同,具体查看联机丛书

原文地址:https://www.cnblogs.com/meslog/p/1648707.html