我有以下脚本(自动生成)来演示此问题。当我添加新作业和带有自己的命令行文本的作业步骤时,根本不会记住该作业步骤。我不知所措,或者这是Sqlserver的可靠错误。
我的工作是什么?我已经通过SSMS gui和这些脚本输入了此信息。如果您取消注释默认命令行文本,并在我自己的文本中添加BUG一词,将不会被记住。
我已经尝试了以下几种方法并阅读了可以找到的内容,但没有成功。谢谢
BEGIN TRANSACTION
DECLARE @ReturnCode INT
SELECT @ReturnCode = 0
IF EXISTS (SELECT job_id FROM msdb.dbo.sysjobs_view WHERE name = N'Poo')
EXEC sp_delete_job @job_name = N'Poo'
DECLARE @jobId BINARY(16)
EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name=N'Poo',
@enabled=1,
@notify_level_eventlog=0,
@notify_level_email=0,
@notify_level_netsend=0,
@notify_level_page=0,
@delete_level=0,
@description=N'No description available.',
@category_name=N'[Uncategorized (Local)]',
@owner_login_name=N'XXX', @job_id = @jobId OUTPUT
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
/****** Object: Step [main] Script Date: 7/01/2019 2:43:21 PM ******/
EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'main',
@step_id=1,
@cmdexec_success_code=0,
@on_success_action=1,
@on_success_step_id=0,
@on_fail_action=2,
@on_fail_step_id=0,
@retry_attempts=0,
@retry_interval=0,
@os_run_priority=0, @subsystem=N'SSIS',
/* problem here */
@command=N'/FILE "\"\\xxxx\0_Startup.dtsx\"" /CHECKPOINTING OFF /REPORTING E',
--@command=N'BUG', /* uncomment and comment above to demo */
@database_name=N'master',
@flags=0
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id=@jobId, @name=N'X',
@enabled=1,
@freq_type=4,
@freq_interval=1,
@freq_subday_type=1,
@freq_subday_interval=0,
@freq_relative_interval=0,
@freq_recurrence_factor=0,
@active_start_date=20190107,
@active_end_date=99991231,
@active_start_time=180000,
@active_end_time=235959,
@schedule_uid=N'5a413d73-5bda-4567-a90e-e7341f06a6d1'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, @server_name = N'(local)'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
COMMIT TRANSACTION
GOTO EndSave
QuitWithRollback:
IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION
EndSave:
GO
答案 0 :(得分:0)
原来配置已被正确存储,是SSMS所困扰,无法显示。
通过
验证select * from dbo.sysjobsteps