Backup and Recovery Macros

Overview of the Backup and Recovery Macros

The %RM_BACKUP and %RM_RESTORE macros provide an easy way for users to recover the content of failed SAS IT Resource Management staging or aggregation jobs. The following table shows the items that are managed by these macros.
SAS IT Resource Management Transformation Type
Items Backed Up
Staging transformation
Data duplication control information for this transformation
Staged data (if requested)
Deployed job code (if available)
Aggregation transformation
Aggregation data tables for this transformation
Aggregation status tables for this transformation
Percentile class and foreign key mapping tables for this transformation
Percentile data tables for this transformation
Stored compiled macro (“SAS IT Resource Management private code”) for this transformation
Deployed job code, if available
For each staging or aggregation transformation, there should be a corresponding execution of the %RM_BACKUP macro. This invocation of the backup macro would execute between successful runs of the staging or aggregation transformation. The backups could be done in one of the following ways:
  • as a separately scheduled job
  • by means of the Precode and Postcode tab on the Properties dialog box of the staging or aggregation transformation
  • as a separate user-written transformation in the same job as the staging or aggregation transformation

Managing the Backup and Restore Libraries

Each invocation of %RM_BACKUP uses libraries that you define and assign in order to store the items needed for recovery. To manage these libraries, it is important to determine how you want to handle recovery scenarios.
For example, you might decide to have a permanent SAS library that is always overwritten for a given backup invocation. In this scenario, you must always handle any recovery before the next regularly scheduled run for the SAS IT Resource Management job that contains the transformation that you are backing up. Otherwise, the valid backup recovery data is overwritten.
In a more likely scenario, you might define a set of recovery libraries. For example, if you want to have a 10-day recovery window, you should set up 10 libraries, one for each day of processing. Each day’s backup would use the next available library.

%RM_BACKUP

%RM_BACKUP Overview

%RM_BACKUP backs up all the needed content for the given SAS IT Resource Management transformation so that recovery can be performed.

%RM_BACKUP Syntax

%RM_BACKUP(
,OUT=libref-of-the-backup-library
,METAPASSWORD=user-password
,METAPORT=port-of-metadata-server
,METASERVER=name-of-metadata-server
,METAUSER=user-ID
,TRANSFORMID=metadata-ID-of-the-ITRM-transformation
<,METAREPOSITORY=name-of-metadata-repository>
<,STAGEDDATA=Y | N>
<,_RC=return-code>
);

%RM_BACKUP Required Arguments

Note: If the SAS code that contains the macro invocation is submitted to an application server that uses token authentication (such as when submitting from the Code Editor window in the SAS IT Resource Management client), the following parameters are not required: METAPASS, METAPORT, METASERVER, and METAUSER. For more information about token authentication, see SAS 9.3 Intelligence Platform: Security Administration Guide.
  • OUT=libref-of-the-backup-library
    specifies the libref of the already assigned library that is used for the content being backed up. This libref must refer to a library that has already been assigned.
  • METAPASS=user-password
    specifies the password that is associated with the metauser ID.
  • METAPORT=port-of-metadata-server
    specifies the port of the metadata server.
  • METASERVER=name-of-metadata-server
    specifies the name of the metadata server.
  • METAUSER=user-ID
    specifies the user ID that can access the metadata server.
  • TRANSFORMID=metadata-ID-of-the-ITRM-transformation
    specifies the metadata ID of the SAS IT Resource Management transformation that you want to back up. To find this value, perform the following steps:
    1. In the IT Data Marts view of the SAS IT Resource Management client, double-click to open the job that contains the transformation that you want to back up.
    2. In the Diagram tab of the Job Editor window, click the transformation to highlight it.
    3. Locate the Basic Properties view in the left panel of the client.
    4. Scroll down to find the metadata ID of the transformation that you highlighted.
      Locating the Metadata ID
      Locating the Metadata ID

%RM_BACKUP Options

METAREPOSITORY=name-of-metadata-repository
specifies the name of the metadata repository. The default for this option is Foundation.
STAGEDDATA=Y | N
specifies whether to back up the staged data, if the transformation being backed up is a staging transformation. The default for this option is N.
Note: The default is not to back up the staged data because the recovery process typically requires this data to be staged again.
_RC=return-code
specifies name of the macro variable to contain the return code. The default for this option is RC.

%RM_BACKUP Example


LIBNAME MYBKUP 'C:\mybackup';

%rm_backup(
   metaPassword=my-password,
   metaPort=8561,
   metaRepository=FOUNDATION,
   metaServer=my-server,
   metaUser=my-userID,
   out=MYBKUP,
   transformid=A5HHVOMR.BV00019I, /* metdata ID of the transformation */
   _rc=my-return-code
);

%RM_Restore

%RM_RESTORE Overview

%RM_RESTORE restores all the content for the given SAS IT Resource Management transformation that was backed up by a previous invocation of the %RM_BACKUP macro. Any restored data, such as aggregation tables, status tables, and so on, is stored in the location specified by the metadata. The deployed job code is saved in the location that you specify in the JOBCODE= parameter.

%RM_RESTORE Syntax

%RM_BACKUP(
JOBCODE=jobcode-location
,LIB=libref-of-the-backup-library
,METAPASSWORD=user-password
,METAPORT=port-of-metadata-server
,METASERVER=name-of-metadata-server
,METAUSER=user-ID
,TRANSFORMID=metadata-ID-of-the-ITRM-transformation
<,METAREPOSITORY=name-of-metadata-repository>
<,_RC=return-code>
);

%RM_RESTORE Required Arguments

Note: If the SAS code that contains the macro invocation is submitted to an application server that uses token authentication (such as when submitting from the Code Editor window in the SAS IT Resource Management client), the following parameters are not required: METAPASS, METAPORT, METASERVER, and METAUSER. For more information about token authentication, see SAS 9.3 Intelligence Platform: Security Administration Guide.
  • JOBCODE=jobcode-location
    specifies the path and file where you want to save the restored deployed job.
    Note: At backup, if the job was not deployed, or the job code could not be found at the location indicated by metadata, then there is no job code to restore. A note is produced in the SAS log if there is no job code to restore.
  • LIB=libref-of-the-backup-library
    specifies the libref of the library used for the content being restored. This libref must refer to a library that has already been assigned.
  • METAPASS=user-password
    specifies the password that is associated with the metauser ID.
  • METAPORT=port-of-metadata-server
    specifies the port of the metadata server.
  • METASERVER=name-of-metadata-server
    specifies the name of the metadata server.
  • METAUSER=user-ID
    specifies the user ID that accesses the metadata server.
  • TRANSFORMID=metadata-ID-of-the-ITRM-transformation
    specifies the metadata ID of the SAS IT Resource Management transformation that you want to restore.

%RM_RESTORE Options

METAREPOSITORY=name-of-metadata-repository
specifies the name of the metadata repository. The default for this option is Foundation.
_RC=return-code
specifies name of the macro variable that contains the return code. The default for this option is RC.

%RM_RESTORE Example


LIBNAME mybkup 'c:\mybackup' access=readonly;

%rm_restore(
   jobcode=my-jobcode-location,
   lib=mybkup,
   metaPassword=my-password,
   metaPort=8561,
   metaRepository=FOUNDATION,
   metaServer=my-server,
   metaUser=my-userID,
   transformid=A5HHVOMR.BV00019I, /* metdata ID of the transformation */
   _rc=my-return-code
);