SQL Server 2012 无人值守安装(添加新实例)

  • 方法1,通过指定条个参数安装

setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /FEAT
URES=SQL,AS,RS,IS,Tools
/INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="MyDomain\MyAccount"
/SQLSVCPASSWORD="************" /SQLSYSADMINACCOUNTS="MyDomain\MyAccount "
/AGTSVCACCOUNT="MyDomain\MyAccount" /AGTSVCPASSWORD="************"
/ASSVCACCOUNT="MyDomain\MyAccount" /ASSVCPASSWORD="************"
/RSSVCACCOUNT="MyDomain\MyAccount" /RSSVCPASSWORD="************"
/ISSVCAccount="MyDomain\MyAccount" /ISSVCPASSWORD="************"
/ASSYSADMINACCOUNTS="MyDomain\MyAccount"

  • 方法2,指定配置文件安装

I:\>Setup.exe /ConfigurationFile="d:\ConfigurationFile.ini"
Microsoft (R) SQL Server 2012 11.00.2100.60
版权所有 (c) Microsoft Corporation。保留所有权利。


用第二种方法安装,

以下是我的配置文件,为sql server 2012 添加名为I01的实例。;是注释,像


; Required to acknowledge acceptance of the license terms.
IACCEPTSQLSERVERLICENSETERMS="True"
注意
;UIMODE="False"

注意
二选一,不然报错
; 安装程序将不会显示任何用户界面。 

QUIET="False"

; 安装程序将只显示进度,而不需要任何用户交互。 

QUIETSIMPLE="True"<

注意; 默认值为 Windows 身份验证。使用 "SQL" 表示采用混合模式身份验证。 

SECURITYMODE="SQL"
SAPWD="1qaz2WSX"

以下是完整文件,

;SQL Server 2012 Configuration File
[OPTIONS]
; Required to acknowledge acceptance of the license terms.
IACCEPTSQLSERVERLICENSETERMS="True"
; 指定安装程序的工作流,如 INSTALL、UNINSTALL 或 UPGRADE。这是必需的参数。 

ACTION="Install"

; 尚未定义命令行参数 ENU 的详细帮助。 

ENU="False"

; 用于控制用户界面行为的参数。有效值对于完整 UI 为 Normal,对于简化的 UI 为 AutoAdvance,为 EnableUIOnServerCore 则跳过 Server Core 安装程序 GUI 块。 

;UIMODE="False"

; 安装程序将不会显示任何用户界面。 

QUIET="False"

; 安装程序将只显示进度,而不需要任何用户交互。 

QUIETSIMPLE="True"

; 指定 SQL Server 安装程序是否应发现和包括产品更新。有效值是 True 和 False 或者 1 和 0。默认情况下,SQL Server 安装程序将包括找到的更新。 

UpdateEnabled="False"

; 指定要安装、卸载或升级的功能。顶级功能列表包括 SQL、AS、RS、IS、MDS 和工具。SQL 功能将安装数据库引擎、复制、全文和 Data Quality Services (DQS)服务器。工具功能将安装管理工具、联机丛书组件、SQL Server Data Tools 和其他共享组件。 

FEATURES=SQLENGINE,REPLICATION,FULLTEXT,DQ

; 指定 SQL Server 安装程序将获取产品更新的位置。有效值为 "MU" (以便搜索产品更新)、有效文件夹路径以及 .\MyUpdates 或 UNC 共享目录之类的相对路径。默认情况下,SQL Server 安装程序将通过 Window Server Update Services 搜索 Microsoft Update 或 Windows Update 服务。 

UpdateSource="MU"

; 显示命令行参数用法 

HELP="False"

; 指定应将详细的安装程序日志传送到控制台。 

INDICATEPROGRESS="False"

; 指定安装程序应该安装到 WOW64 中。IA64 或 32 位系统不支持此命令行参数。 

X86="False"

; 指定共享组件的安装根目录。在已安装共享组件后,此目录保持不变。 

INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"

; 指定 WOW64 共享组件的安装根目录。在已安装 WOW64 共享组件后,此目录保持不变。 

INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server"

; 指定默认实例或命名实例。MSSQLSERVER 是非 Express 版本的默认实例,SQLExpress 则是 Express 版本的默认实例。在安装 SQL Server 数据库引擎(SQL)、Analysis Services (AS)或 Reporting Services (RS)时,此参数是必需的。 

