0% found this document useful (0 votes)
472 views

Working With PowerCenter Repository Using Shell Script

The document provides sample shell scripts for performing common administrative tasks with a PowerCenter repository including creating, backing up, restoring, renaming, and automatically backing up a repository. The scripts can be used to create a new repository service, backup an existing one, restore from a backup, rename a repository using either backup/restore or copying, and automate regular backups using a scheduled workflow that calls the backup script.

Uploaded by

ydanand
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
472 views

Working With PowerCenter Repository Using Shell Script

The document provides sample shell scripts for performing common administrative tasks with a PowerCenter repository including creating, backing up, restoring, renaming, and automatically backing up a repository. The scripts can be used to create a new repository service, backup an existing one, restore from a backup, rename a repository using either backup/restore or copying, and automate regular backups using a scheduled workflow that calls the backup script.

Uploaded by

ydanand
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

Working with PowerCenter repository

using Shell script


 

This paper contains sample shell scripts to perform the following tasks:

1.       Create a new PowerCenter Repository Service

2.       Backup a PowerCenter Repository Service

3.       Restore a PowerCenter Repository Service

4.       Rename a PowerCenter Repository Service

5.       Perform automatic repository backup

1. Create a new PowerCenter Repository Service

The following is a sample shell script that creates a new repository.

#-------------------------------------------------------------

# Program:          create_repo_service.sh

# Author:             Arpit Shanker

# Date::               Dec 07, 2010

# Purpose:          UNIX script to create new PowerCenter repository

#-------------------------------------------------------------

 
#-----------------------------------------------------------

# Create the Repository Service

#-----------------------------------------------------------

. $INFA_HOME/server/bin/infacmd.sh CreateRepositoryService -dn Domain_Test -un


admin -pd password -sn Test_Rep -nn node_Test

#-----------------------------------------------------------

# Connect to the Repository Service

#-----------------------------------------------------------

. $INFA_HOME/server/bin/pmrep connect -r Test_Rep -d Domain_Test

#-----------------------------------------------------------

# Create the repository contents

#-----------------------------------------------------------

. $INFA_HOME/server/bin/pmrep create -u administrator -p administrator

#-----------------------------------------------------------

# Done...

#-----------------------------------------------------------

 
 

2. Backup a PowerCenter Repository Service

The following is a sample shell script to perform backup of Powercenter repository.

#------------------------------------------------------------

# Program:          bkp_rep_service.sh

# Author:             Arpit Shanker

# Date:                 Dec 07, 2010

# Purpose:          UNIX script to perform Repository Backup

#-----------------------------------------------------------

#------------------------------------------------------------

# Declare required Variables

#-------------------------------------------------------------

UNAME= <Username>

PASSWD= <Password>

REPNAME= <Repository Name>

DOMAIN= <Domain Name>

#-----------------------------------------------------------------

# Connect to the Repository

#-----------------------------------------------------------------
 

$INFA_HOME/server/bin/pmrep connect -r $REPNAME -n $UNAME -x $PASSWD -d


$DOMAIN > $REPNAME'_bkplog.out' 2>1

echo "Repository backup started at `date`">> $REPNAME'_bkplog.out'

#-----------------------------------------------------------------

# Check the Status

#-----------------------------------------------------------------

rc=$?

if [ $rc -ne 0 ] then

echo 'ERROR!! Connect to Repository failed.....' >> $REPNAME'_bkplog.out'

return $rc

fi

#-----------------------------------------------------------------

# Start Backup...

#-----------------------------------------------------------------

$INFA_HOME/server/bin/pmrep backup -o <Path>/'bkp_'$REPNAME.rep >>


$REPNAME'_bkplog.out' 2>1

echo "Repository backup completed at `date`">> $REPNAME'_bkplog.out'

 
 

#-----------------------------------------------------------------

# Done.....

#-----------------------------------------------------------------

3. Restore a PowerCenter Repository Service

The following is a sample shell script to restore a Powercenter repository. Please note
that the target database must be empty in order to restore the repository.

#-----------------------------------------------------------------

# Program:          restore_rep_service.sh

# Author:             Arpit Shanker

# Date::               Dec 07, 2010

# Purpose:          UNIX script to restore a Powercenter repository

#----------------------------------------------------------------

#-----------------------------------------------------------

# Create New Repository Service

#-----------------------------------------------------------

. $INFA_HOME/server/bin/infacmd.sh CreateRepositoryService -dn domain_name -un


user_name -pd password -sn rep_name -nn node_name

#-----------------------------------------------------------
# Connect to the Repository Service

#-----------------------------------------------------------

. $INFA_HOME/server/bin/pmrep connect -r rep_name -d domain_name

#-----------------------------------------------------------

# Restore repository contents

#-----------------------------------------------------------

. $INFA_HOME/server/bin/pmrep restore -u user_name -p password -i <Backup File


Name>

#-----------------------------------------------------------

# Done...

#-----------------------------------------------------------

4. Rename a PowerCenter Repository Service

A Repository Service cannot be renamed directly. The following two options can be used
in order to rename the PowerCenter Repository Service. Please note that the new
repository must be created in a different database schema than the original repository.

1.       Backup and Restore

2.       Copy Repository


 

Backup and restore

1.       Backup the existing repository.

2.       Create a Repository Service with the new name.

3.       Select Actions > Restore Contents .

4.       Restore the repository backup.

Copy Repository

1.       Create a Repository Service with the new name.

2.       Select Actions > Copy Contents From.

3.       Copy the existing repository to the new Repository Service.

5. Perform automatic repository backup

If you want to automate the backup of repository at regular interval, create a workflow as
follows and schedule it to run at the desired interval.

1. Add a Command task to the workflow.


2. Call bkp_rep_service.sh script (Given in this paper) in command task to backup
the repositor

http://arpit.leading-technology.net/Informatica.htm

You might also like