The main use of the Pmrep objectimport command, which requires configuration of the control file (XML file, configuration of some parameters and settings of the import)
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 would 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 would be moved to Infa_shared/scripts/xml_dir/imp_dir. Options:-m XML files location Example:inf _impobj.sh-m Mluoeousage exit 1}# case $----------------------------------------------------------------------- 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 ' L s $IMP _path ' do pmrep objectimport-i $FILE _name-c import_infa_objects_control.txt >infa_impobj.log if [$?-eq 0] The n 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 fidone echo "$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 is a session does not exist in the tar Get Repository--
<importparams checkin_after_import= "YES(check in after import is complete)"Checkin_comments="Check in Time comment">
<!--Foldermap matches the folders in the imported file with the folders in the target repository-
<foldermap
Sourcefoldername= "sourcethe imported folder"
Sourcerepositoryname= "sourceImported Repository"
Targetfoldername= "targetthe imported folder"
Targetrepositoryname= "targetImported Repository"/>
<RESOLVECONFLICT>
(resolve conflicts of the same name in the same way, 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>
Bulk import of XML into the shell script in Informatica repository