INSTANCENAME="I01"

; 为您已指定的 SQL Server 功能指定实例 ID。SQL Server 目录结构、注册表结构和服务名称将包含 SQL Server 实例的实例 ID。 

INSTANCEID="I01"

; 指定可以收集 SQL Server 功能使用情况数据,并将数据发送到 Microsoft。指定 1 或 True 将启用此功能,指定 0 或 False 将禁用此功能。 

SQMREPORTING="False"

; 指定是否可将错误报告给 Microsoft 以便改进以后的 SQL Server 版本。指定 1 或 True 将启用此功能,指定 0 或 False 将禁用此功能。 

ERRORREPORTING="False"

; 指定安装目录。 

INSTANCEDIR="e:\Program Files\Microsoft SQL Server"

; 代理帐户名 

AGTSVCACCOUNT="NT Service\SQLAgent$I01"

; 安装后自动启动服务。  

AGTSVCSTARTUPTYPE="Manual"

; CM 程序块 TCP 通信端口 

COMMFABRICPORT="0"

; 矩阵如何使用专用网络 

COMMFABRICNETWORKLEVEL="0"

; 如何保护程序块间的通信 

COMMFABRICENCRYPTION="0"

; CM 程序块使用的 TCP 端口 

MATRIXCMBRICKCOMMPORT="0"

; SQL Server 服务的启动类型。 

SQLSVCSTARTUPTYPE="Manual"

; 启用 FILESTREAM 功能的级别(0、1、2 或 3)。 

FILESTREAMLEVEL="0"

; 设置为 "1" 可为 SQL Server Express 启用 RANU。 

ENABLERANU="False"

; 指定要用于数据库引擎的 Windows 排序规则或 SQL 排序规则。 

SQLCOLLATION="Chinese_PRC_CI_AS"

; SQL Server 服务的帐户: 域\用户或系统帐户。 

SQLSVCACCOUNT="NT Service\MSSQL$I01"

; 要设置为 SQL Server 系统管理员的 Windows 帐户。 

SQLSYSADMINACCOUNTS="ADMINISTRATOR"

; 默认值为 Windows 身份验证。使用 "SQL" 表示采用混合模式身份验证。 

SECURITYMODE="SQL"
SAPWD="1qaz2WSX"

; 将当前用户设置为 SQL Server 2012 Express 的数据库引擎系统管理员。 

ADDCURRENTUSERASSQLADMIN="False"

; 指定 0 禁用 TCP/IP 协议,指定 1 则启用该协议。 

TCPENABLED="1"

; 指定 0 禁用 Named Pipes 协议,指定 1 则启用该协议。 

NPENABLED="0"

; Browser 服务的启动类型。 

BROWSERSVCSTARTUPTYPE="Manual"

; 添加输入参数 FTSVCACCOUNT 的描述 

FTSVCACCOUNT="NT Service\MSSQLFDLauncher$I01"
1 挂载镜像

2进入命令行:


 

3运行
I:\>Setup.exe /ConfigurationFile="d:\ConfigurationFile.ini"

4安装完成


如何快捷编写配置文件,通过修改ui安装过程中的向导,生民第一个配置文件,配置保存在下图的路径中,打开并按如下修改它

添加

; Required to acknowledge acceptance of the license terms.
IACCEPTSQLSERVERLICENSETERMS="True"
不显示ui
;UIMODE="False"
注意
二选一,不然报错
; 安装程序将不会显示任何用户界面。 

QUIET="False"

; 安装程序将只显示进度,而不需要任何用户交互。 

QUIETSIMPLE="True"
注意; 默认值为 Windows 身份验证。使用 "SQL" 表示采用混合模式身份验证。 

SECURITYMODE="SQL"
SAPWD="1qaz2WSX"

HELP

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Patrick>I:

I:\>setup.exe /help
Microsoft (R) SQL Server 2012 11.00.2100.60
版权所有 (c) Microsoft Corporation。保留所有权利。

用法:
 setup.exe /[选项]={value} /[选项]={value} ...

 选项:
 ACTION                       指定安装程序的工作流,如 INSTALL、UNINSTALL 或 UPG
