博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《PowerShell V3——SQL Server 2012数据库自动化运维权威指南》——2.6 修改SQL Server实例配置...
阅读量:7077 次
发布时间:2019-06-28

本文共 2530 字,大约阅读时间需要 8 分钟。

本节书摘来自异步社区出版社《PowerShell V3—SQL Server 2012数据库自动化运维权威指南》一书中的第2章,第2.6节,作者:【加拿大】Donabel Santos,更多章节内容可以访问云栖社区“异步社区”公众号查看。

2.6 修改SQL Server实例配置

本方案讲述如何使用PowerShell修改实例配置设置。

2.6.1 准备

在本方案,你将会:

修改FillFactor到60%

启用SQL Server Agent
设置最小服务器内存到500MB
修改验证方式为Mixed

2.6.2 如何做…

让我们用PowerShell修改一些SQL Server设置。

1.通过“Start | Accessories | Windows PowerShell | Windows PowerShell ISE”打开PowerShell控制台。

2.导入SQLPS模块,创建一个新的SMO服务器对象。

#import SQL Server moduleImport-Module SQLPS –DisableNameChecking#replace this with your instance name$instanceName = "KERRIGAN"$server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server-ArgumentList $instanceName

3.添加如下脚本并运行。

<#run value vs config valueconfig_value," is what the setting has been set to (but may or may not be what SQL Server is actually running now. Some settings don't go into effect until SQL Server has been restarted, or until the RECONFIGURE WITH OVERRIDE option has been run, as appropriate.) And the last column, "run_value," is the value of the setting currently in effect.#>#change FillFactor$server.Configuration.FillFactor.ConfigValue = 60#enable SQL Server Agent extended stored procedures$server.Configuration.AgentXPsEnabled.ConfigValue = 1#change minimum server memory to 500MB; MB is default$server.Configuration.MinServerMemory.ConfigValue = 500$server.Configuration.Alter()#confirm changes$server.Configuration.Properties | Select DisplayName, ConfigValue | Format-Table –AutoSize#change authentication mode$server.Settings.LoginMode[Microsoft.SqlServer.Management.Smo.ServerLoginMode]::Mixed$server.Alter()#confirm changes$server.settings.LoginMode

4.确认修改。

验证fill factor。

(1)打开SSMS。

(2)连接到实例。

(3)右键实例并选择“Proerties”。

(4)打开“Database Settings”,检查“fill factor”是否已经修改。

image

启用SQL Server Agent扩展存储过程的方法是激活SQL Server Agnet。确认SQL Server Agent被启用。

(1)打开SSMS。

(2)连接到实例。

(3)检查你修改的实例的SQL Server Agent是否正在运行。

image

验证Minimum server memory。

(1)打开SSMS。

(2)右键实例选择“Properties”。

(3)打开“Memory”菜单,查看是否修改为你设置的值。

image

验证authentication mode。

(1)打开SSMS。

(2)连接到实例。

(3)右键实例并选择“Properties”。

(4)打开“Security”,检查实例是否设置为“SQL Server and Windows Authentication mode”。

image

2.6.3 如何实现…

根据你需要修改的服务器属性,你需要决定去访问哪些类:Settings、UserOptions或Configuration。

一旦你决定了需要修改的类和属性,可以通过调用Alter方法修改值。

#to make Configuration changes permanent$server.Configuration.Alter()#to make Settings changes permanent$server.Alter()

2.6.4 更多…

当你运行sp_configure时,可以看到像下面的run_value和config_value的结果。

image

run_value和config_value常常容易混淆。Config_value是设置的值。Run_value是SQL Server当前正使用的值。通常,一个新值被设置(config_value),但是直到实例重启才会被SQL Server所使用。

2.6.5 请参阅…

列出SQL Server配置设置方案

转载地址:http://kvjml.baihongyu.com/

你可能感兴趣的文章
access$表在数据库丢失的恢复
查看>>
我的友情链接
查看>>
CentOS7下利用cobbler搭建openstack本地源
查看>>
Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
查看>>
你以为你想出了一种牛X的算法,也许Algorithmia这家算法商店早就有了
查看>>
kali 2.0 安装及初始配置
查看>>
iframe父子页面通讯解决方案
查看>>
Java -- 多线程
查看>>
linux 配置 直接用VIM默认打开文件
查看>>
ftp 500 OOPS: could not bind listening IPv4 socket
查看>>
encodeURI与encodeURIComponent
查看>>
hello koa!
查看>>
Spring核心——全局事件管理
查看>>
java 批处理执行sql
查看>>
Zend server最大化应用程序的性能、扩展性和可用性
查看>>
Mac OSX操作系统安装和配置Zend Server 6教程(4)
查看>>
python进阶学习路线(全)
查看>>
浏览器加载与渲染
查看>>
HTTP常见错误返回代码
查看>>
安装homeassistant+python3.6
查看>>