答案 0 :(得分:3)
它异步运行-忘却了
这是您可以轻松验证此行为的方式。
此作业执行名为WAITFOR
的TSQL命令。我指定等待15秒。独自运行作业,并且在16秒或更短的时间内,您应该在作业历史记录报告中有一个条目,显示作业已成功运行。
USE msdb;
GO
DECLARE @jobId binary(16);
EXEC msdb.dbo.sp_add_job
@job_name = N'Run for 15 seconds'
, @enabled = 1
, @notify_level_eventlog = 0
, @notify_level_email = 2
, @notify_level_page = 2
, @delete_level = 0
, @category_name = N'[Uncategorized (Local)]'
, @owner_login_name = N'sa'
, @job_id = @jobId OUTPUT;
SELECT
@jobId;
GO
EXEC msdb.dbo.sp_add_jobserver
@job_name = N'Run for 15 seconds'
, @server_name = N'BUCKLAND\DEV2017';
GO
USE msdb;
GO
EXEC msdb.dbo.sp_add_jobstep
@job_name = N'Run for 15 seconds'
, @step_name = N'Wait for it'
, @step_id = 1
, @cmdexec_success_code = 0
, @on_success_action = 1
, @on_fail_action = 2
, @retry_attempts = 0
, @retry_interval = 0
, @os_run_priority = 0
, @subsystem = N'TSQL'
, @command = N'WAITFOR DELAY ''00:00:15'';'
, @database_name = N'master'
, @flags = 0;
GO
USE msdb;
GO
EXEC msdb.dbo.sp_update_job
@job_name = N'Run for 15 seconds'
, @enabled = 1
, @start_step_id = 1
, @notify_level_eventlog = 0
, @notify_level_email = 2
, @notify_level_page = 2
, @delete_level = 0
, @description = N''
, @category_name = N'[Uncategorized (Local)]'
, @owner_login_name = N'sa'
, @notify_email_operator_name = N''
, @notify_page_operator_name = N'';
GO
我创建了一个SSIS包,添加了Execute SQL Server Agent Job Task
类型的任务,并将其指向服务器和作业。我运行了它,并在不到两秒钟的时间内成功完成了打包程序。