天天看點

shell 靜默安裝mysql_SQL Server 靜默安裝

SQL Server 安裝時,需要在各個安裝視窗進行選擇和設定,若需要在多台伺服器安裝相同的資料庫,靜默安裝是比較省事的。

當安裝 SQL Server  到最後一步,會有一個安裝配置檔案 ConfigurationFile.ini

該檔案記錄了前面步驟的設定,彙總到該配置檔案中。如下:(此示例是在域中安裝且使用域管理者作為相關賬戶)

;SQL Server 2012 Configuration File

[OPTIONS]

; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.

ACTION="Install"

; Detailed help for command line argument ENU has not been defined yet.

ENU="True"

; Parameter that controls the user interface behavior. Valid values are Normal for the full UI,AutoAdvance for a simplied UI, and EnableUIOnServerCore for bypassing Server Core setup GUI block.

UIMODE="Normal"

; Setup will not display any user interface.

QUIET="False"

; Setup will display progress only, without any user interaction.

QUIETSIMPLE="False"

; Specify whether SQL Server Setup should discover and include product updates. The valid values are True and False or 1 and 0. By default SQL Server Setup will include updates that are found.

UpdateEnabled="True"

; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, MDS, and Tools. The SQL feature will install the Database Engine, Replication, Full-Text, and Data Quality Services (DQS) server. The Tools feature will install Management Tools, Books online components, SQL Server Data Tools, and other shared components.

FEATURES=SQLENGINE,SSMS,ADV_SSMS

; Specify the location where SQL Server Setup will obtain product updates. The valid values are "MU" to search Microsoft Update, a valid folder path, a relative path such as .\MyUpdates or a UNC share. By default SQL Server Setup will search Microsoft Update or a Windows Update service through the Window Server Update Services.

UpdateSource="MU"

; Displays the command line parameters usage

HELP="False"

; Specifies that the detailed Setup log should be piped to the console.

INDICATEPROGRESS="False"

; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.

X86="False"

; Specify the root installation directory for shared components.  This directory remains unchanged after shared components are already installed.

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

; Specify the root installation directory for the WOW64 shared components.  This directory remains unchanged after WOW64 shared components are already installed.

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

; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).

INSTANCENAME="MSSQLSERVER"

; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will incorporate the instance ID of the SQL Server instance.

INSTANCEID="MSSQLSERVER"

; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.

SQMREPORTING="False"

; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.

ERRORREPORTING="False"

; Specify the installation directory.

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

; Agent account name

AGTSVCACCOUNT="KK\dcadmin"

; Auto-start service after installation.

AGTSVCSTARTUPTYPE="Automatic"

; CM brick TCP communication port

COMMFABRICPORT="0"

; How matrix will use private networks

COMMFABRICNETWORKLEVEL="0"

; How inter brick communication will be protected

COMMFABRICENCRYPTION="0"

; TCP port used by the CM brick

MATRIXCMBRICKCOMMPORT="0"

; Startup type for the SQL Server service.

SQLSVCSTARTUPTYPE="Automatic"

; Level to enable FILESTREAM feature at (0, 1, 2 or 3).

FILESTREAMLEVEL="0"

; Set to "1" to enable RANU for SQL Server Express.

ENABLERANU="False"

; Specifies a Windows collation or an SQL collation to use for the Database Engine.

SQLCOLLATION="Chinese_PRC_CI_AS"

; Account for SQL Server service: Domain\User or system account.

SQLSVCACCOUNT="KK\dcadmin"

; Windows account(s) to provision as SQL Server system administrators.

SQLSYSADMINACCOUNTS="KK\dcadmin" "Administrator"

; The default is Windows Authentication. Use "SQL" for Mixed Mode Authentication.

SECURITYMODE="SQL"

; Provision current user as a Database Engine system administrator for SQL Server 2012 Express.

ADDCURRENTUSERASSQLADMIN="False"

; Specify 0 to disable or 1 to enable the TCP/IP protocol.

TCPENABLED="1"

; Specify 0 to disable or 1 to enable the Named Pipes protocol.

NPENABLED="0"

; Startup type for Browser Service.

BROWSERSVCSTARTUPTYPE="Disabled"

此配置檔案是通過UI操作的,不适于靜默安裝,需要修改寫配置。

如目前自己用虛拟機測試的叢集中獨立安裝MSSQL,虛拟機不做什麼要求,在其他節點都執行相同的配置檔案靜默安裝sql server。

其中修改如下:

; SQL Server 2012 Configuration File

; 參考:https://msdn.microsoft.com/zh-cn/library/ms144259.aspx

[OPTIONS]

; ACTION 可選為 INSTALL(安裝), UNINSTALL(解除安裝), UPGRADE(更新)

ACTION="Install"

; 【新增】必需,用于确認接受許可條款,靜默安裝用。

IACCEPTSQLSERVERLICENSETERMS

