大量匯入xml到informatica repository中的shell script,shell批量注釋

來源:互聯網
上載者:User

大量匯入xml到informatica repository中的shell script,shell批量注釋

主要利用pmrep的objectimport命令,該命令執行時需要配置control file(xml檔案,配置匯入的一些參數和設定)

script:

#!/bin/bash# -----------------------------------------------------------------------# Script Name: inf_impobj.sh# Purpose: To batch import mappings or workflows into repository # Created by: Indifferent_to# Date: 2014-09-30 # ----------------------------------------------------------------------function usage { cat <<EOUSAGE Usage:    inf_impobj.sh -d <folder> <user_name>  This scirpt will import the file in specified directory.It has a control file import_Infa_Objects_Control.txt and a log Infa_import.log.txt. If file import into repository successfully, script wil delete the file. If not,  the file will be moved to infa_shared/scripts/xml_dir/imp_dir. Options:    -m xml files location  Example:    inf_impobj.sh -m mluoEOUSAGE exit 1}# -----------------------------------------------------------------------case $1 in-d)IMP_PATH=$2/*.xmlshift 1;;*)usage;;esacUSE_NAME=$2i=0j=0repository="repository name"domain="repository domain"host="informatica server host name"port="informatica server port number"pmrep connect  -r $repository -h $host -o $port -n $USE_NAME -s $domain for FILE_NAME in `ls $IMP_PATH`do pmrep objectimport -i $FILE_NAME -c import_Infa_Objects_Control.txt >Infa_impobj.log if [ $? -eq 0 ] then  grep "<Error>" Infa_impobj.log  if [ $? -eq 0 ]  then  echo "$(basename $FILE_NAME) FAIL TO IMPORT"  let j=$j+1  mv -f $FILE_NAME  /error  else  echo "$(basename $FILE_NAME) IMPORT SUCCESSFULLY!"  let i=$i+1  rm $FILE_NAME  fi else echo "$(basename $FILE_NAME) FAIL TO IMPORT" let j=$j+1 mv -f $FILE_NAME  /error fidoneecho "$i success; $j fail"# --------------------------------------------------------------------


control file:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE IMPORTPARAMS SYSTEM "/home/informatica/PowerCenter910/server/bin/impcntl.dtd"> 
<!--IMPORTPARAMS This inputs the options and inputs required for import operation --> 
<!--CHECKIN_AFTER_IMPORT Check in objects on successful import operation --> 
<!--CHECKIN_COMMENTS Check in comments --> 
<!--APPLY_LABEL_NAME Apply the given label name on imported objects --> 
<!--RETAIN_GENERATED_VALUE Retain existing sequence generator, normalizer and XML DSQ current values in the destination --> 
<!--COPY_SAP_PROGRAM Copy SAP program information into the target repository --> 
<!--APPLY_DEFAULT_CONNECTION Apply the default connection when a connection used by a session does not exist in the target repository --> 
<IMPORTPARAMS CHECKIN_AFTER_IMPORT="YES(匯入完成之後check in)" CHECKIN_COMMENTS="check in時的comment"> 


<!--FOLDERMAP matches the folders in the imported file with the folders in the target repository --> 
<FOLDERMAP 
SOURCEFOLDERNAME="source匯入的folder"
SOURCEREPOSITORYNAME="source匯入的repository
TARGETFOLDERNAME="target匯入的folder"  
TARGETREPOSITORYNAME="target匯入的repository"/> 


<RESOLVECONFLICT>

(解決同名衝突的方式,替換、重用。。。)
<TYPEOBJECT OBJECTTYPENAME="WORKFLOW" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="WORKLET" RESOLUTION="REUSE"/>


<TYPEOBJECT OBJECTTYPENAME="SESSION" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="MAPPING" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="MAPPLET" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Source definition" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Target definition" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Expression" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Filter" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Aggregator" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Rank" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Normalizer" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Router" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Sequence" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Sorter" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="update strategy" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Custom Transformation" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Lookup Procedure" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Transaction control" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Stored Procedure" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="External Procedure" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Joiner" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="SessionConfig" RESOLUTION="REUSE"/>


<TYPEOBJECT OBJECTTYPENAME="Email" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Command" RESOLUTION="REPLACE"/>


<TYPEOBJECT OBJECTTYPENAME="Scheduler" RESOLUTION="REPLACE"/>
</RESOLVECONFLICT>
</IMPORTPARAMS>



相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.