ITPub博客

首页 > 数据库 > Oracle > PowerCenter 7.1.3 ETL UNIX Shell 脚本书写规范

PowerCenter 7.1.3 ETL UNIX Shell 脚本书写规范

原创 Oracle 作者:RockJack 时间:2007-12-04 11:35:44 0 删除 编辑

PowerCenter 7.1.3 ETL UNIX Shell 脚本书写规范

脚本规范 (适用于 PowerCenter version 7.1.3):

标准脚本中,由两部分组成:

Ø UNIX Shell 脚本

调度工具通过运行此脚本以实现对PowerCenter工作流的调度。

Ø 独立文件

这个文件里包含了调度脚本中所需要的参数,用户名,用户密码

下面是脚本的模板,脚本名称是etl_unix_shell_script.sh

# Program: etl_unix_shell_script.sh

# Author: Kevin Gillenwater

# Date: 7/24/2003

# Purpose: Sample UNIX shell script to load environment variables

# needed to run PowerMart jobs, pass username and password variables

# and start the job using the pmcmd command line.

#

# $1 = Project Id Parameter (ie. ud, hr, dss, siq, etc.)

#

# Example usage: etl_unix_shell_script.sh dss

#

# NOTE: Enter the Project ID parameter that is designated in the

# directory structure for your team

# (ie. dss would be used for the DWDAS team as the

# directory is /usr/local/autopca/dss/)

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

# Call the script to set up the Informatica Environment Variables:

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

. /usr/local/bin/set_pm_var.sh

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

# Read ETL configuration parameters from a separate file:

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

ETL_CONFIG_FILE=$JOBBASE/$1/remote_accts/test_etl.config

ETL_USER=`grep ETL_USER $ETL_CONFIG_FILE | awk -F: '{print $2}'`

ETL_PWD=`grep ETL_PWD $ETL_CONFIG_FILE | awk -F: '{print $2}'`

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

# Start the job

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

$PM_HOME/pmcmd startworkflow -u $ETL_USER -p $ETL_PWD -s $MACHINE:4001 -f DWDAS_

LOAD_dssqa –wait s_m_CENTER_INSTITUTE

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

# Trap the return code

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

rc=$?
if [[ $rc -ne 0 ]] then
exit $rc
fi

脚本中需注意的问题Notes Regarding the Script/Standards:

1. 每个脚本运行时,都要先执行set_pm_var.sh ,来为PowerCenter Session 中的环境变量赋值,这个配置脚本为PowerCenter的变量维护提供了便利。下面是脚本的模板:
# Program: set_pm_var.sh

# Author: Kevin Gillenwater

# Date: 7/3/2003

# Purpose: UNIX script which sets the variables for running PowerMart 6.2

# when called from a shell script (ie. script run by Autosys).

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

#Set up the Informatica Variables

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

export MACHINE=`hostname`

export SHLIB_PATH=/usr/local/pmserver/informatica/pm/infoserver

export PM_HOME=/usr/local/pmserver/informatica/pm/infoserver

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

# Set the environment variables needed for scheduling jobs.

# The value of JOBBASE differs based on the account. For AUTOSYS

# and AUTODBA, the variable should evaluate to /usr/local/autopca.

# For all other accounts, it should evaluate to their $HOME variable.

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

case $HOME in

/home/autopca/autopca) JOBBASE=/usr/local/autopca ;;

/home/autopca/autodba) JOBBASE=/usr/local/autopca ;;

*) JOBBASE=$HOME ;;

esac

export JOBBASE

2. 第二部分,为调度工作流所用的参数用户名和用户密码赋值,因为用户名和密码不能存储在这个运行的脚本中。这个模板中就是test_etl_config 包含了这两个参数的值,下面是test_etl_config 内容:

ETL_USER:etlguy

ETL_PWD:ou812

这个文件必须要存储在组内的远程管理文件夹下(i.e. /usr/local/autopca/dss/remote_accts/). 只有PowerCenter管理员才有进入这个文件夹的权限。所以这个文件的权限设置应该是 6-4-0 (rw,r,-)

3. 第三部分,脚本中调度工作流的命令,这样调度其他的工作流时,只需给改参数即可。

例如:

DWDAS_LOAD_dssqa wflw_m_CENTER_INSTITUTE

最后,要使用返回值来标志脚本调度的成功失败。[@more@]

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

请登录后发表评论 登录
全部评论

注册时间:2010-08-14

  • 博文量
    30
  • 访问量
    61768