Sdílet prostřednictvím


Use the New Availability Group Wizard (SQL Server Management Studio)

This topic describes how to use the New Availability Group Wizard (in SQL Server Management Studio) to create and configure an AlwaysOn availability group in SQL Server 2012. An availability group defines a set of user databases that will fail over as a single unit and a set of failover partners, known as availability replicas, that support failover.

Note

For an introduction to availability groups, see Overview of AlwaysOn Availability Groups (SQL Server).

  • Before you begin:  

    Prerequisites, Restrictions, and Recommendations

    Considerations for Using the New Availability Group Wizard (SQL Server Management Studio)

    Security

  • To create and configure an availability group, using:  New Availability Group Wizard (SQL Server Management Studio)

Note

As an alternative to using the New Availability Group Wizard, you can use Transact-SQL or SQL Server PowerShell cmdlets. For more information, see Create an Availability Group (Transact-SQL) or Create an Availability Group (SQL Server PowerShell).

Before You Begin

We strongly recommend that you read this section before attempting to create your first availability group.

Prerequisites, Restrictions, and Recommendations

In most cases, you can use the New Availability Group Wizard to complete all of the tasks require to create and configure an availability group. However, you might need to complete some of the tasks manually.

  • Before creating an availability group, verify that the instances of SQL Server that host availability replicas reside on different Windows Server Failover Clustering (WSFC) node within the same WSFC failover cluster. Also, verify that each of the server instance meets all other AlwaysOn Availability Groups prerequisites. For more information, we strongly recommend that you read Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups (SQL Server).

  • If a server instance that you select to host an availability replica is running under a domain user account and does not yet have a database mirroring endpoint, the wizard can create the endpoint and grant CONNECT permission to the server instance service account. However, if the SQL Server service is running as a built-in account, such as Local System, Local Service, or Network Service, or a nondomain account, you must use certificates for endpoint authentication, and the wizard will be unable to create a database mirroring endpoint on the server instance. In this case, we recommend that you create the database mirroring endpoints manually before you launch the New Availability Group Wizard.

    To use certificates for a database mirroring endpoint:

    CREATE ENDPOINT (Transact-SQL)

    Use Certificates for a Database Mirroring Endpoint (Transact-SQL)

  • SQL Server Failover Cluster Instances (FCIs) do not support automatic failover by availability groups, so any availability replica that is hosted by an FCI can only be configured for manual failover.

  • If a database is encrypted or even contains a Database Encryption Key (DEK), you cannot use the New Availability Group Wizard or Add Database to Availability Group Wizard to add the database to an availability group. Even if an encrypted database has been decrypted, its log backups might contain encrypted data. In this case, full initial data synchronization could fail on the database. This is because the restore log operation might require the certificate that was used by the database encryption keys (DEKs), and that certificate might be unavailable.

    To make a decrypted database eligible to add to an availability group using the wizard:

    1. Create a log backup of the primary database.

    2. Create a full database backup of the primary database.

    3. Restore the database backup on the server instance that hosts the secondary replica.

    4. Create a new log backup from primary database.

    5. Restore this log backup on the secondary database.

  • Prerequisites for the wizard to perform full initial data synchronization

    • All the database-file paths must be identical on every server instance that hosts a replica for the availability group.

    • No primary database name can exist on any server instance that hosts a secondary replica. This means that none of the new secondary databases can exist yet.

    • You will need to specify a network share in order for the wizard to create and access backups. For the primary replica, the account used to start the Database Engine must have read and write file-system permissions on a network share. For secondary replicas, the account must have read permission on the network share.

      Important

      The log backups will be part of your log backup chain. Store the log backup files appropriately.

    If you are unable to use the wizard to perform full initial data synchronization, you need to prepare your secondary databases manually. You can do this before or after running the wizard. For more information, see Manually Prepare a Secondary Database for an Availability Group (SQL Server).

Security

Permissions

Requires membership in the sysadmin fixed server role and either CREATE AVAILABILITY GROUP server permission, ALTER ANY AVAILABILITY GROUP permission, or CONTROL SERVER permission.

Also requires CONTROL ON ENDPOINT permission if you want to allow Availability Group Wizard to manage the database mirroring endpoint.

Arrow icon used with Back to Top link[Top]

