Informatica Backup.doc

Published on February 2017 | Categories: Documents | Downloads: 57 | Comments: 0 | Views: 362
of 20
Download PDF   Embed   Report

Comments

Content

 

Informatica Backups 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  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 specify a path in the file name, the output defaults defaults to folder: \server\infa_shared\Backup Location: C:\Informatica\PowerCenter8.6.0\client\bin Informatica Repository Backup pmrep connect -r Repo name -n User_name -x Pass -h host -o Port connect –r dw_Training –d Domain_user-6ca95 Domain_user-6ca950f423 0f423 –n Administrator –x Administrator pmrep backup -o filename.rep 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.

Backup Repository UNIX Script

NOTE!!!!!!!!! Rename this file to repository_backup.bat and change line 26 so it references the location of the DeleteFilesByAge.vbs files !!!!!!!!!!!!!!!!!! rem ================================================= ================================= rem = This batch files preforms a Repository backup of the Informatica repository rem = The Informatica supplied cmd PMREP is used to iniate the backup, unless otherwise rem = specified, output from the backup will default to %INFA_PATH %\server\infa_shared\Backup rem = rem = Example using a backup folder other than the default rem = SET OUTPUT_PATH=D:\Archive\p OUTPUT_PATH=D:\Archive\pmrep_cmd\temp mrep_cmd\temp rem = pmrep backup -o %OUTPUT_PATH%\backups\%INFA_REPOS %OUTPUT_PATH%\backups\%INFA_REPOSITORY%_  ITORY%_  %yyyymmdd%.rep rem = rem ================================================= ================================= SET PATH=%INFA_PATH%\server\bi PATH=%INFA_PATH%\server\bin;%PATH% n;%PATH% rem -- Step 1 - get the date and parse it so it can be used as part of the backup file name for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k_%%i_% %j rem -- Step 2 - connect to the repository

 

pmrep connect -r %INFA_REPOSITORY% -d %INFA_DEFAULT_DOMAIN% -n %INFA_PM_USER% -X INFA_PM_PASSWORD >log.txt rem -- Step 3 - issue backup option - the pmrep backup automatically uses the default PowerCenter backup folder pmrep backup -o %INFA_REPOSITORY%_%yyyymmdd%.rep %IN FA_REPOSITORY%_%yyyymmdd%.rep >>log.txt rem -- Step 4 - Delete old backups <<drive:\Folder>>DeleteFilesByAge.vbs %INFA_PATH %\server\infa_shared\Backup 14 >>log.txt rem -- last step echo -- Batch file has ended -- >>log.txt

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 job scheduler of choice should 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 – UNIX Script

'---------------------------------------------------------------------------------'script to delete files from a folder 'WARNING PLEASE READ: Once a file is deleted, it will not be in the Recycle Bin. '---------------------------------------------------------------------------------Dim objFSO, objobjFSO, objFolder, objFile, inFolderPath, inDaysToAge 'input parameters inFolderPath = CStr(Wscript.Arguments(0)) ' example D:\Test_Folder inDaysToAge = CInt(Wscript.Arguments(1)) ' example 14

 

Set objFSO = createobject("Scripting.FileSystemObject") createobject("Scripting.FileSystemObject")   'Set objFolder objFolder = objFSO.GetFolder("D:\Test_ objFSO.GetFolder("D:\Test_Folder") Folder") 'example of explicitly defined value Set objFolder = objFSO.GetFolder(inFolderPath) For Each objFile In objFolder.files If DateDiff("d", objFile.DateLastModified,Now) > inDaysToAge Then objFile.Delete True End If  Next Set objFSO = Nothing Set inFolderPath = Nothing Set inDaysToAge = Nothing ' end of script ' use these echo statments for debugging, place them in the FOR loop ' WScript.Echo objFile.DateCreated ' WScript.Echo Now ' WScript.Echo inFolderPath ' WScript.Echo inDaysToAge 'Alternate date evaluation - if you need to delete a file based on modified date or last accessed date vs DateCreated ''

