MSSQL辅助服务器在AG组中的SQL代理作业仍然能够运行脚本两次
我们有一个针对2服务器A(主要),B(次要)的AG组设置 A,B具有SQL代理工作相同的
设置 当试图访问数据库时(由于目标数据库,参与可用性组,目前无法访问查询的DB时,B Job的第一步失败了。)
一旦故障转移和B成为主要。我们注意到A& B SQL代理作业也成功运行,因此作业运行了两次。
我们尝试通过添加printing @@ servername变量来修改SQL代理作业中的脚本,我们发现A& B SQL代理作业也在打印B(现在是主要的)Servername。 B(主)服务器也可能运行2个作业。
解决的唯一方法是目前仅重新启动SQL代理服务。想知道还有其他解决方案吗?
SQL Server版本为13.0.5888.11,
以下问题类似于我的,但尚无解决方案 [https://stackoverflow.com/questions/47433964/sql-server-ag--gant-jobs-successcesscesscess-onecondary-replica] [1]
We have a AG Group setup for 2 server A (Primary) ,B (Secondary)
A,B have identical setup for sql agent job
A job run successful and
B job's failed in initial step when trying to access the db (Due to The target database , is participating in an availability group and is currently not accessible for queries.)
Once A failover and B become Primary. We notice a behaviour that A & B sql agent Job also running successfully, so the job run twice.
We tried to modify script in sql agent Job, by adding printing @@servername variable, we found that A & B sql agent job are also printing B(now is primary) servername. Likely 2 job are also running in B(primary) server.
The only way to resolve is currently just to restart the sql agent service. Would like to know if any other solution?
SQL server version is 13.0.5888.11
Below Issue is similar to mine, but no solution yet
[https://stackoverflow.com/questions/47433964/sql-server-ag-agent-jobs-running-successfully-on-secondary-replica][1]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我想运行一个脚本作为作业,我会在下面的脚本中运行它。
它检查AOAG首选复制品的状态是否为真。
它适合我的需求,但要注意,作为一项工作,它将在次级上成功完成,但不会在
begin/end/end
中运行脚本!If I want to run a script as a job I run it inside the below script.
It checks if the status of the AOAG preferred replica is true.
It works for my needs but be aware, as a job it will complete as successful on the secondary but will not run the script inside the
Begin/End
!