RADE。这是必需的参数。
 ADDCURRENTUSERASSQLADMIN     Provision current user as a Database Engine
                              system administrator for SQL Server 2012 Express.
 AGTDOMAINGROUP               Either domain user name or system account
 AGTSVCACCOUNT                Either domain user name or system account
 AGTSVCPASSWORD               Password for domain user name. Not required for
                              system account
 AGTSVCSTARTUPTYPE            Startup type for the SQL Server Agent service.
                              Supported values are Manual, Automatic or
                              Disabled.
 ALLINSTANCES                 指定所有实例都将包括在安装操作中。只有在应用修补程
序时才支持此参数。
 ALLOWUPGRADEFORSSRSSHAREPOIN
                              RSInputSettings_AllowUpgradeForSSRSSharePointMode_
Description
 ASBACKUPDIR                  The location for the Analysis Services backup
                              files.
 ASCOLLATION                  The collation used by Analysis Services.
 ASCONFIGDIR                  The location for the Analysis Services
                              configuration files.
 ASDATADIR                    The location for the Analysis Services data
                              files.
 ASLOGDIR                     The location for the Analysis Services log files.
 ASPROVIDERMSOLAP             Specifies if the MSOLAP provider can run in
                              process.
 ASSERVERMODE                 Specifies the server mode of the Analysis
                              Services instance. Valid values are
                              MULTIDIMENSIONAL and TABULAR. The default value
                              is MULTIDIMENSIONAL.
 ASSVCACCOUNT                 The account used by the Analysis Services
                              service.
 ASSVCPASSWORD                The password for the Analysis Services service
                              account.
 ASSVCSTARTUPTYPE             Controls the service startup type setting for the
                              service.
 ASSYSADMINACCOUNTS           Specifies the list of administrator accounts to
                              provision.
 ASTEMPDIR                    The location for the Analysis Services temporary
                              files.
 BROWSERSVCSTARTUPTYPE        Startup type for Browser Service.
 CLTCTLRNAME                  The computer name that the client communicates
                              with for the Distributed Replay Controller
                              service.
 CLTRESULTDIR                 The result directory for the Distributed Replay
                              Client service.
 CLTSTARTUPTYPE               The startup type for the Distributed Replay
                              Client service.
 CLTSVCACCOUNT                The account used by the Distributed Replay Client
                              service.
 CLTSVCPASSWORD               The password for the Distributed Replay Client
                              service account.
 CLTWORKINGDIR                The working directory for the Distributed Replay
                              Client service.
 CLUSTERPASSIVE               指定 SQL Server 安装程序不应管理 SQL Server 服务。
此选项应该仅在非
                              Microsoft 群集环境中使用。
 COMMFABRICENCRYPTION         MATRIXCOMMMESSAGEPROTECTION {0,1}
 COMMFABRICNETWORKLEVEL       MATRIXCOMMNETWORKISOLATION {0,1}
 COMMFABRICPORT               MATRIXCOMMPORT <port>
 CONFIGURATIONFILE            指定将用于安装程序的配置文件。
 CONFIRMIPDEPENDENCYCHANGE    Indicates that the change in IP address resource
                              dependency type for the SQL Server multi-subnet
                              failover cluster is accepted.
 CTLRSTARTUPTYPE              The startup type for the Distributed Replay
                              Controller service.
 CTLRSVCACCOUNT               The account used by the Distributed Replay
                              Controller service.
 CTLRSVCPASSWORD              The password for the Distributed Replay
                              Controller service account.
 CTLRUSERS                    The Windows account(s) used to grant permission
                              to the Distributed Replay Controller service.
 ENABLERANU                   Set to "1" to enable RANU for SQL Server Express.
 ENU                          尚未定义命令行参数 ENU 的详细帮助。
 ERRORREPORTING               指定是否可将错误报告给 Microsoft 以便改进以后的 SQ
L Server 版本。指定 1
                              或 True 将启用此功能,指定 0 或 False 将禁用此功能
