SSISDB - 删除执行记录?
SSISDB - delete execution record?
最近生产服务器上的 SSIS 发生了某种崩溃。原因是 this 错误。崩溃后直到服务器重新启动,SQL 服务器日志中每分钟都有这样的消息:
System.IO.FileLoadException: 无法加载文件或程序集 'microsoft.sqlserver.integrationservices.server...
希望使用 link 中建议的 CLR 解决此问题。还有另一个问题:结果,在问题仍然存在时计划的所有 SSIS 包都以 SSISDB.catalog.executions 中状态为 1(“已创建”)的行结束。
这只是垃圾,几周后就会被清理干净。问题是一项关键工作首先检查相关包是否已经(仍然)运行。它是这样做的:
SELECT execution_id FROM SSISDB.catalog.executions
WHERE
package_name='The package name.dtsx' AND
status IN (1,2,5,8) -- Created, Running, Pending, Stopping
如果找到任何东西,将错误退出。
很明显这在服务器重启后失败了,因为有执行记录挂在状态 1(已创建)。
有没有办法完全删除 SSISDB 执行记录及其所有相关行?我查看了 SSISDB 存储过程(目录和内部),但找不到任何东西。
最终,它们只是 tableSSISDB 内部架构中的。
catalog.executions 定义为
CREATE VIEW [catalog].[executions]
AS
SELECT execs.[execution_id],
execs.[folder_name],
execs.[project_name],
execs.[package_name],
execs.[reference_id],
execs.[reference_type],
execs.[environment_folder_name],
execs.[environment_name],
execs.[project_lsn],
execs.[executed_as_sid],
execs.[executed_as_name],
execs.[use32bitruntime],
opers.[operation_type],
opers.[created_time],
opers.[object_type],
opers.[object_id],
opers.[status],
opers.[start_time],
opers.[end_time],
opers.[caller_sid],
opers.[caller_name],
opers.[process_id],
opers.[stopped_by_sid],
opers.[stopped_by_name],
opers.[operation_guid] as [dump_id],
opers.[server_name],
opers.[machine_name],
ossysinfos.[total_physical_memory_kb],
ossysinfos.[available_physical_memory_kb],
ossysinfos.[total_page_file_kb],
ossysinfos.[available_page_file_kb],
ossysinfos.[cpu_count]
FROM [internal].[executions] execs INNER JOIN [internal].[operations] opers
ON execs.[execution_id]= opers.[operation_id]
LEFT JOIN [internal].[operation_os_sys_info] ossysinfos
ON ossysinfos.[operation_id]= execs.[execution_id]
WHERE opers.[operation_id] in (SELECT id FROM [internal].[current_user_readable_operations])
OR (IS_MEMBER('ssis_admin') = 1)
OR (IS_SRVROLEMEMBER('sysadmin') = 1)
OR (IS_MEMBER('ssis_logreader') = 1)
status
来自internal.operationstable,别名为opers
因为懒惰,我只会更新那里的记录,这样就可以让状态不再影响我,而不是试图追踪存储子属性的所有角落和缝隙。
update opers
-- The status of the operation. The possible values are
-- created (1), running (2), canceled (3), failed (4), pending (5),
-- ended unexpectedly (6), succeeded (7), stopping (8), and completed (9).
SET status = 6 /* or 9 */
FROM
[internal].[operations] opers
WHERE
opers.operation_id = 0 /* your TODO use the correct operation_id/execution_id there */
AND opers.status IN (1,2,5,8); -- Created, Running, Pending, Stopping
如果你确实想删除,我认为这仍然是相关的
How can I clean up the SSISDB?
最近生产服务器上的 SSIS 发生了某种崩溃。原因是 this 错误。崩溃后直到服务器重新启动,SQL 服务器日志中每分钟都有这样的消息:
System.IO.FileLoadException: 无法加载文件或程序集 'microsoft.sqlserver.integrationservices.server...
希望使用 link 中建议的 CLR 解决此问题。还有另一个问题:结果,在问题仍然存在时计划的所有 SSIS 包都以 SSISDB.catalog.executions 中状态为 1(“已创建”)的行结束。
这只是垃圾,几周后就会被清理干净。问题是一项关键工作首先检查相关包是否已经(仍然)运行。它是这样做的:
SELECT execution_id FROM SSISDB.catalog.executions
WHERE
package_name='The package name.dtsx' AND
status IN (1,2,5,8) -- Created, Running, Pending, Stopping
如果找到任何东西,将错误退出。
很明显这在服务器重启后失败了,因为有执行记录挂在状态 1(已创建)。
有没有办法完全删除 SSISDB 执行记录及其所有相关行?我查看了 SSISDB 存储过程(目录和内部),但找不到任何东西。
最终,它们只是 tableSSISDB 内部架构中的。
catalog.executions 定义为
CREATE VIEW [catalog].[executions]
AS
SELECT execs.[execution_id],
execs.[folder_name],
execs.[project_name],
execs.[package_name],
execs.[reference_id],
execs.[reference_type],
execs.[environment_folder_name],
execs.[environment_name],
execs.[project_lsn],
execs.[executed_as_sid],
execs.[executed_as_name],
execs.[use32bitruntime],
opers.[operation_type],
opers.[created_time],
opers.[object_type],
opers.[object_id],
opers.[status],
opers.[start_time],
opers.[end_time],
opers.[caller_sid],
opers.[caller_name],
opers.[process_id],
opers.[stopped_by_sid],
opers.[stopped_by_name],
opers.[operation_guid] as [dump_id],
opers.[server_name],
opers.[machine_name],
ossysinfos.[total_physical_memory_kb],
ossysinfos.[available_physical_memory_kb],
ossysinfos.[total_page_file_kb],
ossysinfos.[available_page_file_kb],
ossysinfos.[cpu_count]
FROM [internal].[executions] execs INNER JOIN [internal].[operations] opers
ON execs.[execution_id]= opers.[operation_id]
LEFT JOIN [internal].[operation_os_sys_info] ossysinfos
ON ossysinfos.[operation_id]= execs.[execution_id]
WHERE opers.[operation_id] in (SELECT id FROM [internal].[current_user_readable_operations])
OR (IS_MEMBER('ssis_admin') = 1)
OR (IS_SRVROLEMEMBER('sysadmin') = 1)
OR (IS_MEMBER('ssis_logreader') = 1)
status
来自internal.operationstable,别名为opers
因为懒惰,我只会更新那里的记录,这样就可以让状态不再影响我,而不是试图追踪存储子属性的所有角落和缝隙。
update opers
-- The status of the operation. The possible values are
-- created (1), running (2), canceled (3), failed (4), pending (5),
-- ended unexpectedly (6), succeeded (7), stopping (8), and completed (9).
SET status = 6 /* or 9 */
FROM
[internal].[operations] opers
WHERE
opers.operation_id = 0 /* your TODO use the correct operation_id/execution_id there */
AND opers.status IN (1,2,5,8); -- Created, Running, Pending, Stopping
如果你确实想删除,我认为这仍然是相关的 How can I clean up the SSISDB?