; 【新增】産品密鑰。 如果未指定此參數,則使用 Evaluation。

PID="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"

; 在已本地化的作業系統上安裝英文版的 SQL Server。

ENU="True"

; 【注釋】UIMODE 可選為Normal,AutoAdvance (UIMode 設定不能與 /Q (QUIET)或 /QS(QUIETSIMPLE)參數結合使用)

; Normal : 非 Express 版本,所選的功能提供其所有安裝程式對話框。

; AutoAdvance : 對于 Express 版本是預設值,它跳過不重要的對話框

; UIMODE="Normal"

; 【注釋】是否靜默安裝,靜默安裝不顯示使用者互動界面.QUIET 與 QUIETSIMPLE 二選一

; QUIET="True"

; 是否隻顯示進度(最後一步安裝進度),不顯示使用者互動界面。靜默安裝還是顯示進度吧。

QUIETSIMPLE="True"

; 是否應發現和包含産品更新,不更新。

UpdateEnabled="False"

; 安裝的功能,此為 MSSQL存儲引擎 和 SSMS管理工具

FEATURES=SQLENGINE,SSMS,ADV_SSMS

; SQL Server 安裝程式将擷取産品更新的位置( .\MyUpdates)

UpdateSource="MU"

; 顯示安裝參數的用法選項,不顯示

HELP="False"

; 指定是否将詳細的安裝日志檔案傳送到控制台。(此禁用或隻看進度即可 QUIETSIMPLE="True")

; 安裝過程日志資訊:C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log

INDICATEPROGRESS="True"

; 是否允許32位程式安裝到64位系統上(WOW64)

X86="False"

; 為 64 位共享元件指定一個非預設安裝目錄。

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

; 為 32 位共享元件指定一個非預設安裝目錄。 僅在 64 位系統上受支援。

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

; 執行個體名稱

INSTANCENAME="MSSQLSERVER"

; 執行個體ID

INSTANCEID="MSSQLSERVER"

; 是否收集使用資料發送到 Microsoft(是:1 or True;否:0 or False )

SQMREPORTING="False"

; 是否将錯誤回報發送到 Microsoft(是:1 or True;否:0 or False )

ERRORREPORTING="False"

; 安裝目錄

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

; 【新增】代理服務賬戶(新增密碼項)

AGTSVCACCOUNT="KK\dcadmin"

AGTSVCPASSWORD="dcadmin"

; 代理啟動模式,設定自動

AGTSVCSTARTUPTYPE="Automatic"

; CM 程式塊 TCP 通信端口(未知)

COMMFABRICPORT="0"

; 矩陣如何使用專用網絡(未知)

COMMFABRICNETWORKLEVEL="0"

; 如何保護程式塊間的通信(未知)

COMMFABRICENCRYPTION="0"

; CM 程式塊使用的 TCP 端口(未知)

MATRIXCMBRICKCOMMPORT="0"

; SQL Server 引擎服務的啟動模式

SQLSVCSTARTUPTYPE="Automatic"

; FILESTREAM 是否啟用,值為 (0, 1, 2 or 3).

FILESTREAMLEVEL="0"

; 為 SQL Server Express 安裝啟用運作身份憑據。

ENABLERANU="False"

; SQL Server 的排序規則設定

SQLCOLLATION="Chinese_PRC_CI_AS"

; 【新增】SQL Server 服務的啟動帳戶(新增密碼項)

SQLSVCACCOUNT="KK\dcadmin"

SQLSVCPASSWORD="dcadmin"

; 指定 Windows 賬戶作為資料庫管理者

SQLSYSADMINACCOUNTS="KK\dcadmin" "Administrator"

; 【新增】SQL授權模式,"SQL"為混合授權,需設定密碼(新增密碼項)

SECURITYMODE="SQL"

SAPWD="dcadmin"

; 【注釋】目前使用者作為資料庫管理者(對于 SQL Server Express 版本為 True,其他未true)

; ADDCURRENTUSERASSQLADMIN="True"

; 指定 SQL Server 服務的 TCP 協定的狀态(0:禁用;1:啟用)

TCPENABLED="1"

; 指定 SQL Server 服務的 Named Pipes 協定的狀态(0:禁用;1:啟用)

NPENABLED="0"

; SQL Server Browser 服務的啟動模式,禁用。

BROWSERSVCSTARTUPTYPE="Disabled"

修改完成後,進入 mssql 安裝目錄, 執行 setup.exe 安裝:

.\setup.exe /CONFIGURATIONFILE="C:\PerfLogs\ConfigurationFile.ini"

等待完成即可,若出現中斷,檢視安裝日志什麼錯誤。

C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log

此外,還可以單獨設定資料檔案的資料目錄(INSTALLSQLDATADIR)等

---------------------

作者:薛定谔的DBA

來源:CSDN

原文:https://blog.csdn.net/kk185800961/article/details/62979524

版權聲明:本文為部落客原創文章,轉載請附上博文連結!