Using the New Availability Group Wizard

  1. In Object Explorer, connect to the server instance that hosts the primary replica.

  2. Expand the AlwaysOn High Availability node and the Availability Groups node.

  3. To launch the New Availability Group Wizard, select the New Availability Group Wizard command.

  4. The first time you run this wizard, an Introduction page appears. To bypass this page in the future, you can click Do not show this page again. After reading this page, click Next.

  5. On the Specify Availability Group Name page, enter the name of the new availability group in the Availability group name field. This name must be a valid SQL Server identifier that is unique on the WSFC failover cluster and in your domain as a whole. The maximum length for an availability group name is 128 characters.

  6. On the Select Databases page, the grid lists user databases on the connected server instance that are eligible to become the availability databases. Select one or more of the listed databases to participate in the new availability group. These databases will initially be the initial primary databases.

    For each listed database, the Size column displays the database size, if known. The Status column indicates whether a given database meets the prerequisites for availability databases. It the prerequisites are not met, a brief status description indicates the reason that the database is ineligible; for example, if it does not use the full recovery model. For more information, click the status description.

    If you change a database to make it eligible, click Refresh to update the databases grid.

  7. On the Specify Replicas page, specify and configure one or more replicas for the new availability group. This page contains four tabs. The following table introduces these tabs. For more information, see the Specify Replicas Page (New Availability Group Wizard/Add Replica Wizard) topic.

    Tab

    Brief Description

    Replicas

    Use this tab to specify each instance of SQL Server that will host a secondary replica. Note that the server instance to which you are currently connected must host the primary replica.

    Endpoints

    Use this tab to verify any existing database mirroring endpoints and also, if this endpoint is lacking on a server instance whose service accounts use Windows Authentication, to create the endpoint automatically.

    Note

    If any server instance is running under a non-domain user account, you need to do make a manual change to your server instance before you can proceed in the wizard. For more information, see Prerequisites, earlier in this topic.

    Backup Preferences

    Use this tab to specify your backup preference for the availability group as a whole and your backup priorities for the individual availability replicas.

    Listener

    Use this tab to create an availability group listener. By default, the wizard does not create a listener.

  8. On the Select Initial Data Synchronization page, choose how you want your new secondary databases to be created and joined to the availability group. Choose one of the following options:

    • Full

      Select this option if your environment meets the requirements for automatically starting initial data synchronization (for more information, see Prerequisites, Restrictions, and Recommendations , earlier in this topic).

      If you select Full, after creating the availability group, the wizard will back up every primary database and its transaction log to a network share and restore the backups on every server instance that hosts an secondary replica. The wizard will then join every secondary database to the availability group.

      In the Specify a shared network location accessible by all replicas: field, specify a backup share to which all of the server instance that host replicas have read-write access. For more information, see Prerequisites, earlier in this topic.

    • Join only

      If you have manually prepared secondary databases on the server instances that will host the secondary replicas, you can select this option. The wizard will join the existing secondary databases to the availability group.

    • Skip initial data synchronization

      Select this option if you want to use your own database and log backups of your primary databases. For more information, see Start Data Movement on an AlwaysOn Secondary Database (SQL Server).

  9. The Validation page verifies whether the values you specified in this Wizard meet the requirements of the New Availability Group Wizard. To make a change, click Previous to return to an earlier wizard page to change one or more values. The click Next to return to the Validation page, and click Re-run Validation.

  10. On the Summary page, review your choices for the new availability group. To make a change, click Previous to return to the relevant page. After making the change, click Next to return to the Summary page.

    Security noteSecurity Note

    When the SQL Server service account of a server instance that will host a new availability replica does not already exist as a login, the New Availability Group Wizard needs to create the login. On the Summary page, the wizard displays the information for the login that is to be created. If you click Finish, the wizard creates this login for the SQL Server service account and grants the login CONNECT permission.

    If you are satisfied with your selections, optionally click Script to create a script of the steps the wizard will execute. Then, to create and configure the new availability group, click Finish.

  11. The Progress page displays the progress of the steps for creating the availability group (configuring endpoints, creating the availability group, and joining the secondary replica to the group).

  12. When these steps complete, the Results page displays the result of each step. If all these steps succeed, the new availability group is completely configured. If any of the steps result in an error, you might need to manually complete the configuration or use a wizard for the failed step. For information about the cause of a given error, click the associated "Error" link in the Result column.

    When the wizard completes, click Close to exit.

Arrow icon used with Back to Top link[Top]

To complete availability group configuration

Alternative ways to create an availability group

To enable AlwaysOn Availability Groups

To configure a database mirroring endpoint

To troubleshoot AlwaysOn Availability Groups configuration

Arrow icon used with Back to Top link[Top]

Arrow icon used with Back to Top link[Top]

See Also

Concepts

The Database Mirroring Endpoint (SQL Server)

Overview of AlwaysOn Availability Groups (SQL Server)

Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups (SQL Server)