SQL Availability Groups, when move database aplication stop working

RAN55 176 Reputation points
2022-08-10T06:51:50.523+00:00

Hello,

We have a cluster SQL 2017 always on, node1 and node2. We have a database for lansweeper aplication. I put the password for the user with this SQL script:

https://www.lansweeper.com/knowledgebase/login-failed-for-user-lansweeperuser/

When we execute failover, database moves correctly but aplication fails with login error. If i set the password with the same script in the node2, works again.

But if we move again to node1, fail again.

Thanks,
Regards

SQL Server Other
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. RAN55 176 Reputation points
    2022-08-11T06:19:14.74+00:00

    At the moment, i solved my problem with this script

    https://www.sqlshack.com/synchronize-logins-between-availability-replicas-in-sql-server-always-on-availability-group/

    Now i will try a powershell dbatools taks

    Thanks to all for help :)

    1 person found this answer helpful.

  2. Seeya Xi-MSFT 16,586 Reputation points
    2022-08-10T08:15:08.88+00:00

    Hi @RAN55 ,

    Welcome to Microsoft Q&A!
    Passwords are stored in the master database. The password change succeeds on the primary but fails on the secondary because the password in the master on the current node is not reset. Unless the database is a contained database, server logins are also stored in the master database. Contained databases take care of themselves as contained users can be "logins" and are "contained" within the database, thus automatically included.

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

    0 comments No comments

  3. RAN55 176 Reputation points
    2022-08-10T08:42:56.867+00:00

    Thanks for the info.

    How can i solve my problem ? i need to be able to move database without service interruption.


  4. Bjoern Peters 8,921 Reputation points
    2022-08-10T11:32:00.09+00:00

    Following your conversation early today...

    As for SQL Server availability groups, you always have to standalone SQL Server which are using both the same feature for HA and can "share" (not necessarily all) databases and somehow connected... they are still standalone with their user and permission management as you also can host other databases that are not part of the AG.

    So you have to make sure that all users that are planning to use the AG databases exist on both/all nodes of your AG... so you have to establish a process to synchronize them.
    If you are doing this manually day by day or creating an automation for this... that is your decision
    I am using a PowerShell dbatools mechanism for that that runs every x minutes/hours

    https://docs.dbatools.io/Copy-DbaLogin

    0 comments No comments

  5. Tom Phillips 17,771 Reputation points
    2022-08-10T12:13:41.66+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.