You are on page 1of 9

Deployment Using pmrep Commands

2009 Informatica Corporation

Abstract
The complete deployment process involves identifying objects for deployment in a development environment, copying the objects to a test environment and validating the deployed objects, or rolling the objects back for modification. You can use a control file to provide parameters for deployment. You can use pmrep commands or scripts containing pmrep commands to complete a deployment.

Table of Contents
Overview ........................................................................................................................................................................... 2 Steps to Complete a Deployment ..................................................................................................................................... 3 Create the Object Query ................................................................................................................................................... 3 Deployment through pmrep Commands ........................................................................................................................... 3 Connect to the Repository ............................................................................................................................................ 3 Run the Object Query................................................................................................................................................... 4 Create the Deployment Group...................................................................................................................................... 4 Create the Deployment Control File ............................................................................................................................. 5 Deploy the Objects ....................................................................................................................................................... 6 Validate the Deployment .............................................................................................................................................. 6 Roll Back the Deployment ............................................................................................................................................ 7 Deployment through Scripts.............................................................................................................................................. 7 Run the Query .............................................................................................................................................................. 8 Create a Deployment Group......................................................................................................................................... 8 Deploy Objects ............................................................................................................................................................. 8 Validate the Objects ..................................................................................................................................................... 8 Roll Back Objects ......................................................................................................................................................... 9

Overview
After you create objects in the development repository you can deploy them to the test repository to test the objects. You can roll back the objects to the development repository in case of modification. You can use a deployment group to copy the objects in the development repository to the test repository. Before you copy a deployment group, you must identify the object types and the dependent objects that you want to deploy. To identify objects, you can use an associated object query with a dynamic deployment group. You can run the query and write the results to a persistent output file. Create a deployment control file depending on the operation and content of the deployment group that you want to copy and the target repository type. Use pmrep commands in the interactive mode or run executable scripts containing pmrep commands in the command line mode. For more information about pmrep command options and arguments, see the PowerCenter Command Reference.

The sample deployment control file and scripts are included as attachments to this article. You can download these files to the following directory:
<PowerCenter Installation Directory>\client\bin

Steps to Complete a Deployment


The following steps describe the complete deployment process: 1. 2. 3. 4. 5. 6. 7. 8. Create an object query in the Repository Manager to identify the objects to deploy. Use the pmrep Connect command to connect to the repository from the command line. Use the pmrep ExecuteQuery command to run the query. Use the pmrep CreateDeploymentGroup command to create a dynamic deployment group associated with the query. Create a deployment control file with the deployment parameters. Use the pmrep DeployDeploymentGroup command to copy the deployment group to the target repository. Use the pmrep Validate command to validate the deployment group objects in the target repository. Optionally, use the pmrep RollbackDeployment command to roll back versioned objects in case you need to modify the deployment group objects. You cannot roll back the deployment group to a non-versioned repository.

Create the Object Query


Create a query in the Repository Manager to identify objects to deploy. For example, you may want to deploy sessions that were checked in within the last 120 days. You can create a query named ListOfValidObjects to return a list of all session objects in the repository that were checked in within the last 120 days. For example, the sample ListOfValidObjects query has the following query conditions configured in the Query Editor:
Parameter Name Operator Value 1

AND Object Type Check-in Time Is Equal to Within Last (Days) Session 120

Deployment through pmrep Commands


Use the following pmrep commands to set up the deployment: 1. 2. 3. 4. 5. 6. Connect ExecuteQuery CreateDeploymentGroup DeployDeploymentGroup Validate RollbackDeployment

Connect to the Repository


The first time you use pmrep in the command line, you must use the pmrep Connect command to connect to the repository.

The Connect command uses the following syntax:


connect -r <repository_name> {-d <domain_name> | {-h <portal_host_name> -o <portal_port_number>}} [-n <user_name> [-s <user_security_domain>] [-x <password> | -X <password_environment_variable>]] [-t <client_resilience>]

To run the pmrep Connect command: 1. At a command prompt, change to the directory where the pmrep executable is located. The pmrep executable is located in the <PowerCenter Installation Directory>\client\bin folder. For example, enter
Informatica\PowerCenter8.6.1\client\bin

2. 3.

Enter pmrep. Enter the Connect command and its options and arguments. For example, enter the following command:
connect r HR_85 d Development n joe x joe

The command line displays a message indicating that you connected to the repository successfully.

Run the Object Query


Run the pmrep ExecuteQuery command. Write the result to a persistent output file. If the query is successful, it returns the total number of qualifying records. Run this command again when you validate objects in the target repository.

pmrep ExecuteQuery
The ExecuteQuery command uses the following syntax:
executequery -q <query_name> [-t <query_type (shared or personal)>] [-u <output_persistent_file_name>] [-a (append)] [-c <column_separator] [-r <end-of-record_separator>] [-l <end-of-listing_indicator>] [-b (verbose)]

