Rolling back implemented schema changes in Jenkins


BMC AMI DevOps lets you roll back the schema changes implemented by the current project build. Defining a rollback process enables you to restore your schema if you identify a problem.

This topic describes how:

You can include creating rollback artifacts in your Jenkins pipeline. However, do not include running the generated rollback execution JCL in your Jenkins pipeline.

To generate rollback artifacts

You can generate the following rollback artifacts to enable you to roll back the implemented schema changes:

Artifact

Description

Rollback CDL file

The CDL file that defines rollback schema changes

Rollback worklist

The worklist that Analysis generates to roll back the schema changes

Rollback impact report

The impact report that Analysis generates to roll back the schema changes

Rollback execution JCL

The execution JCL that runs the rollback worklist

You can either use two different projects or the same project to generate the rollback CDL file and the other rollback artifacts respectively.

Click here for the procedure to use two different projects to generate the rollback artifacts

To use two different projects to generate the rollback artifacts

This topic describes how to use two different projects to generate the rollback CDL file and the other rollback artifacts respectively.

This topic describes how:

Important

If you are using plug-in variables file-based symbolic variables when specifying the PDS and member that contains rollback artifacts, you must specify the corresponding variable from the Data Set Names for Rollback section of the plug-in variables file. For more information, see Sample-plug-in-variables-file-AMI_DevOps-properties.

To generate the rollback CDL file

Use the following procedure to generate the rollback CDL file for your project.

  1. Create a project or open an existing project for configuration. For more information, see the following topics:
  2. Add the following build steps sequentially and configure them:

    Serial number

    Build step

    1

    BMC AMI DevOps Common - Authentication

    2

    BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration

    3

    BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission

    4

    BMC AMI DevOps Common - JCL Execution

    5

    BMC AMI DevOps Common -  Clean Up

    When configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration build step, do the following:

    1. In the Before Making Schema Changes section, do the following:
      1. In the Select Baseline Type Before Execution field, select one of the following baseline types:
        • Pre-Execution Baseline (baseline created with database structures only)
        • Full-Recovery Baseline (baseline created with database structures and data)
      2. Enter the baseline profile name in the Baseline Profile Name (before execution) field.
      3. Enter the baseline name in the Baseline Name (before execution) field.
    2. In the Rollback Compare section, do the following:
      1. Select the Generate CDL to Rollback Schema Changes check box.

        Important

        You can only select the Generate CDL to Rollback Schema Changes check box if you have also selected a value other than None in the Select Baseline Type Before Execution field.

      2. Enter a partitioned data set (PDS) and member name in the Rollback PDS and Member Name (CDL) field.    
  3. Save your configuration.
  4. Build the project. For more information, see To build a project .

This implements the defined schema changes and also generates the rollback CDL file.

To generate the other rollback artifacts

After generating a rollback CDL file for your project, you can use the following procedure to generate the other rollback artifacts, which can be used to roll back the implemented schema changes.

  1. Create a project or open an existing project for configuration.
  2. Add the following build steps sequentially and configure them:

    Serial number

    Build step

    1

    BMC AMI DevOps Common - Authentication

    2

    BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration

    3

    BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission

    4

    BMC AMI DevOps Common -  Clean Up

    When configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration build step, do the following:

    1. In the General Input Fields section, enter a different work ID in the Work ID Name field from the one you entered when configuring the project that generated the rollback CDL file.

      Tip

      We recommend adding a _RB suffix to the work ID you entered when configuring the project that generated the rollback CDL file.

      Example

      In the Work ID Name field, if you entered ${Job_ID} when configuring the project that generated the rollback CDL file, you can enter ${Job_ID}_RB when configuring the project that generates the other rollback artifacts.

    2. Select the Skip Comparison check box.
    3. In the Import Input Fields section, in the CDL PDS and Member Name field, enter the PDS and member name of the rollback CDL file.
    4. In the Analysis Input Fields section, 
      1. In the Worklist PDS and Member Name field, enter the PDS and member name of the rollback worklist.
      2. In the Impact Report PDS and Member Name field, enter the PDS and member name of the rollback impact report.
    5. In the Execution JCL Generation Input Fields section, in the Execution JCL PDS and Member Name field, enter the PDS and member name of the rollback execution JCL.
    6. (optional) In the Job Information section, in the Analysis Input Stream field, add the following lines if you are rolling back schema changes using a full-recovery baseline that you created using the work ID of the project that generated the rollback CDL file:

      BLNAME baselineName
      BLRECOVER

      The baselineName variable represents the baseline name of the full-recovery baseline.

      See the following sample value of the Analysis Input Stream field:

      //*Analysis Input
      //ANALYSIS.ALURPT DD DISP=SHR,
      // DSN=&IMPRPT
      //ANALYSIS.ALUIN DD *
      SSID ${SSID}
      WORKID ${Work ID Owner}.${Work ID Name}
      INCLUDE (DATA AMS SQL )
      BLNAME baselineName
      BLRECOVER

    When configuring the BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission build step, do the following:

    Important

    The BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission build step lets you download any or all of the rollback artifacts to the destination directory. To download a rollback artifact, enter its respective source PDS name.

    You must enter the source PDS name for at least one rollback artifact.

    1. In the Source PDS Name (CDL) field, enter the PDS of the rollback CDL file.
    2. In the Source PDS Name (WORKLIST) field, enter the PDS of the rollback worklist.
    3. In the Source PDS Name (EXEC_JCL) field, enter the PDS of the rollback execution JCL.
    4. In the Source PDS Name (IMPACT REPORT) field, enter the PDS of the rollback impact report.
    5. In the Source Member Name field, enter the file name of the rollback member on the mainframe.
    6. In the Destination Directory Name field, enter the directory into which you want to download all the rollback artifacts.
    7. In the Destination File Name field, enter a value that can be used to generate the file names for all the rollback artifacts.
  3. Save your configuration.
  4. Build the project.

