A Script For Informatica Repository Backups

Summary:   This tip will show you how to augment the pmrep command's backup function with environment variables to dynamically create the backup file names.  I've included a visual basic script that can be used to delete old backup files from any folder.  The result is a script you can schedule on your Windows server for unattended repository backups.

  • An example backup script and the visual basic script to delete files based on age can be downloaded here.
  • To fully utilize my example script you should be using the techniques described in my post about using Server Environment Variables
Getting Started
Using the PowerCenter command pmrep to backup repository contents is a relatively simple task.   First you connect to the repository and then execute the "backup" function of the pmrep command.

Here are a few suggestions to make your backup script more functional:

  • Use the PowerCenter repository name and system date as part of the backup file's name 
  • Schedule the backup to run nightly
  • Delete or archive old backups
Using Repository Name and System Date As The Back File Name
First let's review the pmrep backup function's syntax:

pmrep backup -o file_name.rep
In its simplest form the only option you have to supply the backup function is the file name for the backup (it is a good idea to include the .rep extension in the file name).  If you do not specify a path in the file name, the output defaults to folder:

To make your backup files easily identifiable, you can include the name of the repository and the current date as the backup file name.  If you are using a server environment variable to store your repository name, simply use that variable.

For maximum clarity in naming your backup files, combine the repository name environment variable with a variable containing the date.  This simple line of script will create a variable containing the system date in year, month, day format:

for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k_%%i_%%j
When specifying a name for the backup file, combine your repository name variable and date variable as shown in this example:

pmrep backup %INFA_REPOSITORY%_%yyyymmdd%.rep
Using an effective naming convention as the one I've demonstrated helps you organize your backups and removes any guessing when a file is needed for restoration.

Schedule the Backup to Run Nightly
Once you have a working script, you should schedule it to run as often as required, nightly, weekly, etc.  Your company's job scheduler of choice should be sufficient to do the job.

Whatever job schedule you use, after a few weeks of running repository backups you will soon notice an abundant number of backup files accumulating on your server.  You can automate the archiving (or deletion) of these old files.

Deleting Old Backups
The examples file for this tip also contains a visual basic script that can delete (or archive) files in any folder. The script was taken from example code found on this Windows scripting website.

The script accepts two parameters, the name of the folder and the number of days used in the comparison of the file create date and the current date.

Run this script over the folder where your backup files stored as part of your backup process.

Creating a script to run the repository backup is just one example of combining environment variables and Informatica commands.

Please leave a comment if this tip is something you can use or if you have your own example.

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.

4 Response to "A Script For Informatica Repository Backups"

  1. LakshmiNarasu 8/5/10, 2:57 AM
    Hi Kinzer,
    When I clicked on the download link, it says:

    "Sorry, the page (or document) you have requested is not available.

    Please check the address and try again."

    Kindly check this

  2. J. Kinzer 8/8/10, 3:22 PM
    Thank you Lakshminarasu. I have reposted the link please try the download again and let me know.

  3. Anonymous 5/3/13, 2:32 AM
    Thnks a lot and it's very useful for Infa users....

  4. Anonymous 1/28/15, 9:34 AM
    Hi Jeff, I'm unable to download the doc. Get the following error...

    403. That’s an error.

    We're sorry, but you do not have access to this page. That’s all we know.

Post a Comment