Thursday, February 9, 2012

How to Restore Informatica Repository using Command Line Utilities

                                       TABLE OF CONTENTS

1    Overview  
2    Backup Production Repo file  
3    Steps to Restore Repository  
    3.1      Step 1 - Connect to Dev Repository       
    3.2      Step 2 - Disable Dev Repo Services          
    3.3      Step 3 - Update Repository Service of Dev to run in Exclusive mode                        
    3.4      Step 4 - Enable Repository Service                 
    3.5      Step 5 - Re Connect to DEV repo to confirm Repo is in Exclusive mode                
    3.6      Step 6 - Delete DEV Repo Contents         
    3.7      Step 7 - Get latest backup of Prod Repo file   
    3.8      Step 8 - Connect to DEV repo using without repo user and repo pwd                        
    3.9      Step 9 - Restore DEV repo using Prod backup file       
    3.10      Step 10 - Disable repo service       
    3.11      Step 11 - Update repository metadata table and fetch Scheduled workflow list        
    3.12      Step 12 - Switch Repository Service to run in Normal mode   
    3.13      Step 13 - Identify and cleanse Scheduled Workflows in List
    3.14      Step 14 - Enable repo service   
    3.15      Step 15 - Repository Service to run in Normal mode   
    3.16      Step 16 - Ping Integration Service   
    3.17      Step 17 - Disable Repository   
    3.18      Step 18 - Enable Repository Service   
    3.19      Step 19 - Disable Integration Service   
    3.20      Step 20 - Enable Integration Service   
    3.21      Step 21 - Ping Integration Services   
    3.22      Step 22 -- UnSchedule Scheduled Workflows   
    3.23      Step 23 - Reconnect to repo run test workflow   
    3.24      Step 24 -  Get List of wf Names from Admin Folder   
    3.25      Step 25 - Running test workflow                                   

1  Overview




This document is intended for Informatica Administration Team to restore / refresh prod repository with dev repository using informatica command line utilities (pmrep, infacmd). This script can be scheduled in case if you want to refresh a repository with your prod repository on daily wise. Please be very careful and make sure have proper backups before execution of below commands.



2  Backup Production Repo file




Backup script on prod will take backup of repo on daily wise and schedule another script to sftp latest backup file to dev server to backup directory.



ABC8_PRD_REPO_backup_20120201_063017.rep

ABC8_PRD_REPO_backup_20120202_063015.rep

ABC8_PRD_REPO_backup_20120203_063016.rep



3  Steps to Restore Repository




Environment Variable Declarations



${Restored_Repo}               -   Repo Name

   ${ENV_INFA_PWD}              -   Administrator User id

        ${ENV_INFA_PWD}              -   Administrator Pwd

${DOMAIN}                        -   Domain Name  

${ENV_REPBKUP_DIR}



Restored_Repo=ABC8_DEV_REPO

'Domain   = domain_etldev202'

'hostnode = servername'

'Homer    = /infa/informatica/pc86'

BackDir  = /infa/informatica/pc86/server/infa_shared/Backup'

ScriptDir=' /infa/scripts'



            3.1     Step 1 - Connect to Dev Repository




pmrep connect -r ${Restored_Repo} -n ${ENV_INFA_ID} -x ${ENV_INFA_PWD} -d ${DOMAIN}





            3.2     Step 2 - Disable Dev Repo Services




infacmd.sh DisableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo -mo Abort



            3.3     Step 3 - Update Repository Service of Dev to run in Exclusive mode


           

infacmd.sh updateRepositoryService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo -so OperatingMode=Exclusive



sleep 180



            3.4     Step 4 - Enable Repository Service




infacmd.sh EnableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo



sleep 60



            3.5     Step 5 - Re Connect to DEV repo to confirm Repo is in Exclusive mode




pmrep connect -r ${Restored_Repo} -n ${ENV_INFA_ID} -x ${ENV_INFA_PWD} -d ${DOMAIN}



            3.6     Step 6 - Delete DEV Repo Contents




pmrep delete -x ${ENV_INFA_PWD}



            3.7     Step 7 - Get latest backup of Prod Repo file




