Using pmrep to export an Informatica folder
Sometimes you need to export the contents of a PowerCenter folder for offline storage. This post will show you how to quickly export a PowerCenter folder's contents using the pmrep command's ObjectExport function.
The nice thing about this tip is I give you a script (download here) that will export a folder's contents as individual XML files and export one XML file containing all the folder's contents. This gives you flexibility when you need to import the objects back into the repository, you can pick and choose from the individual files or import all the folder's contents with the one file.
A note on methodology, there are many ways to accomplish this task, the technique I’m going to demonstrate is my preferred method.
This tip assumes you have some experience with scripting on MS Windows Server and you are moderately familiar with the PowerCenter “pmrep” command. I encourage you to further research the pmrep command and its functions, you can find more information in the PowerCenter Command Guide.
Overview of ObjectExport
If you are not familiar with pmrep's ObjectExport function, here's a look at the syntax:pmrep ObjectExport -n objName -o objType -f FolderName -m -s -b -r -u objName.xmlObjectExport exports objects by name, to export multiple objects from a folder you can either supply names one at a time, re-executing the command for each name or you can supply an input file containing a list of object names. You also must supply the object name's folder (-f). The last parameter is the output file name.
ObjectExport creates XML that can be imported back into PowerCenter. The switches -m -s -b –r are required to get dependent objects (tables, shortcuts, non-reusable objects) for the object you are exporting. For some objects, if you do not export its dependent objects, it will not re-import into the repository correctly.
Create A List Of Objects
My script uses an input file to supply the list of objects to export. I created the list by executing a PowerCenter Query and filtering on Object type FOLDER and my folder name.You could also use the pmrep function's ListObjects or ListObjectDependencies to create your input file but I like the format of the output file created by the Query.
To create a query: open PowerCenter Designer (or Repository Manager or any of the tools) and select the menu options: Tools > Queries.
On the resulting dialog, click New to create a new query. For "Query Conditions" fill in the following:
Variable | Value |
---|---|
Query Name | Folder_Backup |
Query Type | Shared |
Parameter Name | Folder |
Operator | Is Equal To |
Value 1 | our_folder |
Save the Query and run a test to see the results are what you expect.
To save the query results to an output file your ObjectExport script can use, you can manually save the results (File > Export) or execute the query within a script using this syntax:
pmrep executequery -q %INFA_QUERY_NAME% -t shared -u %OUTPUT_PATH%\export_results.txt
Script
Now that we have a file containing a list of folder contents, it's a simple matter of "reading" the file and executing pmrep ObjectExport for each object name in the file.Here's the (Windows batch script) syntax for reading the query output and executing pmrep ObjectExport. The pmrep ObjectExport syntax shown below is the same as above except parameter values are used for name, object type and folder.
FOR /F "tokens=2,3,4* delims=, " %%i in (query_results.txt) do pmrep ObjectExport -n %%j -o %%k -f %%i -m -s -b -r -u %%j.xmlTo output one xml that represents all objects in a folder, change the pmrep ObjectExport –n switch to –i query_results.txt and remove the switches –o and –f
pmrep ObjectExport -i query_results.txt -m -s -b -r -u All_Folder_Objects.xmlThe script for this article puts all the pieces together for you, including the a statement for executing the query.
Caveats
This article's script uses the environment variable technique described here. To run the script you would have to implement the env. variables or hard code the values.Conclusion
I hope you find this tip (and script file) useful. If you have questions or suggestions post them as a comment below.Thank you for your support
or |
as said "You could also use the pmrep function's ListObjects or ListObjectDependencies to create your input file but I like the format of the output file created by the Query."
But I could not find an option to write the output of the ListObjects or ListObjectDependencies to a file. Can you share that info?
pmrep listobjects -f arjun -o workflow> C:\wf.txt
See the Informatica KB article # 16595 for more on this
Thanks Again,
Suneel
http://jeffkinzer.blogspot.com/2012/01/using-pmrep-to-import-informatica.html
While importing the exported file as described by you , I am getting an error in parsing of xml file . I am using 9x version of informatica .
I have a folder SALES_INFO. There are 25 workflows in it. But I want to export only 10 workflows. What should be the syntax of pmrep for this scenario? Can I take those 10 names manually into a textfile and supply that textfile as input in pmrep objectexport command ?
Thanks,
FOR /F "tokens=2,3,4,5,6* delims=, " %%i in (%OUTPUT_PATH%\query_results.txt) do pmrep ObjectExport -n %%j -o %%k -t %%l -f %%i -m -s -b -r -u %OUTPUT_PATH%\xml\%%j.xml >>%OUTPUT_PATH%\objExport_log.txt
I will change the download file
Thank for this great article, which is very helpful.
However I have an issue with objectnames containing Æ,Ø and Å (danish letters).
When exporting to separate files it fails:
Informatica(r) PMREP, version [9.5.1 HotFix2], build [231.0621], Windows 64-bit
Copyright (c) Informatica Corporation 1994 - 2013
All Rights Reserved.
This Software is protected by U.S. Patent Numbers 5,794,246; 6,014,670; 6,016,501; 6,029,178; 6,032,158; 6,035,307; 6,044,374; 6,092,086; 6,208,990; 6,339,775; 6,640,226; 6,789,096; 6,820,077; 6,823,373; 6,850,947; 6,895,471; 7,117,215; 7,162,643; 7,243,110; 7,254,590; 7,281,001; 7,421,458; 7,496,588; 7,523,121; 7,584,422; 7,676,516; 7,720,842; 7,721,270; and 7,774,791, international Patents and other Patents Pending.
Invoked at Wed Apr 02 11:03:09 2014
The source object DB2zOs_FDCT.da0010bp_S93TDã0010 cannot be found. Either the object name is invalid or the object is deleted. If object name is for source object, it should have the dbdname prefix.
Failed to execute objectexport.
But creating the AllFolder file works great.
Any Ideas?
Kind Regards
Flemming
Thanks a lot for the script. however can you kindly send the sample Query used (INFA_QUERY_NAME) for exporting selected objects and also the result of the query. (In this case (query_results.txt). This would be highly helpful for me.
Email: Menta.VenkataAvinash@cognizant.com
Your solution has worked perfectly fine for me. Thanks a lot for all the help. You were a saviour. Thanks again.
Regards,
Avinash
I am trying to create an export_object script which exports random objects. Eg. If I want to export:
Workflow A from Folder XYZ
Workflow B from Folder 123
Workflow C from Folder 000
How can I get it done using windows command prompt (unix not present) only?
The issue I am facing is in creating 'query_results.txt' file without using informatica client at all and containing different workflows in different folders.
Can you kindly help out?
My email Id is 'jatin.luthra@outlook.com'.
Thanks.
Thanks in advance.
Rajasekhar
Please give me a name and email address or try a different browser. Also, some companies block the download, try the above download link from outside your company firewall
Thanks a lot Jeff, I got a enough visibility from these scripts.
I gone through the attachment. I have one question- suppose I have one workflow which consist of 10 session, I want to replace three session and remaining 7 I want to reuse. So in that case do I have to create control file manually every time whenever we are this migration .
Regards
Vikash
For example replace that with however you would parse a text in UNIX script. Sorry I can't help further, I do not know UNIX scripting.