Quantcast
Channel: SQL Server High Availability and Disaster Recovery forum
Viewing all articles
Browse latest Browse all 4689

Joining the secondary database to the availability group

$
0
0

Hi,

I am attempting to create a always on AG using PowerShell, however when I issue the command:

Add-SqlAvailabilityDatabase -Path "SQLSERVER:\SQL\TEST2\MSSQLDB\AvailabilityGroups\peter" -Database "peter"

It fails with the the error message below. The same error appears when I use management studio but is successfully when I select the full option instead of the join only radio button on the GUI.

My question is, how do I replaicate the full operation using powershell i.e. is it an "Add-SqlAvailabilityDatabase" command ? What is the synatx ?

Thanks in advance,

**********************************

Add-SqlAvailabilityDatabase : The connection to the primary replica is not active.  The command cannot be processed.
At line:1 char:28
+ Add-SqlAvailabilityDatabase <<<<  -Path "SQLSERVER:\SQL\TEST2\MSSQLDB\AvailabilityGroups\peter" -Database "peter"
    + CategoryInfo          : InvalidOperation: (:) [Add-SqlAvailabilityDatabase], SqlException
    + FullyQualifiedErrorId : ExecutionFailed,Microsoft.SqlServer.Management.PowerShell.Hadr.AddSqlAvailabilityGroupDa
   tabaseCommand

**********************************


Viewing all articles
Browse latest Browse all 4689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>