If Date teDi Diff ff(" ("d" d", ob jFil ile. e.Da Date teLa Last stMo Modi difi fied ed,N ,Now ow) ) )>>in inDa Days ysTo ToAg Age eeTh Then en If Da Date Da teDi Diff ff(" ("d" d",,, objF objF ob jFil ile. e.Da Date teLa Last stAc Acce cess ssed ed,N ,Now ow) inDa in Days ysTo ToAg Age Then Th en

Another Backup Shell Script: #!/usr/bin/ksh

# Usage : bkp_rep.sh --repository name REP=$1

 

REPUSER=repository user name REPPWD=repository pwd cd /opt/informatica/server/bin/ > /opt/informatica/server/bin/backup/$R /opt/informatica/server/bin/backup/$REP.rep EP.rep HOST=`hostname` pmrep connect -r $REP -n $REPUSER -x $REPPWD -h $HOST -o 5001 # Check Status STATUS=$? if [ $STATUS -ne 0 ] then echo '[ERROR] : Repository Connection Failed' return $STATUS fi # Backup Repository FILENAME='Backup/'$REP pmrep Backup -o $FILENAME -d backup -f -b -j -q # Cleanup pmrep cleanup # Compress File compress -f /opt/informatica/server/bin/Backup/$R /opt/informatica/server/bin/Backup/$REP.rep EP.rep

Taking backup from Admin console  in Windows

 You can take backup from your Administration Console. You m must ust have privileges to do that. Regularly repositories prevent data loss due to Service hardware or software problems. back Whenup you back up a to repository, the Repository saves the repository in a binary file, including the repository objects, connection information, and code page information. If you need to recover the repository, you can restore the content of the repository from this binary file. Backing Up a Repository When you back up a repository, the Repository Service stores the file in the backup location you specify for the node. You specify the backup location when you set up the node. View the general properties of the node to determine the path of the backup directory. The Repository Service uses the extension .rep for

all repository backup files.

 

To back up a repository: 1. In the the Navig Navigat ator, or, sel selec ectt the Rep Repos osit itory ory Ser Servi vice ce for for the the repo reposi sito tory ry you you want want to back up. 2. In th the e Act Actio ions ns li list st,, sel selec ectt Bac Back k Up Up Con Conte tent nts. s. 3. Ente En terr a re rep pos osit itor ory y us user er na name me an and d pa pass sswo word rd..  The repository user must have the Admin Repository Repository or Super User privilege privilege to perform backups. 4. Enter Ent er a fi file le nam name e and and des descri cript ptio ion n for for the the rep repos osit itory ory ba back ckup up fi file le.. Use an easily distinguishable name for the file. For example, if the name of the repository is DEVELOPMENT, and the backup occurs on May 7, you might name the file DEVELOPMENTMay07.rep. If you do not include the .rep extension, the Repository Service appends that extension to the th e file name. 5. If you you use use the the sam same e file file nam name e that that you you use used d for for a prev previo ious us bac backup kup fi file le,, select whether or not to replace the existing file with the new backup file.  To overwrite an existing repository backup file, file, select Replace Existing Existing File. If you

specify a file name that already existsfile, in the you do not choose to replace the existing therepository Repositorybackup Servicedirectory does notand back up the repository. 6. Choos Ch oose e to ski skip p or ba back ck up up workf workflo low w and and sess sessio ion n logs logs,, depl deploym oymen entt grou group p history, and MX data. You might want to skip these operations to increase performance when you restore the repository. 7. Click OK.  The results of the backup operation appear appear in the activity log.   Viewing a List of Backup Files    You can view the backup files you create for a repository in the backup directory where they are saved. You can also view a list of existing backup files in the Administration Console.  To view the list of backup files: 1. In the the Navi Naviga gato tor, r, sel selec ectt the Re Repo posi sito tory ry Ser Servi vice ce for for a repo reposi sito tory ry that that has has been backed up. 2. In th the e Act Actio ions ns li list st,, sel selec ectt Vie View w Bac Backu kup p Fil Files es.. A list of the backup files appears.  

 

