Is it possible to enable or disable the sql server agent using t-sql?
是否可以使用t-sql启用或禁用sql server代理?
2 个解决方案
#1
30
exec msdb..sp_update_job @job_name = 'Job Name', @enabled = 0 --Disable
exec msdb..sp_update_job @job_name = 'Job Name', @enabled = 1 --Enable
#2
0
You can use this to set it ON or OFF
您可以使用它将其设置为ON或OFF
EXEC xp_servicecontrol N'stop',N'SQLServerAGENT'
EXEC xp_servicecontrol N'start',N'SQLServerAGENT'
#1
30
exec msdb..sp_update_job @job_name = 'Job Name', @enabled = 0 --Disable
exec msdb..sp_update_job @job_name = 'Job Name', @enabled = 1 --Enable
#2
0
You can use this to set it ON or OFF
您可以使用它将其设置为ON或OFF
EXEC xp_servicecontrol N'stop',N'SQLServerAGENT'
EXEC xp_servicecontrol N'start',N'SQLServerAGENT'