AlwaysON作业有效 - 被动 [英] AlwaysON job active-Passive

查看:314
本文介绍了AlwaysON作业有效 - 被动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一些团队总是有一些工作。我想知道是否可以在主动被动模式下实现它,如果监听器在主节点上,它在那里保持活动,并在二级停留禁用。当收听者自动切换时,在
" primary"上禁用它并在"二级"上激活它。

i have some cluster alwayson with some job. I wolud like to know if is possible to implement it in active passive mode, if listener is on primary node, it stay active there, and on secondary stay disable. When listener automatically switch, disable it on "primary" and active it on "secondary" .

可以吗?

谢谢

推荐答案

创建第一个在您的SQL代理作业中执行以下操作:

Create a first step in your SQL Agent job which runs this:

DECLARE @result INT;

SET @result = (select sys.fn_hadr_is_primary_replica ( 'your datbase name' ) )

IF @result = 0
	RAISERROR('Server not primary for database',16,0);

在高级属性中设置"On failure action:"; "退出作业报告成功"。

And in Advanced properties set "On failure action:" to "Quit the job reporting success".

然后作业只能在主服务器上运行。

Then the job will only run on the primary server.


这篇关于AlwaysON作业有效 - 被动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