PowerCenter 7.1.3 ETL UNIX Shell 脚本书写规范
2009-01-09 11:08
344 查看
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
最后,要使用返回值来标志脚本调度的成功失败。
脚本规范 (适用于 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
最后,要使用返回值来标志脚本调度的成功失败。
相关文章推荐
- ETL 脚本书写规范
- Informatica PowerCenter ETL Mappings 组件(转PPT)
- <kernel>/scripts/checkpatch.pl脚本可用来检查代码书写不规范和作一些简单的代码静态检查
- Qt在线讲座之QML脚本书写规范
- 规范unity脚本书写
- Qt在线讲座之QML脚本书写规范
- ETL抽取工具informatica powercenter designer实例(二)
- Informatica-Powercenter VS IBM-DataStage 主流ETL工具选型
- mac 系统下 使用 crontab 命令设置定时执行脚本,定时书写规范
- Informatica PowerCenter 开发规范
- 主流ETL(Extract-Transform-Load)工具选型,Kettle Spoon、Datastage、Powercenter介绍
- Informatica PowerCenter 和 ETL
- [ETL]Informatica Powercenter 介绍
- Shell脚本的书写规范与优秀的开发习惯
- 12_Shell语言―――脚本的书写规范以及检查和调试脚本
- 【ETL】缓慢变化维 - Informatica PowerCenter
- Informatica Powercenter VS IBM-DataStage 主流ETL工具
- [老欧的经验]Robotium脚本书写规范
- ETL抽取工具informatica powercenter designer实例(一)
- ETL学习手册之一-Informatica PowerCenter应用架构