question

SurendraAdhikari-2570 avatar image
0 Votes"
SurendraAdhikari-2570 asked SurendraAdhikari-2570 commented

add database to AG failed in one replica

I added a database in AG with 4 replicas (3 secondary replicas). The database was successfully added in 2 replicas but one. Now how can I add the database in that replica only?

sql-server-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi SuredraAdhikari-2570,
How are things going? Does the answer help you?
Please feel free to let us know if you have any other question.
If you find any post in the thread is helpful, you could kindly accept it as answer.

Best Regards,
Amelia

0 Votes 0 ·

1 Answer

AmeliaGu-msft avatar image
0 Votes"
AmeliaGu-msft answered SurendraAdhikari-2570 commented

Hi SurendraAdhikari-2570,

The database was successfully added in 2 replicas but one. Now how can I add the database in that replica only?

So you have joined the secondary replica to the availability group, and have prepared the secondary database in the secondary replica, right?
If so, please go to the secondary replica, in Object Explorer, Expand the Always On High Availability node ->the Availability Groups->expand the Availability Databases node, Right-click the database, and click Join to Availability Group.

133014-image.png

Or use the query in the secondary replica:

 ALTER DATABASE database_name SET HADR AVAILABILITY GROUP = group_name

Best Regards,
Amelia


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (149.8 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks Amelia.
I tried your method but ended up with the following error.
The remote copy of database "db name" has not been rolled forward to a point in time that is encompassed in the local copy of the database log.

0 Votes 0 ·
AmeliaGu-msft avatar image AmeliaGu-msft SurendraAdhikari-2570 ·

Hi SuredraAdhikari-2570,
Thanks for your reply.

The remote copy of database "db name" has not been rolled forward to a point in time that is encompassed in the local copy of the database log.

Please try to restore a recent database backup of the primary database and subsequent log backups onto the secondary replica, using RESTORE WITH NORECOVERY. And then in the secondary replica, join the seocndary database into the availability group again.

Best Regards,
Amelia


0 Votes 0 ·

Thanks Amelia. It worked for me.

0 Votes 0 ·