Informatica - Best Practices - HOW TO: Take repository backup on weekly basis - HOW TO: Retain multiple session and workflow log files in the session log folder - HOW TO: Renaming Informatica Repository Name   HOW TO: Take Informatica repository backup on a daily basis

It is always recommended to take full backup of development repository on a daily basis and keep it at least for a week period, so that in case of accidental deletion of mapping it can be restored from the backup. Please enable JavaScript to view this page content properly. Basic batch program that automatically takes repository backup and zip the backup and keep it for a week duration:REM ---------------------------------------------------------REM VARIABLES REM --SET ---------------------------------------------------------set LOGFILENM=<Repository Name> set REP=<Repository Name> set USER=Administrator set PWD=<Admin Password> set BKPPATH=Drive:\<Location> Set DAY=%DATE:~0,3% REM ---------------------------------------------------------ECHO. |TIME > %LOGFILENAME%.log ECHO "Backup Started & Connecting to Repository" >> %LOGFILENAME%.log pmrep connect -r %REP% -n %USER% -x %PWD% -h DEVMAX -o 5001 ECHO "Repository Connected" >> %LOGFILENAME%.log pmrep Backup -o %BKPPATH%%LOGFILENAME%_%DAY%.rep -f -b -j -q ECHO. |TIME >> %LOGFILENAME%.log ECHO "Backup Completed" >> %LOGFILENAME%.log zip -r -9 -S -m %LOGFILENAME%_%DAY%.rep.zip %LOGFILENAME%_%DAY%.rep ECHO "Zipping complete!!!" >> %LOGFILENAME%.log Example If LOGFILENM = DV_REP then Output of the above script will be DV_REP_Mon.zip

 

 The above batch program on Informatica server can be scheduled to run in night on a daily basis.  

HOW TO: Retain multiple session and workflow w orkflow log files in the session log folder    You  Y ou can set sessions sessions to retain log files according to the following options: Session Runs. The Integration Service creates a designated number of session log files. Configure the number of session logs in the Save Session Log for These Runs option. The Integration Service does not archive binary logs. Session Time Stamp. The Integration Service creates a log for all sessions, appending a time stamp to each log. When you save a session log by time stamp, the Integration Service archives the binary logs and text log files. To retain multiple session and workflow log files in the session log folder edit the default session configuration as follows: 1. Open the Workflow Manager Manager.. 2. Select Tasks > Session Configuration > Edit Please enable  JavaScript to view this page content properly. properly. 3. Click the Properties tab. 4. For Save Session log by select Session runs or Session timestamp  from the list 5. Optional. If you selected Session runs in step 4, enter a numeric value for the Save session log for these runs attribute:  

 

  Note: These settings will take effect for new sessions you create. For old existing sessions you will get the Revert option. If you click on Revert, then it will take t ake your modified configuration file settings.

 

  This change will be applicable to all the new sessions.

$PMSessionLogCount Integration Service Variable Variable  You  Y ou can also use the the $PMSessionLogCount service variable to create the configured number of session logs for the Integration Service. 1. Go to Administration Console. 2. Go to the Integration Service > Properties > General Properties.  3. Set the value $PMSessionLogCount. In this example it is set to 2 which will keep a history of 3 (2+1) log files.

 

  4. Open the Workflow Manager Manager.. 5. Select Tasks > Session Configuration > Edit.  6. Select the Properties tab.  7. Use of variable $PMSessionLogCount set in the Administration Console:  

 

  HOW TO: Renaming Informatica Repository Name  There may be cases when you would like like to rename Informatica Repository, the effective way of doing as follows Make sure while performing following operation, none of the developers are connected to Informatica Repository. Step 1: Using Repository Server Administration - Create repository backup: File Name “BI_Informatica_Rep” and skip workflow and a nd session logs (this will save time and Please enable JavaScript to view this page content properly. space) as shown in figure 1.

  Figure 1: Repository Backup - Advance Options   Step 2: Validate the backup is created on X:\Infa_714\RepositoryServer\bin\Backup   Step 3: Create a copy of license file to NewName.lic from OldName.lic, the license file can be found at X:\Infa_714\RepositoryServer\bin   Step 4: Using Repository Server Administration – Drop the existing repository   Step 5: Using Repository Server Administration – Create new repository from backup the file "BI_Informatica_Rep" as shown in Figure 2  

 

  Figure 2: Create New Repository using Restore  



