Creating a history table for a system-period temporal table


Use the following procedure to create a history table for a system-period table.

  1. On the BMC AMI Change Manager for Db2 Main Menu, select WORKID, and press Enter.
  2. On the WORKID Action Menu, type the name of the WORKID or type a wildcard pattern to display a list of work IDs. Then, select Specify Db2 definitions and press Enter.
  3. On the Object Specification panel, specify the name of a database and table space (or use wildcard characters) and press Enter.
  4. On the Mixed List panel, type CTB in the Act column adjacent to the table space (TS) for which you want to create a history table for an associated system-period temporal table.

    Important

    You must create the history table in a table space other than the one in which the system-period temporal table resides.

  5. Specify the information about the history table.
    1. Type the owner of the table.
    2. Type the name of the table.
    3. Specify the attributes for the table.
    4. Type S to select Table Column List.
  6. On the Table Columns List panel, specify the columns for the history table.

    Important

    The values for the attributes for the history table columns must be the same as the values for the system-period temporal table columns.

    1. Specify the begin column with the following attributes, and then press Enter.


      Attribute

      Value

      Column Name

      userDefinedSystemBeginName

      Column Type

      TIMESTAMP

      Length

      12

      Nl

      N

      Df

      N

      Pd

      blank

      Default Value

      blank

    2. Type L in the Act column adjacent to the begin column name and press Enter.
    3. Specify the end column with the following attributes and press Enter:


      Attribute

      Value

      Column Name

      userDefinedSystemEndName

      Column Type

      TIMESTAMP

      Length

      12

      Nl

      N

      Df

      N

      Pd

      blank

      Default Value

      blank

    4. Type L in the Act column adjacent to the begin column name and press Enter.
    5. Specify the transaction ID column with the following attributes:


      Attribute

      Value

      Column Name

      userDefinedSystemTransactionIDName

      Column Type

      TIMESTAMP

      Length

      12

      Nl

      Y or N

      Df

      X

      Pd

      blank

      Default Value

      blank

    6. Press Enter.
    7. Press END.
  7. Modify the base system-period temporal table.
    1. On the Mixed List panel, type E in the Act column adjacent to the system-period temporal table.
    2. On the Table Detail panel, at the Link History TB field, type 
      • to enable versioning without enabling the recording of an extra history table row when deleting a system-period temporal table row 
      • to enable versioning and enable recording of an extra history table row when deleting a system-period temporal table row
    3. Type S to select History Table Information.
    4. On the History Table Information panel, specify the name of the history table.
    5. Press Enter.
  8. Press END.
  9. Press END.Now that the table has been created, you can analyze a work ID and execute a worklist.


 

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