Using pmrep to import an Informatica folder

Here’s the companion script for the “Using pmrep to export an Informatica folder” article. Use this script to import objects into PowerCenter.

One use for scripting an import would be to schedule it during off hours, for example moving development code to production during off hours. You may also need to export some objects, then do a "mass change" or Find/Replace on the XML file, then export them back in (for example, export all sessions, find/replace a connection).

Overview of ObjectImport
Here is the basic object import syntax:

pmrep objectimport -i m_mapping_name.xml  -c import_Infa_Objects_Control.txt

The pmrep objectimport function is easy to use, it is a little different however, in that you are required to use a “control file”, designated by the "-c", to define what PowerCenter folder and repository the objects will be imported into. There is an example Control File at the end of the article with important sections highlighted.

You must also use the control file to specify how to resolve conflicts, “Replace”, “Reuse”, etc., (see the RESOLVECONFLICT section). You can choose the option to generically “replace” all objects or you can specify Replace or Reuse by object type as defined in the TYPEOBJECT keyword, for example in the control file below, I choose to replace workflows but reuse schedulers.

Optionally, using the keyword TYPEFILTER, you can use the control file to filter which object types will get imported (applicable if you have a folder with many objects and various object types but only need to import a subset of those)

Script

My script has two imports options, one to import a single object and the other option will loop over a folder containing multiple objects to import , you can use either one depending on your requirement, just comment out the object import you don't need. Download the script and control file here


Example Control File

 

A word of caution, if you export Mappings that have SAP ABAP and import them back into the repository, replacing the mapping, you may have an issue where the mapping save time is newer than the ABAP generation time and the session will no longer run.

Thank you for your support
 or  PayPal



 

IMPORTANT,  YOU are responsible for backing up your systems before trying or implementing any suggestions from this blog. I do not guarantee 100% accuracy of any code examples. I do not presume to know your system environment(s) or Security requirements; all code examples from this blog should be thoroughly tested before any attempted use on a production system.

