Joining database to an existing Availability Group - TSQL

  • Hi -

    I have workingSQL 2012 availability group with 2 databases.. It works like a champ.

    So, I'm trying to add another database to the group but the difference, I'm trying to manually backup and restore the database on the secondary.. The backup and restore of a full and transaction log worked successfully...

    So - on the primary node - the database (matthew) is reporting synchronized.

    On the secondary the database is in a restoring state.

    W/in the availability groups, the database is marked with yellow caution.

    From SSMS, i've right clicked and selected 'Join to Availability Group' w/ success.

    I'm receiving the following message:

    Failed to join the database Matthew to the availability group.

    BLAHBLAHBLAH...

    Availability group DDL operations and permitted only when you are using the master database.

    Run the USE MASTER command, and retry your availability-group DDL command (Error 35208)...

    LOL - Found the resolution:

    ALTER DATABASE matthew SET HADR AVAILABILITY GROUP = AVGGROUPNAME

  • I just wanted to give little bit more details on this issue.

    I ran the commands on the second server where my database was in recovering state

    use master;

    alter database DATABASE_NAME set hadr availability group = "HIGH AVAILABILITY GROUP NAME";

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply