共用方式為


How to: Install SQL Server 2008 R2 Using a Configuration File

SQL Server Setup provides the ability to generate a configuration file based upon the system default and run-time inputs. You can use the configuration file to deploy SQL Server throughout the enterprise with the same configuration. You can also standardize manual installations throughout the enterprise, by creating a batch file that launches Setup.exe.

Setup supports the use of the configuration file only through the command prompt. The processing order of the parameters while using the configuration file is outlined below:

  • The configuration file overwrites the defaults in a package

  • Command-line values overwrite the values in the configuration file

The configuration file can be used to track the parameters and values for each installation. This makes the configuration file useful for verifying and auditing the installations.

Configuration File Structure

The ConfigurationFile.ini file is a text file with parameters (name/value pair) and descriptive comments.

The following is an example of a ConfigurationFile.ini file:

;SQLSERVER2008 Configuration File
[SQLSERVER2008]

; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter. 
ACTION="Install"
; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components. 

FEATURES=SQL,Tools

How to generate a configuration file

  1. Insert the SQL Server installation media. From the root folder, double-click Setup.exe. To install from a network share, locate the root folder on the share, and then double-click Setup.exe.

  2. Follow the wizard through to the Ready to Install page. The path to the configuration file is specified in the Ready to Install page in the configuration file path section. For more information about how to install SQL Server, see How to: Install SQL Server 2008 R2 (Setup)

  3. Cancel the setup without actually completing the installation, to generate the INI file.

    注意

    The setup infrastructure writes out all the appropriate parameters for the actions that were run, with the exception of sensitive information such as passwords. The /IAcceptSQLServerLicenseTerms parameter is also not written out to the configuration file and requires either a modification of the configuration file or a value to be supplied at the command prompt. For more information, see How to: Install SQL Server 2008 R2 from the Command Prompt. In addition, a value is included for Boolean parameters where a value is usually not supplied through the command prompt.

Using the Configuration File to Install SQL Server 2008

You can only use the configuration file on command-line installations.

注意

If you need to make changes to the configuration file, we recommend that you make a copy and work with the copy.

How to use a configuration file to install a stand-alone SQL Server instance

  • Run the installation through the command prompt and supply the ConfigurationFile.ini using the ConfigurationFile parameter.

How to use a configuration file to prepare and complete an image of a stand-alone SQL Server instance (SysPrep)

  1. To prepare one or more instances of SQL Server and configure them on the same machine.

    • Run Image preparation of a stand-alone instance for SysPrep deployment from the Advanced page of the Installation Center and capture the prepare image configuration file.

    • Use the same prepare image configuration file as a template to prepare more instances of SQL Server.

    • Run Image completion of a prepared stand-alone instance from the Advanced page of the Installation Center to configure a prepared instances on the machine.

  2. To prepare an image of the operating system including an unconfigured prepared instance of SQL Server, using Windows SysPrep tool.

    • Run the Image preparation of a stand-alone instance for SysPrep deployment from the Advanced page of the Installation Center and capture the prepare image configuration file.

    • Run the Image completion of a prepared stand-alone instance from the Advanced page of the Installation Center, but cancel it on the Ready to Complete page after capturing the complete configuration file.

    • The complete image configuration file can be stored with the Windows image for automating the configuration of the prepared instances.

How to install a SQL Server failover cluster using the configuration file

  1. Integrated Install option (create a single node failover cluster on a node and for additional nodes, run AddNode on them):

    • Run the "Install a Failover Cluster" option and capture the configuration file that lists all the installation settings.

    • Run the command-line failover cluster install by supplying the ConfigurationFile parameter.

    • On an additional node to be added, run AddNode to capture the ConfigurationFile.ini file applicable to the existing failover cluster.

    • Run the command-line AddNode on all the additional nodes that will join the failover cluster, by supplying the same configuration file using the ConfigurationFile parameter.

  2. Advanced install option (prepare failover cluster on all failover cluster nodes, then, after preparing all the nodes, run complete on the node that owns the shared disk):

    • Run Prepare on one of the nodes, and capture the ConfigurationFile.ini file.

    • Supply the same ConfigurationFile.ini file to Setup on all the nodes that will be prepared for the failover cluster.

    • After all the nodes have been prepared, run a complete failover cluster operation on the node that owns the shared disk and capture the ConfigurationFile.ini file.

    • You can then supply this ConfigurationFile.ini file to complete the failover cluster.

How to add or remove a node to a SQL Server failover cluster using the configuration file

  • If you have a configuration file that was previously used to add a node to or remove a node from a failover cluster, you can reuse that same file to add or remove additional nodes.

How to upgrade a SQL Server failover cluster using the configuration file

  1. Run upgrade on the passive node and capture the ConfigurationFile.ini file. You can do this either by performing the actual upgrade, or exiting at the end without doing the actual upgrade.

  2. On all the additional nodes to be upgraded, supply the ConfigurationFile.ini file to complete the process.

Sample Syntax

Following are some examples on how to use the configuration file:

  • To specify the configuration file at the command prompt:
Setup.exe /ConfigurationFile=MyConfigurationFile.INI
  • To specify passwords at the command prompt instead of in the configuration file:
Setup.exe /SQLSVCPASSWORD="************" /AGTSVCPASSWORD="************" /ASSVCPASSWORD="************" /ISSVCPASSWORD="************" /RSSVCPASSWORD="************" /ConfigurationFile=MyConfigurationFile.INI