。
 FAILOVERCLUSTERDISKS         Specifies a cluster shared disk to associate with
                              the SQL Server failover cluster instance.
 FAILOVERCLUSTERGROUP         Specifies the name of the cluster group for the
                              SQL Server failover cluster instance.
 FAILOVERCLUSTERIPADDRESSES   Specifies an encoded IP address. The encodings
                              are semicolon-delimited (;), and follow the
                              format <IP Type>;<address>;<network name>;<subnet
                              mask>. Supported IP types include DHCP, IPV4, and
                              IPV6.
 FAILOVERCLUSTERNETWORKNAME   Specifies the name of the SQ LServer failover
                              cluster instance.  This name is the network name
                              that is used to connect to SQL Server services.
 FAILOVERCLUSTERROLLOWNERSHIP Specifies whether the upgraded nodes should take
                              ownership of the failover instance group or not.
                              Use 0 to retain ownership in the legacy nodes, 1
                              to make the upgraded nodes take ownership, or 2
                              to let SQL Server Setup decide when to move
                              ownership.
 FEATURES                     指定要安装、卸载或升级的功能。顶级功能列表包括 SQL
、AS、RS、IS、MDS 和工具。SQL
                              功能将安装数据库引擎、复制、全文和 Data Quality Se
rvices
                              (DQS)服务器。工具功能将安装管理工具、联机丛书组件
、SQL Server Data Tools
                              和其他共享组件。
 FILESTREAMLEVEL              Level to enable FILESTREAM feature at (0, 1, 2 or
                              3).
 FILESTREAMSHARENAME          Name of Windows share to be created for
                              FILESTREAM File I/O.
 FTSVCACCOUNT                 User account for Full-text Filter Daemon Host.
 FTSVCPASSWORD                User password for Full-text Filter Daemon Host
                              account.
 FTUPGRADEOPTION              Full-text catalog upgrade option.
 HELP                         显示命令行参数用法
 IACCEPTSQLSERVERLICENSETERMS 通过指定此参数并接受 SQL Server 许可条款,您确认已
阅读并理解使用条款的内容。
 INDICATEPROGRESS             指定应将详细的安装程序日志传送到控制台。
 INSTALLSHAREDDIR             指定共享组件的安装根目录。在已安装共享组件后,此目
录保持不变。
 INSTALLSHAREDWOWDIR          指定 WOW64 共享组件的安装根目录。在已安装 WOW64 共
享组件后,此目录保持不变。
 INSTALLSQLDATADIR            The Database Engine root data directory.
 INSTANCEDIR                  指定实例根目录。
 INSTANCEID                   为您已指定的 SQL Server 功能指定实例 ID。SQL Serve
r
                              目录结构、注册表结构和服务名称将包含 SQL Server 实
例的实例 ID。
 INSTANCENAME                 指定默认实例或命名实例。MSSQLSERVER 是非 Express
                              版本的默认实例,SQLExpress 则是 Express 版本的默认
