ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 粤磊 informatica powercenter学习笔记(十六)

粤磊 informatica powercenter学习笔记(十六)

原创 Linux操作系统 作者:vzyuelei9 时间:2011-06-20 21:49:50 0 删除 编辑

      INFORMATICA  的调度管理  

 

今天总结下关于INFA的调度工具SCHEDULE

1 INFA自带的SCHEDULE工具可以通过图形化界面来对WKF级别进行具体SCHEDULE设置,基于每天/ 定时启动,类似于WINDOWSSCHEDULE TASK,呵呵,不过INFA还可以设计些SCHEDULE模板,定义WKF SCHUDULE时可以选择对应模板。

2 INFA既然可以用PMCMD之类的命令通过脚本来实现启动,当然也可以在OS级别设置对应的SCHEDULE来定时启动对应脚本,启动对应WKF

下面简要介绍下crontab +shell 的调度实例

1 设置对应的配置文件,用户系统级的PROFILE,和对应的ENV文件

set -u

 

. /opt/app/etl/bin/workflow_env.env

 

# Setup the Oracle environment

# Setup the basic Informatica environment

#PM_HOME, PM_REPHOME are important to run the command line versions of informatica

#Do not rename these variables otherwise we may get error like

#FATAL ERROR during initialization:

#Error initializing /u01/app/informatica/powercenter714/pmlocale.bin

export INFA_HOME=/opt/app/informatica/powercenter86

export PM_DOMAIN=Domain_servername

export PM_INTEG_SRVR=servername

export PM_USERNAME=Administrator

export PM_PASSWORD='******

#export PM_LOGIN="-u $PM_USERNAME -p $PM_PASSWORD -serveraddr localhost:4001"

export PM_LOGIN="-sv $PM_INTEG_SRVR -d $PM_DOMAIN -uv PM_USERNAME -pv PM_PASSWORD"

export DBCHOME=/opt/app/informatica/odbc4.2

export DBCINI=/opt/app/informatica/odbc4.2/odbc.ini

………

2 编辑EXCUTE WKFSHELL  exec_workflow.ksh

 

# Description:  This script. runs Informatica workflow from a folder based on parameters.

#

# Usage:        exec_workflow.ksh folder workflow

#                 Parameter 1 = The Informatica folder

#                 Parameter 2 = The Informatica workflow name

#

#                 Example:  $ exec_workflow.ksh "FOLDER" "Workflow_NAME"

 

 

#STEP000

#Description: Run the Informatica workflow

#             Note:  No need to test for $1 and $2 as the -xvu options

#             are enabled so  will show any

#             parameter problems.

#

#---------------------------------------------------------------------

#

date

 

FOLDER=$1

WORKFLOW=$2

#pmcmd startworkflow $PM_LOGIN -wait -folder "$FOLDER" $WORKFLOW

$INFA_HOME/server/bin/pmcmd startworkflow $PM_LOGIN -wait -folder "$FOLDER" $WORKFLOW

STATUS=$?

exit

if [[ $STATUS -ne 0 ]] ; then

    echo =============================================================

    echo STEP000: Job aborted in Informatica

    echo =============================================================

    bdf

    echo =============================================================

    echo STEP000: Informatica workflow log

    echo =============================================================

    WORKFLOW_LOG=`ls -t $PM_HOME/WorkflowLogs/$WORKFLOW* | head -1`

    cat $WORKFLOW_LOG

    echo =============================================================

    echo STEP000: Informatica session logs with errors

    echo =============================================================

    for i in `grep "ERROR" $WORKFLOW_LOG | grep "Session task instance \[" | cut -d[ -f2  | cut -d] -f1 | sort | uniq`

    do

      FILE=`ls -t /var/opt/etl/SessLogs/${i}* 2> /dev/null | head -1`

      if [[ -s $FILE ]] ; then

        echo ========= Output of $FILE ==========

        cat $FILE

        echo ========= Output of $FILE ==========

      fi

    done

    echo =============================================================

 

    exit 1

fi

date

echo ********** STEP000 - END **********

 

#---------------------------------------------------------------------

#

#

echo  ******* E N D   O F   J O B *******

 

3 创建加载数据的SHELL脚本 LOAD_DATA.SH

 

#!/bin/ksh

set -x

. `dirname $0`/env.cfg

server_parameter_file=$parm_dir/avl_server.par

ovr_list=$1

cnt=1

cat `dirname $0`"/"$ovr_list|while read collection_srvr db_connection

do

 

echo $collection_srvr, $db_connection

 

[AFODLERE.WF:Workflow_Availability_Server_Unpln_Dntm.WT:Worklet_Fact_Extract.ST:s_m_avl_unpln_dntm_srvr_lvl0]

\$\$EXTRACTION_FILTER=WHERE status = 0 and datetime >= dateadd(d,-100,GETDATE())

\$\$SOURCE_NM=OVSR

\$\$AVL_INFRA_MODULE=server

\$DBConnection_OVR=$db_connection

[AFODLERE.WF:Workflow_Availability_Server_Unpln_Dntm.WT:Worklet_Dimension_Extract.ST:s_m_avl_srvr_grp_lvl0]

\$DBConnection_OVR=$db_connection

Ø       $server_parameter_file

#Load Common module only once

if [ $cnt -eq 1 ] ; then

$common_etl_dir/exec_workflow.ksh Availability Workflow_Availability_Server_Pln_Dntm

check_error $? 1 "Workflow_Availability_Server_Pln_Dntm failed in folder Availability"

cnt=0

fi

 

$common_etl_dir/exec_workflow.ksh Availability Workflow_Availability_Server_Unpln_Dntm

check_error $? 0 "Workflow_Availability_Server_Unpln_Dntm failed in folder Availability for $db_connection and $collection_srvr"

done

 

4 建立脚本取值的参数文件OVR_LIST

ovrlist--------------------

---------------------------------------------------------------------

 

qroovrprd01.omc.hp.com OVR_qroovrprd01

 

5 建立CRONTAB利用系统平台定期调度执行

00 5 * * * /opt/app/etl/bin/load_data.ksh ovr_list>/opt/app/etl/log/$$.log

其实以上本质也就是设置环境变量,PMCMD执行脚本,PARAMETER生成脚本,WKF/SESSION使用连接信息参数值文件。 对于CRONTAB调度就没什么好讲的了,呵呵。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22377317/viewspace-700335/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-09-01

  • 博文量
    17
  • 访问量
    53458