Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniuNí thacaítear leis an mbrabhsálaí seo a thuilleadh.
Uasghrádú go Microsoft Edge chun leas a bhaint as na gnéithe is déanaí, nuashonruithe slándála, agus tacaíocht theicniúil.
Applies to:
SQL Server
This topic explains how to join a secondary database to an Always On availability group by using SQL Server Management Studio, Transact-SQL, or PowerShell in SQL Server. After you prepare a secondary database for a secondary replica, you need to join the database to the availability group as soon as possible. This will start data movement from the corresponding primary database to the secondary database.
Nóta
For information about what happens after a secondary database joins the group, see Overview of Always On Availability Groups (SQL Server).
You must be connected to the server instance that hosts the secondary replica.
The secondary replica must already be joined to the availability group. For more information, see Join a Secondary Replica to an Availability Group (SQL Server).
The secondary database must have been prepared recently. For more information, see Manually Prepare a Secondary Database for an Availability Group (SQL Server).
Requires ALTER AVAILABILITY GROUP permission on the availability group, CONTROL AVAILABILITY GROUP permission, ALTER ANY AVAILABILITY GROUP permission, or CONTROL SERVER permission.
To join a secondary database to an availability group
In Object Explorer, connect to the server instance that hosts the secondary replica, and expand the server tree.
Expand the Always On High Availability node and the Availability Groups node.
Expand the availability group that you want to change, and expand the Availability Databases node.
Right-click the database, and click Join to Availability Group.
This opens the Join Databases to Availability Group dialog box. Verify the availability group name, which is displayed on the title bar, and database name or names displayed in the grid, and click OK, or click Cancel.
To join a secondary database to an availability group
Connect to the server instance that hosts the secondary replica.
Use the SET HADR clause of the ALTER DATABASE statement, as follows:
ALTER DATABASE database_name SET HADR AVAILABILITY GROUP = group_name
where database_name is the name of a database to be joined and group_name is the name of the availability group.
The following example joins the secondary database, Db1
, to the local secondary replica of the MyAG
availability group.
ALTER DATABASE Db1 SET HADR AVAILABILITY GROUP = MyAG;
Nóta
To see this Transact-SQL statement used in context, see Create an Availability Group (Transact-SQL).
To join a secondary database to an availability group
Change directory (cd) to the server instance that hosts the secondary replica.
Use the Add-SqlAvailabilityDatabase cmdlet to join one or more secondary databases to the availability group.
For example, the following command joins a secondary database, Db1
, to the availability group MyAG
on one of the server instances that hosts a secondary replica.
Add-SqlAvailabilityDatabase `
-Path SQLSERVER:\SQL\SecondaryServer\InstanceName\AvailabilityGroups\MyAG `
-Database "Db1"
Nóta
To view the syntax of a cmdlet, use the Get-Help cmdlet in the SQL Server PowerShell environment. For more information, see Get Help SQL Server PowerShell.
To set up and use the SQL Server PowerShell provider
Join a Secondary Replica to an Availability Group (SQL Server)
Manually Prepare a Secondary Database for an Availability Group (SQL Server)
ALTER AVAILABILITY GROUP (Transact-SQL)
Overview of Always On Availability Groups (SQL Server)
Troubleshoot Always On Availability Groups Configuration (SQL Server)
Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniuOiliúint
Modúl
Explore IaaS and PaaS solutions for high availability and disaster recovery - Training
Explore IaaS and PaaS solutions for high availability and disaster recovery
Deimhniú
Microsoft Certified: Azure Database Administrator Associate - Certifications
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.