• 根据执行计划查询执行的机器信息


    SELECT   
        c.session_id, c.net_transport, c.encrypt_option,   
        c.auth_scheme, s.host_name, s.program_name,   
        s.client_interface_name, s.login_name, s.nt_domain,   
        s.nt_user_name, s.original_login_name, c.connect_time,   
        s.login_time,q.text
    FROM sys.dm_exec_connections AS c  
    JOIN sys.dm_exec_sessions AS s  
        ON c.session_id = s.session_id  
    cross apply fn_get_sql(most_recent_sql_handle) q
    where program_name<>'10_10_10_26_SZV2_TEST'
    order by connect_time desc 
    SELECT
        [jop].[job_id] AS '作业唯一标识符'
       ,[jop].[name] AS '作业名称'
       ,[dp].[name] AS '作业创建者'
       ,[cat].[name] AS '作业类别'
       ,[jop].[description] AS '作业描述'
       , CASE [jop].[enabled]
            WHEN 1 THEN ''
            WHEN 0 THEN ''
          END AS '是否启用'
       ,[jop].[date_created] AS '作业创建日期'
       ,[jop].[date_modified] AS '作业最后修改日期'
       ,[sv].[name] AS '作业运行服务器名称'
       ,[step].[step_id] AS '作业起始步骤'
       ,[step].[step_name] AS '步骤名称'
       , CASE
            WHEN [sch].[schedule_uid] IS NULL THEN ''
              ELSE ''
          END AS '是否分布式作业'
       ,[sch].[schedule_uid] AS '作业计划的唯一标识符'
       ,[sch].[name] AS '作业计划的用户定义名称'
       , CASE [jop].[delete_level]
            WHEN 0 THEN '不删除'
            WHEN 1 THEN '成功后删除'
            WHEN 2 THEN '失败后删除'
            WHEN 3 THEN '完成后删除'
          END AS '作业完成删除选项'
    FROM [msdb].[dbo].[sysjobs] AS [jop]
    LEFT JOIN [msdb].[sys].[servers] AS [sv]
             ON [jop].[originating_server_id] = [sv].[server_id]
    LEFT JOIN [msdb].[dbo].[syscategories] AS [cat]
             ON [jop].[category_id] = [cat].[category_id]
    LEFT JOIN [msdb].[dbo].[sysjobsteps] AS [step]
             ON [jop].[job_id] = [step].[job_id]
                AND [jop].[start_step_id] = [step].[step_id]
    LEFT JOIN [msdb].[sys].[database_principals] AS [dp]
             ON [jop].[owner_sid] = [dp].[sid]
    LEFT JOIN [msdb].[dbo].[sysjobschedules] AS [jsch]
             ON [jop].[job_id] = [jsch].[job_id]
    LEFT JOIN [msdb].[dbo].[sysschedules] AS [sch]
             ON [jsch].[schedule_id] = [sch].[schedule_id]
    ORDER BY [jop].[name]
  • 相关阅读:
    2017-2018-1 20145237、20155205、20155218实验一 开发环境的熟悉
    作业三总结
    作业二总结
    作业总结1
    自我介绍
    计科16-4刘悦
    第九次作业
    作业八
    作业七
    作业六
  • 原文地址:https://www.cnblogs.com/weiweictgu/p/7453565.html
Copyright © 2020-2023  润新知