INFORMATICA 的元数据管理之二:运行状态信息查询

  本项目里的两个哥们做的关于运行状态元数据的两个JOB挺酷的,最近一段时间运行状况良好,自己参考学习的同时以做日志记载,呵呵,为了节省笔墨,相关元数据表结构以及MAPPING设计之类不做介绍(如有疑问欢迎留言探讨),仅对思路做以梳理如下:

  1. 通过WKF ID和TASK ID关联对应WKF,TAST,从而形成关于SESSION运行状态报表如下:

SELECT OPB_SUBJECT.SUBJ_NAME,

       OPB_WFLOW_RUN.WORKFLOW_NAME,

       OPB_TASK_INST_RUN.INSTANCE_NAME,

       to_char(OPB_TASK_INST_RUN.START_TIME,'yyyy-mm-dd HH24:mi:ss') START_TIME,

       to_char(OPB_TASK_INST_RUN.END_TIME,'yyyy-mm-dd HH24:mi:ss') END_TIME,

       OPB_TASK_INST_RUN.RUN_ERR_MSG,

       OPB_TASK_INST_RUN.TASK_NAME,

       OPB_SWIDGINST_LOG.INSTANCE_NAME  INSTANCE_NAME_LOG,

       OPB_SWIDGINST_LOG.WIDGET_TYPE,

       APPLIED_ROWS                      SUCCESSFUL_ROWS,

       AFFECTED_ROWS                     SUCCESSFUL_AFFECTED_ROWS,

       REJECTED_ROWS                     FAILED_ROWS,

       REPLACE(LAST_ERR_MSG,Chr('44'),Chr('35'))                      LAST_ERROR

FROM INFREP_V8.OPB_TASK_INST_RUN OPB_TASK_INST_RUN, INFREP_V8.OPB_WFLOW_RUN OPB_WFLOW_RUN, INFREP_V8.OPB_SUBJECT OPB_SUBJECT, INFREP_V8.OPB_SWIDGINST_LOG OPB_SWIDGINST_LOG

 WHERE OPB_SUBJECT.SUBJ_ID = OPB_TASK_INST_RUN.SUBJECT_ID

   AND OPB_WFLOW_RUN.WORKFLOW_ID = OPB_TASK_INST_RUN.WORKFLOW_ID

   AND OPB_WFLOW_RUN.WORKFLOW_RUN_ID = OPB_TASK_INST_RUN.WORKFLOW_RUN_ID

   AND OPB_SWIDGINST_LOG.WORKFLOW_RUN_ID =

       OPB_TASK_INST_RUN.WORKFLOW_RUN_ID

   AND OPB_SWIDGINST_LOG.TASK_INSTANCE_ID = OPB_TASK_INST_RUN.INSTANCE_ID

   AND OPB_SWIDGINST_LOG.WIDGET_TYPE IN (3, 2)

   and trunc(OPB_TASK_INST_RUN.START_TIME) = trunc(SYSDATE-1,'DD')

  该QUERY显示的是前一天的SESSION运行状况报表,通过该报表可以系统的监控JOB的运行状况。

  2. 下面的QUERY是用来记录WKF的运行状况监控报表/

SELECT   rep_workflows.server_name, rep_workflows.subject_area,

         rep_workflows.workflow_name, rep_workflows.scheduler_name,

         CASE

            WHEN opb_schedule_logic.user_logic_type = 1

            AND opb_schedule_logic.frequency_intervl = 1

               THEN 'Daily Job'

            WHEN (    opb_schedule_logic.user_logic_type = 1

                  AND opb_schedule_logic.frequency_intervl > 1

                  AND opb_schedule_logic.frequency_intervl < 8

                 )

               THEN 'Weekly Job'

            ELSE 'Monthly Job'

         END job_type,

         REPLACE (SUBSTR (rep_workflows.start_time,

                          -5,

                          5

                         ),

                  '/',

                  ':'

                 ) schedule_time,

                

  

         CASE

            WHEN opb_wflow_run.run_err_code = 0 and opb_wflow_run.end_time is not null

               THEN 'Completed'

            WHEN opb_wflow_run.run_err_code = 0 and opb_wflow_run.end_time is  null

               THEN 'Running'

            WHEN opb_wflow_run.run_err_code >= 1

               THEN 'Failed'

            ELSE 'Not Start'

         END status,

         opb_wflow_run.start_time, opb_wflow_run.end_time,

         --rep_workflows.start_time,

         opb_wflow_run.run_err_code

    FROM rep_workflows LEFT JOIN opb_wflow_run

         ON opb_wflow_run.workflow_id = rep_workflows.workflow_id

       AND TRUNC (opb_wflow_run.start_time) = TRUNC (SYSDATE, 'DD')

         JOIN opb_schedule_logic

         ON opb_schedule_logic.scheduler_id = rep_workflows.scheduler_id

       AND opb_schedule_logic.version_number IN (

                        SELECT MAX (l.version_number)

                          FROM opb_schedule_logic l

                        WHERE opb_schedule_logic.scheduler_id =l.scheduler_id)

   WHERE rep_workflows.run_options > 1

   ORDER BY 1, 2, 3

 

以上仅是基于SESSION和WKF级别的监控元数据利用QUERY,如果需要设为自动每天/每周生成报表需要添加源元数据表和SQLQUALIFER组件后(一般还会过滤掉成功的状态,用FILER组件)进入目标表

然后添加个MAILTAST把运行异常状态报告表每天以邮件方式发送。

你可能感兴趣的:(Informatica)