Get the App
SLTechnology News&Howtos  ›  Database  › 

[AlwaysOn] create SQL Server high availability group T-SQL syntax: DATABASE clause

Shulou Source: shulou.com Published: 2022-06-01 05:55:20 09月24日 Update

DATABASE database_name

Specifies a list of one or more user databases on the local SQL Server instance (that is, the server instance where the availability group was created). Specifies a list of one or more user databases on the local SQL Server instance (that is, the server instance on which you are creating the availability group). You can specify multiple databases for an availability group, but each database can only belong to one availability group. You can specify multiple databases for an availability group, but each database can belong to only one availability group. For information about the types of databases that availability groups can support, see prerequisites, limitations, and recommendations for never-stop availability groups (SQL Server). For information about the type of databases that an availability group can support, see Prerequisites, Restrictions, and Recommendations for Always On Availability Groups (SQL Server). To find out which local databases already belong to an availability group, see the replica_id column in the sys.databases catalog view. To find out which local databases already belong to an availability group, see the replica_id column in the sys.databases catalog view.

The DATABASE clause is optional. The DATABASE clause is optional. If it is omitted, the new availability group is empty. If you omit it, the new availability group is empty.

After you create an availability group, connect to each server instance that hosts the secondary copy, and then prepare each secondary database and join it to the availability group. After you have created the availability group, connect to each server instance that hosts a secondary replica and then prepare each secondary database and join it to the availability group. For more information, see starting data movement on a secondary database (SQL Server) that is always open. For more information, see Start Data Movement on an Always On Secondary Database (SQL Server).

Comment Note

Later, you can add eligible databases to the availability group on the server instance that hosts the current master copy. Later, you can add eligible databases on the server instance that hosts the current primary replica to an availability group. You can also remove databases from the availability group. For more information, see alter availability group (Transact-SQL). You can also remove a database from an availability group. For more information, see ALTER AVAILABILITY GROUP (Transact-SQL).

Tags: Availability data database instance information server related service auxiliary copy multiple condition clause premise suggestion never comment user directory later Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux Apple Microsoft MariaDB