Batch import xml to the shell script in informatica repository and shell batch comment
The objectimport command of pmrep is mainly used. When executing this command, you need to configure control file (xml file, configure some import parameters and settings)
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 after import)"CHECKIN_COMMENTS ="Comment when checking in">
<! -- FOLDERMAP matches the folders in the imported file with the folders in the target repository -->
<FOLDERMAP
SOURCEFOLDERNAME = "sourceImported folder"
SOURCEREPOSITORYNAME = "sourceImported repository"
TARGETFOLDERNAME = "targetImported folder"
TARGETREPOSITORYNAME = "targetImported repository"/>
<RESOLVECONFLICT>
(Replace, reuse ...)
<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>