最近需要製作一個安裝程式,要能自動安裝SQL Server 2012 Express,包含預設的設定,嘗試一會後終於找到解決方法:使用組態檔(Configuration file)來安裝。可惜網路找到的步驟有些許語焉不詳,幾經測試才告成功。
以組態檔安裝
我由微軟網站下載到SQL Server 2012 Express的檔名是:SQLEXPRWT_x86_ENU.exe,以「/ConfigurationFile=組態檔名」當參數執行安裝即能一路安裝到結束,中間不需人力介入,有大量安裝需求時,此種方式也能達到安裝的標準化。組態檔名必須含完整的路徑,在執行時才能被正確讀取到。
SQLEXPRWT_x86_ENU.exe /ConfigurationFile=c:\temp\SQLEXPRESS.ini
產生組態檔
組態檔是在SQL Server的安裝過程中會產生出來的檔案,安裝完畢後就會自動被刪除,因此必須在執行到倒數第三個步驟「**Ready to Install」時按取消,才能在C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\日期_時間\裡找到,組態檔名稱固定為ConfigurationFile.ini,找到ini檔後我將之更名為SQLEXPRESS.ini,並編輯其內容。
這個ConfigurationFile.ini無法在Express版裡產生,在安裝Express版時Ready to Install會被自動跳過而無法被保存到,我後來再下載並安裝標準版才能按取消找到檔案。
修改組態檔內容
以下是修改了的部份,其餘保留原來的值:
; Setup will display progress only, without any user interaction. ; 原來是False,修改為True QUIETSIMPLE="True" ; BIDS=Business Intelligent Dev Studio ; CONN=connectivity components. ; IS=Integration Services ; BC=Client Tools Backward Compatibility ; SSMS=SQL Server Management Studio ; SNAC_SDK=SQL Client Connectivity SDK ; 要安裝的組件,依需求選用 FEATURES=SQLENGINE,CONN,IS,BC,SSMS,ADV_SSMS,SNAC_SDK ;; 執行個體名稱為SQLEXPRESS INSTANCENAME="SQLEXPRESS" INSTANCEID="SQLEXPRESS" ; Account for SQL Server service: Domain\User or system account. ; 啟動服務時的帳號 SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" ; Windows account(s) to provision as SQL Server system administrators. SQLSYSADMINACCOUNTS="Administrator" ; The default is Windows Authentication. Use "SQL" for Mixed Mode Authentication. SECURITYMODE="SQL" ; Startup type for Browser Service. Express版的SQL Browser必須自動啟動 BROWSERSVCSTARTUPTYPE="Automatic" ;; 下列兩個參數是額外加入的 ; 帳號 sa 的密碼 SAPWD="密碼" ; 接受SQL Server的授權條件 IAcceptSQLServerLicenseTerms="True"
完整的SQLEXPRESS.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="True" ; 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="False" ; 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. ; BIDS=Business Intelligent Dev Studio ; CONN=connectivity components. ; IS=Integration Services ; BC=Client Tools Backward Compatibility ; SSMS=SQL Server Management Studio ; SNAC_SDK=SQL Client Connectivity SDK FEATURES=SQLENGINE,CONN,IS,BC,SSMS,ADV_SSMS,SNAC_SDK ; 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="True" ; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system. X86="True" ; 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 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="SQLEXPRESS" ; 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="SQLEXPRESS" ; 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 (x86)\Microsoft SQL Server" ; Agent account name AGTSVCACCOUNT="NT Service\SQLAgent$SQLEXPRESS" ; Auto-start service after installation. AGTSVCSTARTUPTYPE="Manual" ; Startup type for Integration Services. ISSVCSTARTUPTYPE="Automatic" ; Account for Integration Services: Domain\User or system account. ISSVCACCOUNT="NT Service\MsDtsServer110" ; 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_Taiwan_Stroke_CI_AS" ; Account for SQL Server service: Domain\User or system account. SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" ; Windows account(s) to provision as SQL Server system administrators. SQLSYSADMINACCOUNTS="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="Automatic" ;;;;;;;;; SAPWD="密碼" IAcceptSQLServerLicenseTerms="True"
##
您可能也會有興趣的類似文章
- SQL Server 2008 R2 Express簡易安裝紀錄 (0則留言, 2011/09/06)
- 安裝SQL Server 2012 Express注意事項 (0則留言, 2013/06/23)
- [Database] Aqua Data Studio 4.0.2推出 (0則留言, 2005/02/23)
- [Java] jTDS: SQL Server的JDBC驅動程式 (0則留言, 2005/03/03)
- 讀寫Oracle 10g的CLOB欄位 (0則留言, 2007/06/29)
- [Database] 識別欄位如何重新給值? (0則留言, 2005/02/19)
- 資料庫工具Aqua Data Studio躍升至6.0版 (0則留言, 2006/12/08)
- [Database] 建立SQL Server的檔案群組 (1則留言, 2005/03/23)
- 終於比較清楚Aqua Data Studio的Execute Current要如何操作了 (0則留言, 2005/01/31)
- Aqua Data Studio的新功能 (2則留言, 2005/12/28)
- 微軟推出新版的JDBC Driver (0則留言, 2006/01/21)
- phpMyAdmin的替代品:SQL Buddy (6則留言, 2008/12/06)
- sc.exe: 在本機控制遠端電腦的服務 (0則留言, 2005/01/28)
- [DB] 開源的資料庫管理工具:SQuirreL SQL Client (0則留言, 2007/10/07)
- [DB] 給開發人員使用的Oracle SQL Developer (2則留言, 2007/07/28)
The post 使用組態檔(ConfigurationFile)一鍵安裝SQL Server 2012 appeared first on 簡睿隨筆.