SQL Server代理作业:如何在不执行整个作业的情况下执行作业步骤

时间:2021-01-26 09:17:50

I have a SQL Server Agent Job that previously had two steps. Today, I've had to integrate a third step and soon I'll need to integrate a fourth.

我有一个以前有两个步骤的SQL Server代理作业。今天,我必须整合第三步,很快我就需要整合第四步。

I want to be sure that the step will execute properly but I do not want to execute the entire job.

我想确保步骤正确执行,但我不想执行整个工作。

The first two steps take quite a bit of time to execute and during the day they hog a significant amount of the SQL resources that my user's need.

前两个步骤需要相当多的时间来执行,并且在白天他们占用了我的用户所需的大量SQL资源。

Is there a way that I can execute a job step and not an entire job process?

有没有办法可以执行工作步骤而不是整个工作流程?

Within SSMS, if I right-click on the job there is an option that states "Start Job at step..." except when I try that options it brings up a dialog that seems to imply that the entire job has been started. What can I do to test one step within a job?

在SSMS中,如果我右键单击作业,则会有一个选项,指出“在步骤中启动作业...”,除非我尝试该选项时会显示一个似乎暗示整个作业已启动的对话框。我可以做些什么来测试工作中的一个步骤?

Thanks in advance.

提前致谢。

3 个解决方案

#1


15  

"Start job at step" will start the job at the step you specify. However - if you don't wish to execute any subsequent steps - be sure to adjust the step logic so that it will "Quit reporting success" after completing the step you started at.

“在步骤中启动作业”将在您指定的步骤中启动作业。但是 - 如果您不希望执行任何后续步骤 - 请务必调整步骤逻辑,以便在完成您开始的步骤后“退出报告成功”。

#2


1  

Use this:

用这个:

EXEC msdb.dbo.sp_start_job N'job_name' , 'step_name'

#3


0  

Go to job properties and manually do that step. For example, there is a job with 16 steps and you want to run the 12th step, then go to that job property and see what that step 12 exactly does. If it executes a batch file in command prompt, do that manually. But this logic cannot be used in all cases.

转到作业属性并手动执行该步骤。例如,有一个包含16个步骤的作业,您希望运行第12步,然后转到该作业属性,看看步骤12到底做了什么。如果它在命令提示符下执行批处理文件,请手动执行。但是这种逻辑不能用于所有情况。

#1


15  

"Start job at step" will start the job at the step you specify. However - if you don't wish to execute any subsequent steps - be sure to adjust the step logic so that it will "Quit reporting success" after completing the step you started at.

“在步骤中启动作业”将在您指定的步骤中启动作业。但是 - 如果您不希望执行任何后续步骤 - 请务必调整步骤逻辑,以便在完成您开始的步骤后“退出报告成功”。

#2


1  

Use this:

用这个:

EXEC msdb.dbo.sp_start_job N'job_name' , 'step_name'

#3


0  

Go to job properties and manually do that step. For example, there is a job with 16 steps and you want to run the 12th step, then go to that job property and see what that step 12 exactly does. If it executes a batch file in command prompt, do that manually. But this logic cannot be used in all cases.

转到作业属性并手动执行该步骤。例如,有一个包含16个步骤的作业,您希望运行第12步,然后转到该作业属性,看看步骤12到底做了什么。如果它在命令提示符下执行批处理文件,请手动执行。但是这种逻辑不能用于所有情况。