This generates the rollback execution JCL.


Click here for the procedure to use the same project to create all the rollback artifacts

To use the same project to create the rollback artifacts

The following procedure describes how you can use the same project to create all the rollback artifacts.

  1. Create a project or open an existing project for configuration. For more information, see the following topics:
  2. Add the following build steps sequentially and configure them:

    Serial number

    Build step

    Comments

    1

    BMC AMI DevOps Common - Authentication


    2

    BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 1

    Generates the rollback CDL file

    3

    BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission 1

    Downloads the CDL file, worklist, impact report, and execution JCL, which implement the schema changes, to the specified directory

    4

    BMC AMI DevOps Common - JCL Execution

    Implements the schema changes

    5

    BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 2

    Generates the other rollback artifacts

    6

    BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission 2

    Downloads all the rollback artifacts to the specified directory

    7

    BMC AMI DevOps Common -  Clean Up


    When configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 1 build step, in the Rollback Compare section, do the following:

    1. In the Before Making Schema Changes section, do the following:
      1. In the Select Baseline Type Before Execution field, select one of the following baseline types:
        • Pre-Execution Baseline (baseline created with database structures only)
        • Full-Recovery Baseline (baseline created with database structures and data)
      2. Enter the baseline profile name in the Baseline Profile Name (before execution) field.
      3. Enter the baseline name in the Baseline Name (before execution) field.
    2. In the Rollback Compare section, do the following:
      1. Select the Generate CDL to Rollback Schema Changes check box.

        Important

        You can only select the Generate CDL to Rollback Schema Changes check box if you have also selected a value other than None in the Select Baseline Type Before Execution field.

      2. Enter a partitioned data set (PDS) and member name in the Rollback PDS and Member Name (CDL) field.

    When configuring the  BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 2 build step, do the following:

    1. In the General Input Fields section, enter a different work ID in the Work ID Name field from the one you entered when configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 1 build step.

      Tip

      We recommend adding a _RB suffix to the work ID you entered when configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 1 build step.

      Example

      In the Work ID Name field, if you entered ${Job_ID} when configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 1 build step, you can enter ${Job_ID}_RB when configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 2 build step.

    2. Select the Skip Comparison check box.
    3. In the Import Input Fields section, in the CDL PDS and Member Name field, enter the PDS and member name of the rollback CDL file.
    4. In the Analysis Input Fields section,
      1. In the Worklist PDS and Member Name field, enter the PDS and member name of the rollback worklist.
      2. In the Impact Report PDS and Member Name field, enter the PDS and member name of the rollback impact report.
    5. In the Execution JCL Generation Input Fields section, in the Execution JCL PDS and Member Name field, enter the PDS and member name of the rollback execution JCL.
    6. (optional) In the Job Information section, in the Analysis Input Stream field, add the following lines if you are rolling back schema changes using a full-recovery baseline that you created using the work ID of the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration 1 build step:

      BLNAME baselineName
      BLRECOVER

      The baselineName variable represents the baseline name of the full-recovery baseline.

      See the following sample value of the Analysis Input Stream field:

      //*Analysis Input
      //ANALYSIS.ALURPT DD DISP=SHR,
      // DSN=&IMPRPT
      //ANALYSIS.ALUIN DD *
      SSID ${SSID}
      WORKID ${Work ID Owner}.${Work ID Name}
      INCLUDE (DATA AMS SQL )
      BLNAME baselineName
      BLRECOVER

    When configuring the  BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission 2 build step, do the following:

    Important

    The BMC AMI DevOps Schema Mgmt for Db2 - Output Transmission build step lets you download any or all of the rollback artifacts to the destination directory. To download a rollback artifact, enter its respective source PDS name.

    You must enter the source PDS name for at least one rollback artifact.

    1. In the Source PDS Name (CDL) field, enter the PDS of the rollback CDL file.
    2. In the Source PDS Name (WORKLIST) field, enter the PDS of the rollback worklist.
    3. In the Source PDS Name (EXEC_JCL) field, enter the PDS of the rollback execution JCL.
    4. In the Source PDS Name (IMPACT REPORT) field, enter the PDS of the rollback impact report.
    5. In the Source Member Name field, enter the file name of the rollback member on the mainframe.
    6. In the Destination Directory Name field, enter the directory into which you want to download all the rollback artifacts.
    7. In the Destination File Name field, enter a value that can be used to generate the file names for all the rollback artifacts.
  3. Save your configuration.
  4. Build the project. For more information, see To build a project.

To run the generated rollback execution JCL

Use the following procedure to run the generated rollback execution JCL.

Important

  • Perform this procedure only if you want to roll back the schema changes implemented previously. Do not include running the generated rollback execution JCL in your Jenkins pipeline.
  • You can alternatively submit the rollback execution JCL directly from the mainframe.
  1. Create a project or open an existing project for configuration.
  2. Add the following build steps sequentially:

    Serial number

    Build step

    1

    BMC AMI DevOps Common - Authentication

    2

    BMC AMI DevOps Common - JCL Execution

    3

    BMC AMI DevOps Common - Clean Up

    When configuring the BMC AMI DevOps Common - JCL Execution build step, do the following:

    1. Clear the Run Step regardless of previous Compare results check box.
    2. Select the Execute JCL from Mainframe PDS check box.
    3. In the Execution JCL PDS or Directory Name field, enter the name of the PDS that contains the rollback execution JCL.
    4. In the Execution JCL Member or File Name field, enter the name of the member that contains the rollback execution JCL.
  3. Save your configuration.
  4. Build the project.

This runs the rollback execution JCL, which rolls back the schema changes implemented previously.


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*