HOW TO: Do a repository backup using UNIX shell commands

Solution

This is an example of UNIX shell commands that can be used to do a repository backup with pmrep commands. This requires two commands, the connect command and the backup command. Example:  pmrep connect -r myrepserver -n Administrator -x mypassword mypassword -h myhost -o 5001 > backuplog.out backuplog.out 2>1 echo “Beginning Repository backup at `date`”>> backuplog.out  pmrep backup -o backup_prod.rep backup_prod.rep >> backuplog.out 2>1 echo “Done Repository backup at `date`”>> backuplog.out More Informatio Information n

To write the backup file to a specific directory (other than the current working directory) use the fully f ully qualified name. Example:  pmrep mypassword -h myhost -o 5001 > backuplog.out backuplog.out 2>1 connect -r myrepserver -n Administrator -x mypassword

 

echo “Beginning Repository backup at `date`”>> backuplog.out  pmrep backup -o /home/repobackups/ /home/repobackups/ backup_prod.rep backup_prod.rep >> backuplog.out 2>1 echo “Done Repository backup at `date`”>> backuplog.

An example of a Windows batch file to automate repository backups

Problem Description

Example of a Windows batch file for f or automating a repository backup using the pmrep command line utility. Solution

The following batch file example connects to the repository then backs up the repository.  pmrep connect -r training -n training training -x training -h p156475 -o 5001  pmrep backup -o testbk -f  More Informatio Information n

The pmrep command is located in the bin directory under the Repository Server installation directory. Parameter Values: * connect -r <repository name> -n <repository user name> -x <repository password> -h <repserver host name> -o <repserver port number> * backup The option -o <output file name> is required. r equired. -o <output file name> -f (overwrite existing output file)

 

Working with the Command Prompt in informatica  informatica   PMCMD:

Use pmcmd commands with operating system scheduling tools like cron, or o r you can embed pmcmd commands into shell or Perl scripts.

 

When you run pmcmd in command line mode, you enter connection information such as domain name, Integration Service name, user name and password in each command. For example, to start the workflow “wf_SalesAvg” infolder “SalesEast,” The user, seller3, with the password “jackson” sends the request to start the workflow. syntax:

pmcmd startworkflow -sv MyIntService -d MyDomain -u seller3 -p jackson -f  SalesEast wf_SalesAvg Command Line Mode:

1. At the command prompt, switch to the directory where the pmcmd executable is located. By default, the PowerCenter installer installs pmcmd in the \server\bin directory. 2. Enter pmcmd followed by the command name and its required options and arguments: pmcmd command_name [-option1] argument_1 [-option2] argument_2... Interactive Mode :

1. At the command prompt, switch to the directory where the pmcmd executable is located. By default, the PowerCenter Pow erCenter installer installs pmcmd in the \server\bin directory. 2. At the command prompt, type pmcmd.This starts pmcmd in interactive mode and displays the pmcmd> prompt. You do not have to type pmcmd before each command in interactive mode. 3. Enter connection information for the domain and Integration Service. For example:

connect -sv MyIntService -d MyDomain -u seller3 -p jackson

 

4. Type a command and its options and arguments in the following format:command_name [-option1] argument_1 [-option2] [- option2] argument_2...pmcmd runs the command and displays the prompt again. 5. Type exit to end an interactive session. For example, the following commands invoke the interactive in teractive mode, establish a connection to Integration Service“MyIntService,” and start workflows “wf_SalesAvg” and “wf_SalesTotal” in folder “SalesEast”:

