【sqlserver】查询维护相关日志

1、查看作业历史记录

SELECT TOP 1000 [instance_id]
      ,[job_id]
      ,[step_id]
      ,[step_name]
      ,[sql_message_id]
      ,[sql_severity]
      ,[message]
      ,[run_status]
      ,[run_date]
      ,[run_time]
      ,[run_duration]
      ,[operator_id_emailed]
      ,[operator_id_netsent]
      ,[operator_id_paged]
      ,[retries_attempted]
      ,[server]
  FROM [msdb].[dbo].[sysjobhistory]



2.查看维护计划日志

SELECT TOP 1000 [task_detail_id]
      ,[plan_id]
      ,[subplan_id]
      ,[start_time]
      ,[end_time]
      ,[succeeded]
      ,[logged_remotely]
      ,[source_server_name]
      ,[plan_name]
      ,[subplan_name]
  FROM [msdb].[dbo].[sysmaintplan_log]



3.查看维护计划日志详情

SELECT TOP 1000 [task_detail_id]
      ,[line1]
      ,[line2]
      ,[line3]
      ,[line4]
      ,[line5]
      ,[server_name]
      ,[start_time]
      ,[end_time]
      ,[error_number]
      ,[error_message]
      ,[command]
      ,[succeeded]
  FROM [msdb].[dbo].[sysmaintplan_logdetail]




你可能感兴趣的:(【sqlserver】查询维护相关日志)