Get latest backup file of prod repo from step 2 location



Latest_bkp_file=`ls -ltr $ENV_REPBKUP_DIR/ABC8_PRD_REPO_backup*|awk '{print $9}'|tail -1`





            3.8     Step 8 - Connect to DEV repo using without repo user and repo pwd




pmrep connect -r ${Restored_Repo} -d ${DOMAIN}



            3.9     Step 9 - Restore DEV repo using Prod backup file




pmrep restore -u ${ENV_INFA_ID} -p ${ENV_INFA_PWD} -i $Latest_bkp_file





         3.10     Step 10 - Disable repo service




infacmd.sh DisableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo -mo Abort





         3.11     Step 11 - Update repository metadata table and fetch Scheduled workflow list




update opb_server_info set server_name = ' servername_iserv_dev ',domain_name = 'domain_servername'



Commit;



select subject_area||' '||workflow_name from rep_workflows where start_time is not null and RUN_OPTIONS in (4,8) order by 1;



Copy list of workflow names to a test file infa_vlt_schwf.txt



sleep 30



         3.12     Step 12 - Switch Repository Service to run in Normal mode




infacmd.sh updateRepositoryService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo -so OperatingMode=Normal



sleep 60



         3.13     Step 13 - Identify and cleanse Scheduled Workflows in List


 


#---  Remove first 1 Junk line from infa_vlt_schwf.txt

sed 1,1d ifx_vlt_schwf.txt > ${ScriptDir}/ifx_vlt1.txt



#----- Remove last 1 lines from vlt1.txt  >> ${LogFile}



sed -n -e :a -e '1,1!{P;N;D;};N;ba' ${ScriptDir}/ifx_vlt1.txt > ${ScriptDir}/ifx_vlt2.txt



         3.14     Step 14 - Enable repo service




infacmd.sh EnableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo





         3.15     Step 15 - Repository Service to run in Normal mode




infacmd.sh updateRepositoryService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo -so OperatingMode=Normal



         3.16     Step 16 - Ping Integration Service


 


infacmd.sh ping -dn ${DOMAIN} -sn ${INTEGRATION_SERVICE_vlt}



         3.17     Step 17 - Disable Repository


 


infacmd.sh DisableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo -mo Abort



         3.18     Step 18 - Enable Repository Service




infacmd.sh EnableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn $Restored_Repo



         3.19     Step 19 - Disable Integration Service


 


infacmd.sh DisableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn ${INTEGRATION_SERVICE_vlt} -mo Abort



         3.20     Step 20 - Enable Integration Service


 


infacmd.sh EnableService -dn ${DOMAIN} -un ${ENV_INFA_ID} -pd ${ENV_INFA_PWD} -sn ${INTEGRATION_SERVICE_vlt}



         3.21     Step 21 - Ping Integration Services




infacmd.sh ping -dn ${DOMAIN} -sn ${INTEGRATION_SERVICE_vlt}



         3.22     Step 22 -- UnSchedule Scheduled Workflows


 


${ENV_SCRIPT_DIR}/ifx_vlt_unsch.ksh



         3.23     Step 23 - Reconnect to repo run test workflow


 


pmrep connect -r ${Restored_Repo} -n ${ENV_INFA_ID} -x ${ENV_INFA_PWD} -d ${DOMAIN}



         3.24     Step 24 -  Get List of wf Names from Admin Folder


 


pmrep listobjects -o workflow -f IFX | sed '1,8d;/successfully/,$d' > $SCRHOME/ifx_wf_restore_list.txt

 

         3.25     Step 25 - Running test workflows






for a in `cat $SCRHOME/ifx_wf_restore_run.txt`;

do export WF=$a;

echo 'Workflow Name' = $WF  >> ${LogFile}

echo "Starting the IFX test Workflow $WF" >> $logfile

${LIBRARY_PATH}/pmcmd startworkflow -sv ${INTEGRATION_SERVICE_vlt} -d ${DOMAIN} -u ${ENV_INFA_ID} -p ${ENV_INFA_PWD} -f ${INFA_FOLDER} -nowait $WF

done;