pmcmd pmcmd> connect -sv MyIntService -d MyDomain -u seller3 -p jackson pmcmd> setfolder SalesEast pmcmd> startworkflow wf_SalesAvg pmcmd> startworkflow wf_SalesTotal Scripting pmcmd Commands :

For example, the following UNIX shell script checks the status of Integration Service “testService,” and if it is running, gets details for session “s_testSessionTask”: #!/usr/bin/bash # Sample pmcmd script # Check if the service is alive pmcmd pingservice -sv testService -d testDomain if [ "$?" != 0 ]; then # handle error echo "Could not ping service" exit

 

fi # Get service properties pmcmd getserviceproperties -sv testService -d testDomain if [ "$?" != 0 ]; then # handle error echo "Could not get service properties" exit fi # Get task details for session task "s_testSessionTask" of workflow # "wf_test_workflow" in folder "testFolder" pmcmd gettaskdetails -sv testService -d testDomain -u Administrator -p adminPass -folder testFolder workflow wf_test_workflow s_testSessionTask if [ "$?" != 0 ]; then # handle error echo "Could not get details for task s_testSessionTask" exit fi Schedule Workflow

Instruct the Integration Service to schedule a workflow. Use this command to reschedule a workflow that has been removed from the schedule.  The ScheduleWorkflow command uses the following syntax in the command line mode:

 

pmcmd ScheduleWorkflow <<-service|-sv> service [<-domain|-d> domain] [<-timeout|-t> timeout]> <<-user|-u> username|<-uservar|-uv> userEnvVar> <<-password|-p> password|<-passwordvar|-pv> passwordEnvVar> [<<-usersecuritydomain|-usd> usersecuritydomain|<-usersecuritydomainvar|usdv> userSecuritydomainEnvVar>] [<-folder|-f> folder] workflow

FREQUENTLY USED PMCMD COMMANDS IN INFORMATICA type csh command and then source your file .csh source .cshrc_infa and then run pmcmd command synatx is as follows pmcmd scheduleworkflow <-serveraddr-s> [host:]portno <<-user-u> username<-uservar-uv> user_env_var> <<-password-p> password<passwordvar-pv> password_env_var> [<-folder-f> folder] workflow --------------------------------- pmcmd startworkflow -sv Integartion service name -d domain -u username -p password -f 'folder' workflow name

If you are alreadyin pmcmd prompt then follow the below mentioned steps  The following commands were helpful helpful for pmcmd: pmcmd>connect -sv Service -d domain -u username -p password pmcmd>startworkflow -f 'folder' workflow pmcmd>getworkflowdetails -f 'folder' -rin workflow pmcmd>gettaskdetails pmcmd>gettaskde tails -f 'folder' workflow pmcmd>stoptask -f 'folder' workflow pmcmd>getsessionstatistics pmcmd>getse ssionstatistics -f 'folder' workflow pmcmd>scheduleworkflow pmcmd>schedule workflow -f 'folder' workflow

 

pmcmd>unscheduleworkflow -f 'folder' workflow pmcmd>disconnect -sv Service -d domain -u username -p password

pmcmd> connect -sv IN_Training -d Domain_user-6ca950f423 -u Administrator -p Adm inistrator Connected to Integration Service: [IN_Training]. pmcmd> getrunningsessionsdetails Integration Service status: [Running] Integration [[Sun WedAug Aug28 2415:01:34 01:35:432011] 2011] Integration Service Service startup current time: time: [Wed Number of active sessions on this Integration Service: [0] pmcmd> getservicedetails Integration Service status: [Running] Integration Service startup time: [Wed [ Wed Aug 24 01:35:43 2011] Integration Service current time: [Sun Aug 28 15:02:21 2011] Number of scheduled workflows on this Integration Service: [0] Number of active workflows on this Integration Service: [0] Number of active sessions on this Integration Service: [0] Number of waiting sessions on this Integration Service: [0]

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close