Tuesday, December 17, 2013

Informatica Powercenter Repository Backup - Sample Shell Script

Sample Script for Repository Backup on daily basis

#!/bin/bash
############## Initialization ###########################
LOG=/home/infa/Scripts/logs/infa_rep_backup.log
BACKUP_DAY=`date +"%a"` ## Mon Tue Wed Thu Fri Sat Sun
BACKUP_FILE=$PMRootDir/Backups/rep_infa_qa_backup_$BACKUP_DAY.rep


#
INFA_DOMAIN_NAME=DOM_INFA
REP_INFA=REP_INFA_QA
INFA_ADMIN_USER=Administrator
INFA_ENCRYPTED_PASSWD=lPe9EWnLKJGAdE9oo/KilH
#
date > $LOG
#
############## Connecting to the Repository #############
#
echo Connecting to the Repository $REP_INFA on $INFA_DOMAIN_NAME >> $LOG
#
pmrep connect -r REP_INFA_QA -n $INFA_ADMIN_USER -X INFA_ENCRYPTED_PASSWD -d $INFA_DOMAIN_NAME >> $LOG
#
retval=$?
if [ $retval -ne 0 ]; then
    echo Connecting to the Repository -- Failed $retval >> $LOG
    exit $retval
else
    echo Connecting to the Repository -- SUCCESS >> $LOG
fi
#
############## Repository Backup ########################
#
echo Initiating backup of Repository REP_INFA_QA on $INFA_DOMAIN_NAME >> $LOG
#
pmrep backup -o $BACKUP_FILE -f -b -j -q -v >> $LOG
#
retval=$?
if [ $retval -ne 0 ]; then
    echo Repository Bacup -- Failed with error code $retval >> $LOG
    exit $retval
else
    echo Repository Bacup -- SUCCESS >> $LOG
fi
#
exit


Notes

1) For pmrep Connect command - INFA_ENCRYPTED_PASSWD need to be set as a variable   with the password. Else use -x ( instead of -X ) to provide hard code password.

2) Following are the descriptions for backup parameters.

Option Description
-o output_file_name
-f Optional. Overwrites an existing file with the same name.
-b Optional. Skips tables related to workflow and session logs.
-j Optional. Skips deployment group history.
-q Optional. Skips tables related to MX data.
-v Optional. Skips task statistics.




No comments:

Post a Comment