实例。在安装 SQL
                              Server 数据库引擎(SQL)、Analysis Services (AS)或
                              Reporting Services (RS)时,此参数是必需的。
 ISSVCACCOUNT                 Either domain user name or system account.
 ISSVCPASSWORD                Password for domain user.
 ISSVCSTARTUPTYPE             Automatic, Manual or Disabled.
 MATRIXCMBRICKCOMMPORT        MATRIXCMBRICKCOMMPORT portNumber
 MATRIXCMSERVERNAME           MATRIXCMSERVERNAME hostName\instanceName
 MATRIXNAME                   MATRIXNAME=<name>
 NPENABLED                    Specify 0 to disable or 1 to enable the Named
                              Pipes protocol.
 PID                          指定 SQL Server 产品密钥以配置您要使用哪个版本。
 QUIET                        安装程序将不会显示任何用户界面。
 QUIETSIMPLE                  安装程序将只显示进度,而不需要任何用户交互。
 ROLE                         尚未定义命令行参数 ROLE 的详细帮助。
 RSCATALOGSERVERINSTANCENAME  The SQL Server server for the report server
                              catalog database.
 RSINSTALLMODE                RSInputSettings_RSInstallMode_Description
 RSSHPINSTALLMODE             RSInputSettings_RSInstallMode_Description
 RSSVCACCOUNT                 Specify the service account of the report server.
                              This value is required. If you omit this value,
                              Setup will use the default built-in account for
                              the current operating system (either
                              NetworkService or LocalSystem). If you specify a
                              domain user account, the domain must be under 254
                              characters and the user name must be under 20
                              characters. The account name cannot contain the
                              following characters:
                              " / \ [ ] : ; | = , + * ? < >
 RSSVCPASSWORD                Specify a strong password for the account. A
                              strong password is at least 8 characters and
                              includes a combination of upper and lower case
                              alphanumeric characters and at least one symbol
                              character. Avoid spelling an actual word or name
                              that might be listed in a dictionary.
 RSSVCSTARTUPTYPE             Specifies the startup mode for the Report Server
                              service. Valid values include Manual, Automatic,
                              and Disabled. The default value for StartupType
                              is Manual, where the server is started when a
                              request is received.
 RSUPGRADEDATABASEACCOUNT     RSInputSettings_RSInstallMode_Description
 RSUPGRADEPASSWORD            RSInputSettings_RSInstallMode_Description
 RULES                        指定要运行的规则 ID 或规则组 ID 的列表。
 SAPWD                        Password for SQL Server sa account.
 SECURITYMODE                 The default is Windows Authentication. Use "SQL"
                              for Mixed Mode Authentication.
 SQLBACKUPDIR                 Default directory for the Database Engine backup
                              files.
 SQLCOLLATION                 Specifies a Windows collation or an SQL collation
                              to use for the Database Engine.
 SQLSVCACCOUNT                Account for SQL Server service: Domain\User or
                              system account.
 SQLSVCPASSWORD               A SQL Server service password is required only
                              for a domain account.
 SQLSVCSTARTUPTYPE            Startup type for the SQL Server service.
 SQLSYSADMINACCOUNTS          Windows account(s) to provision as SQL Server
                              system administrators.
 SQLTEMPDBDIR                 Directory for Database Engine TempDB files.
 SQLTEMPDBLOGDIR              Directory for the Database Engine TempDB log
                              files.
 SQLUSERDBDIR                 Default directory for the Database Engine user
                              databases.
 SQLUSERDBLOGDIR              Default directory for the Database Engine user
                              database logs.
 SQMREPORTING                 指定可以收集 SQL Server 功能使用情况数据,并将数据
发送到 Microsoft。指定 1
                              或 True 将启用此功能,指定 0 或 False 将禁用此功能
。
 TCPENABLED                   Specify 0 to disable or 1 to enable the TCP/IP
                              protocol.
 UIMODE                       用于控制用户界面行为的参数。有效值对于完整 UI 为 N
ormal,对于简化的 UI 为
                              AutoAdvance,为 EnableUIOnServerCore 则跳过 Server

                              Core 安装程序 GUI 块。
 UpdateEnabled                指定 SQL Server 安装程序是否应发现和包括产品更新。
有效值是 True 和 False
                              或者 1 和 0。默认情况下,SQL Server 安装程序将包括
找到的更新。
 UpdateSource                 指定 SQL Server 安装程序将获取产品更新的位置。有效
值为 "MU"
                              (以便搜索产品更新)、有效文件夹路径以及 .\MyUpdates
 或 UNC
                              共享目录之类的相对路径。默认情况下,SQL Server 安
装程序将通过 Window
                              Server Update Services 搜索 Microsoft Update 或
                              Windows Update 服务。
 X86                          指定安装程序应该安装到 WOW64 中。IA64 或 32 位系统
不支持此命令行参数。

完整的无人参与安装示例,显示所有必需的参数:


setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /FEAT
URES=SQL,AS,RS,IS,Tools
/INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="MyDomain\MyAccount"
/SQLSVCPASSWORD="************" /SQLSYSADMINACCOUNTS="MyDomain\MyAccount "
/AGTSVCACCOUNT="MyDomain\MyAccount" /AGTSVCPASSWORD="************"
/ASSVCACCOUNT="MyDomain\MyAccount" /ASSVCPASSWORD="************"
/RSSVCACCOUNT="MyDomain\MyAccount" /RSSVCPASSWORD="************"
/ISSVCAccount="MyDomain\MyAccount" /ISSVCPASSWORD="************"
/ASSYSADMINACCOUNTS="MyDomain\MyAccount"

按任意键退出...

^C
I:\>

PowerShell 批量启动关闭实例:

start test instances .bat

@powershell -command "Get-Service |Where-Object {$_.Name -like 'MSSQL$I*'}|Start-Service -ErrorAction SilentlyContinue"
@pause


stop test instances .bat

@powershell -Command " Get-Service |Where-Object {$_.Name -like 'MSSQL$I*'}|Stop-Service -ErrorAction SilentlyContinue"

@pause


效果图


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值