possibility of auto sync of SQL logins and SQL jobs from primary to secondary in always on

Rajesh Kumar 5 Reputation points
2023-06-13T13:25:04.0933333+00:00

auto sync of SQL logins and SQL jobs from primary to secondary in always on

SQL Server Other
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-06-13T22:01:04.1466667+00:00

    If you are on SQL 2022, you can create a Contained Availability Group to relieve yourself from this problem.


  2. ZoeHui-MSFT 41,491 Reputation points
    2023-06-14T07:22:20.13+00:00

    Hi @Rajesh Kumar,

    You might find this article Synchronize logins between Availability replicas in SQL Server Always On Availability Groups helpful.

    Depending on how many Secondary Replicas you are planning to setup, or if you have an affinity to SSIS, you might find it cleaner and more manageable to create an SSIS Package that does all of this (which is also discussed in the first article above) as opposed to using Linked Servers.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


  3. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-06-14T21:07:49.26+00:00

    Also can you suggest whether we could move the jobs created in primary can be moved to secondary?

    You can script them in SSMS and then copy to the other server.

    You will need to add something to prevent the job from running on the secondary. A common way is to have a first job step which attempts to access the database. Then you mark the step as "quit the job and report success" in case of an error. The second step of the job has the real action.


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.