To run pmrep ExecuteQuery: 1. At the pmrep command prompt enter the ExecuteQuery command options and arguments. For example, enter the following command:
executequery q ListOfValidObjects t Shared u list_of_valid_objects

The command line displays a message stating the total number of records returned as the results of a successful query. The persistent output file appears in the following directory:
<PowerCenter Installation Directory>\client\bin

Create the Deployment Group


Create a dynamic deployment group associated with the object query that identifies the objects you want to deploy. For example, create a dynamic deployment group associated with the ListOfValidObjects query.

pmrep CreateDeploymentGroup
The CreateDeploymentGroup command uses the following syntax:
createdeploymentgroup -p <deployment_group_name> [-t <deployment_group_type (static or dynamic)>] [-q <query_name>] [-u <query_type (shared or personal)>] [-c <comments>]

To run pmrep CreateDeploymentGroup: 1. At the pmrep command prompt, enter the CreateDeploymentGroup command options and arguments. For example, enter the following command:
createdeploymentgroup p HR_ListOfValidObjects t dynamic q ListOfValidObjects u Shared

The command line displays a message indicating that the CreateDeploymentGroup command completed successfully.

Create the Deployment Control File


Create a deployment control file that provides the parameters for deployment. Use this control file with the pmrep DeployDeploymentGroup command. The file must conform to the depcntl.dtd file that is installed with the PowerCenter Client. You include the location of the depcntl.dtd file in the XML file. The first time you copy a deployment group, you must specify the OVERRIDEFOLDER element and specify the SOURCEFOLDERNAME and TARGETFOLDERNAME attributes in the control file. If you do not specify these, the execute deployment group operation fails because the folder containing the deployment group does not copy to the target repository. For example, the following deployment control file parameters are in sample dg.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE DEPLOYPARAMS SYSTEM "C:/Informatica/Powercenter8.6.1/client/bin/depcntl.dtd"> <DEPLOYPARAMS COPYDEPLOYMENTGROUP="YES" DEPLOYTIMEOUT="1" COPYPROGRAMINFO="YES" COPYMAPVARPERVALS="YES" COPYWFLOWVARPERVALS="YES" COPYWFLOWSESSLOGS="NO" COPYDEPENDENCY="YES" LATESTVERSIONONLY="YES" RETAINGENERATEDVAL="YES" RETAINSERVERNETVALS="YES"> <DEPLOYGROUP CLEARSRCDEPLOYGROUP="NO"> <REPLACEDG DGNAME="Production" /> <OVERRIDEFOLDER SOURCEFOLDERNAME="Vendors_Snaps" TARGETFOLDERNAME="Vendors_Snaps"/> </DEPLOYGROUP> </DEPLOYPARAMS>

You can download sample dg.xml to use with the deployment process examples.

Note: If you include the VALIDATETARGETREPOSITORY attribute in the deployment control file, the Repository Service validates all objects in the target repository. To validate deployment group objects, use the pmrep Validate command.

Deploy the Objects


Copy the deployment group and the deployment group objects to folders in the target repository. When you copy a dynamic deployment group, the Repository Service converts it to a static deployment group in the target repository.

pmrep DeployDeploymentGroup
The DeployDeploymentGroup command uses the following syntax:
deploydeploymentgroup -p <deployment_group_name> -c <control_file_name> -r <target_repository_name> [-n <target_repository_user_name> [-s <target_repository_user_security_domain>] [-x <target_repository_password> | -X <target_repository_password_environment_variable>] [-d <target_domain_name> | {-h <target_portal_host_name> -o <target_portal_port_number>}]] (only if target is in a differentdomain) [-l <log_file_name>]

To run pmrep DeployDeploymentGroup: 1. At the pmrep command prompt, enter the DeployDeploymentGroup command options and arguments. For example, enter the following command:
deploydeploymentgroup p HR_ListOfValidObjects c dg.xml r Samples_87 n joe x joe d Development l DeploymentLogFile

The command line displays the deployment output and states that the DeployDeploymentGroup command completed successfully.

Validate the Deployment


Validate the deployment group objects in the target repository. You can use a persistent output file instead of standard output for the validation process. The pmrep DeployDeploymentGroup command does not create a persistent output file to use with the pmrep Validate command. To validate the deployed objects, run an object query to identify the objects. You can create the same query created in the development repository in the test repository. For example, create the ListOfValidObjects query. Complete the following steps before you validate the deployment objects in the test target repository: 1. 2. 3. Create the object query to identify the deployed objects. Use the pmrep Connect command to connect to the test target repository. Run the pmrep ExecuteQuery command in the target repository and create a persistent output file. Use this file as a persistent input file for the pmrep Validate command. For example, use the persistent input file list_of_valid_objects created in the target repository after you run the pmrep ExecuteQuery command.