11 Response to "Using pmrep to import an Informatica folder"

  1. Vinoth 2/27/12, 8:43 AM
    Hi
    I am trying to create a dynamic query in a shell script to export all the objects retrieved from the query for a particular Label.
    That is, If i pass "Release 1" as parameter to the script it should export all the objects that are labelled Release 1.

    'Executequery' of pmrep are used to execute only saved query. Is there a possibility wherein you paramaterize the query on the fly
    Thanks,
    Dani
  2. Unknown 7/12/12, 4:42 AM
    Hi there,
    I have one thread opened in Informatica Communities and some other forums, no one was able to help me till now, maybe you can help me out? It is pretty tough though!

    Import Control File - RENAME conflict Resolution - Custom Name
    (https://community.informatica.com/thread/35661)

    Thanks,
    Carlos
  3. J. Kinzer 7/22/12, 5:08 PM
    Sorry Vinoth, I am not familiar with this feature.
  4. Saurabh 11/29/12, 10:14 PM
    Thanks for the nice post. I have a question. would the dependencies would also get import along with the workflows and mappings or we need to import them separately ?
  5. J. Kinzer 11/30/12, 10:43 PM
    Saurabh,

    Dependencies will only be Imported if they are included in the file you are importing. For example, if you use the ObjectExport cmd to export an object and specify the switches -m -s -b –r, then dependencies will be included in the exported xml file and so will be available when the file is imported.

    Please see this post for more information about ObjectExport and Dependencies

    http://jeffkinzer.blogspot.com/2010/06/using-pmrep-to-export-informatica.html

  6. Anonymous 1/3/13, 3:34 AM
    Unable to download ' Download the script and control file here' Can u plz mail me.
    rocky.trn@gmail.com
  7. Marjo Hartman 12/18/14, 4:21 AM
    This comment has been removed by the author.
  8. Marjo Hartman 12/18/14, 4:25 AM
    I want to import a workflow where objects (like mappings and lookup procedures) from a folder are to be reused, while all other objects must be replaced.

    For that I generated the following control file (XML syntax removed):

    IMPORTPARAMS RETAIN_GENERATED_VALUE="YES" CHECKIN_AFTER_IMPORT="YES" CHECKIN_COMMENTS="Deployment of tag ICC/Tags/INSIGHTS_IS1500_SFDC/CH6323_V01_ICC_DI_SFDC-20141217_182009"
    FOLDERMAP SOURCEFOLDERNAME="ICC_DI_ABAC" SOURCEREPOSITORYNAME="CanonDevDI_RS" TARGETFOLDERNAME="ICC_DI_ABAC" TARGETREPOSITORYNAME="CanonTstDI_RS"
    FOLDERMAP SOURCEFOLDERNAME="ICC_DI_SFDC" SOURCEREPOSITORYNAME="CanonDevDI_RS" TARGETFOLDERNAME="ICC_DI_SFDC" TARGETREPOSITORYNAME="CanonTstDI_RS"
    FOLDERMAP SOURCEFOLDERNAME="ICC_BP_Shared" SOURCEREPOSITORYNAME="CanonDevDI_RS" TARGETFOLDERNAME="ICC_BP_Shared" TARGETREPOSITORYNAME="CanonTstDI_RS"
    RESOLVECONFLICT
    SPECIFICOBJECT NAME="lkp_INT_METADATA_ID" OBJECTTYPENAME="Lookup Procedure" FOLDERNAME="ICC_DI_ABAC" REPOSITORYNAME="CanonTstDI_RS" RESOLUTION="REUSE"
    SPECIFICOBJECT NAME="lkp_T_INT_EXCN_LOG_Get_EXCN_ID" OBJECTTYPENAME="Lookup Procedure" FOLDERNAME="ICC_DI_ABAC" REPOSITORYNAME="CanonTstDI_RS" RESOLUTION="REUSE"
    SPECIFICOBJECT NAME="m_ABaC_ABaC_Update_Failure_EXCN_LOG" OBJECTTYPENAME="MAPPING" FOLDERNAME="ICC_DI_ABAC" REPOSITORYNAME="CanonTstDI_RS" RESOLUTION="REUSE"
    SPECIFICOBJECT NAME="m_ABaC_ABaC_Update_Success_EXCN_LOG" OBJECTTYPENAME="MAPPING" FOLDERNAME="ICC_DI_ABAC" REPOSITORYNAME="CanonTstDI_RS" RESOLUTION="REUSE"
    SPECIFICOBJECT NAME="m_ABaC_ABaC_Insert_EXCN_LOG" OBJECTTYPENAME="MAPPING" FOLDERNAME="ICC_DI_ABAC" REPOSITORYNAME="CanonTstDI_RS" RESOLUTION="REUSE"
    TYPEOBJECT OBJECTTYPENAME="ALL" RESOLUTION="REPLACE"
    RESOLVECONFLICT
    IMPORTPARAMS

    However, when importing the workflow, I get the following error:

    Folder [ICC_DI_ABAC] cannot be found in repository [CanonTstDI_RS]

    I am certain that the folder ICC_DI_ABAC exists in CanonTstDI_RS.
    When I remove the "REUSE" entries from the control file, the import is successful.

    What am I doing wrong?
  9. pavan 7/9/16, 5:13 AM
    Hi,

    I am also facing similar issue, could you please let me know how to reslove.

    Thanks & REgards,
    Pavan
  10. J. Kinzer 7/10/16, 7:47 AM
    Pavan, Marjo, I have not seen this issue before. I searched the Informatica Knowledgebase and saw KB ID 102221 which is similar. Search the KB for that id. The KB states "This error will happen when the control file used for objectImport command has an incorrect entry.
    Specifically, the REPOSITORYNAME attribute under the RESOLVECONFLICT element of the control file is given as the target repository name when it should be the source repository name. To resolve this change the REPOSITORYNAME value in the control file to the source repository name."

    jk
  11. Unknown 5/10/18, 9:21 AM
    Can you pass a variable to a input control file? I want to dynamically pass checkin comments.

Post a Comment