pmrep Validate
The Validate command uses the following syntax:
validate {{-n <object_name> -o <object_type (mapplet, mapping, session, worklet, workflow)> [-v <version_number>]

[-f <folder_name>]} | -i <persistent_input_file>} [-s (save upon valid) [-k (check in upon valid) [-m <check_in_comments>]]] [-p <output_option_types (valid, saved, skipped, save_failed, invalid_before, invalid_after, or all)> [-u <persistent_output_file_name>] [-a (append)] [-c <column_separator>] [-r <end-of-record_separator>] [-l <end-of-listing_indicator>] [-b (verbose)]

To run pmrep Validate: 1. At the pmrep command prompt, enter the Validate command options and arguments. For example, enter the following command:
validate i list_of_valid_objects

The command line displays the validation summary and states that the validate command completed successfully.

Roll Back the Deployment


After you copy the deployment group to the test repository, you may want to modify the deployed objects. Use the roll back process to revert these objects back to the development repository. You can roll back a deployment to purge a deployed version from the target repository and revert objects to a previous version of deployment. You cannot roll back to a non-versioned repository.

pmrep RollbackDeployment
The RollbackDeployment command uses the following syntax:
rollbackdeployment -p <deployment_group_name> -t <nth_latest_deploy_run>

To run pmrep RollbackDeployment: 1. At the pmrep command prompt, enter the RollbackDeployment command options and arguments. For example, enter the following command:
rollbackdeployment p HR_ListOfValidObjects t 1

The command line displays the rollback information and states that the RollbackDeployment command succeeded.

Deployment through Scripts


Use scripts to automate the process of entering each pmrep command. You can choose to include all options for pmrep commands in a script and run the script from the command line. For greater flexibility, you can set up a script such that you enter few options from the command line. The following table describes the script names that you can use instead of pmrep commands:
Script Name ExecuteQuery.bat ExecuteQuery.sh CreateDeploymentGroup.bat pmrep Command ExecuteQuery ExecuteQuery CreateDeploymentGroup Operating System Windows UNIX Windows

Script Name CreateDeploymentGroup.sh DeployDeploymentGroup.bat DeployDeploymentGroup.sh Validate.bat Validate.sh RollbackDeployment.bat RollbackDeployment.sh

pmrep Command CreateDeploymentGroup DeployDeploymentGroup DeployDeploymentGroup Validate Validate RollbackDeployment RollbackDeployment

Operating System UNIX Windows UNIX Windows UNIX Windows UNIX

When you run a script from the command line, information messages are written to action.txt and error messages are written to error.txt. You can find the information and message text files in the following location:
<PowerCenter Installation Directory>\client\bin

Run the Query


Create a script that invokes the pmrep Connect and pmrep ExecuteQuery commands. For example, the sample script invokes the pmrep ExecuteQuery command and allows the -q <query_name> and -u <persistent_output_file_name> options to be entered in the command line. At the command prompt, enter the following text:
ExecuteQuery ListOfValidObjects list_of_valid_objects

Create a Deployment Group


Create a script that invokes the pmrep Connect and pmrep CreateDeploymentGroup commands. For example, the sample script invokes the pmrep CreateDeploymentGroup command and allows the -p <deployment_group_name> and -q <query_name> options to be entered in the command line. At the command prompt, enter the following text:
CreateDeploymentGroup HR_ListOfValidObjects ListOfValidObjects

Deploy Objects
Create a script that invokes the pmrep Connect and pmrep DeployDeploymentGroup commands. For example, the sample script invokes the pmrep deploydeploymentgroup command and allows the -p <deployment_group_name>, -r < target_repository_name>, -n < target_repository_user_name>, -x < target_repository_password>, and -l < log_file_name> options to be entered in the command line. At the command prompt, enter the following text:
DeployDeploymentGroup HR_ListOfValidObjects Samples_87 joe joe DeploymentLogFile

Validate the Objects


Create a script that invokes the pmrep Connect and pmrep Validate commands. For example, the sample script invokes the pmrep validate command and allows the -i < persistent_input_file > option to be entered in the command line. At the command prompt, enter the following text:
Validate list_of_valid_objects

Roll Back Objects


Create a script that invokes the pmrep Connect and pmrep RollbackDeployment commands. For example, the sample script invokes the pmrep RollbackDeployment command and allows the -p <deployment_group_name> and -t <nth_latest_deploy_run > options to be entered in the command line. At the command prompt, enter the following text:
RollbackDeployment HR_ListOfValidObjects 1

Author
Radhika Singh Technical Writer

You might also like