Nonstop Database, HiRDB Version 9 Installation and Design Guide

[Contents][Index][Back][Next]

12.15.3 Changing a falsification-unprevented table to a falsification prevented table

This subsection describes how to change an existing table to a falsification prevented table. Either of the following methods can be used to change a table to a falsification prevented table:

Tables in which data is stored cannot be changed into falsification prevented tables. When data is stored in the table, first unload the table data, and then change the table definition using ALTER TABLE.

Organization of this subsection
(1) Using HiRDB Control Manager's falsification prevention wizard
(2) Using HiRDB commands

(1) Using HiRDB Control Manager's falsification prevention wizard

The following describes the procedure for changing a table to a falsification prevented table by using HiRDB Control Manager's falsification prevention wizard.

Procedure
This example changes table T1 to a falsification prevented table with the following conditions set:
  • Column COL_NOTE is an updatable column.
  • Column COL_DATE is an insert history maintenance column, and the deletion prevented duration is set to 10 years.
  1. Start HiRDB Control Manager - Console. For details about how to start HiRDB Control Manager - Console, see the HiRDB Version 9 System Operation Guide.
  2. Register the applicable HiRDB server. For details about how to register the management HiRDB system, see the HiRDB Version 9 System Operation Guide. If it is already registered, this step is not necessary.
  3. From the Table Operations tab menu, choose Falsification Prevented Table Migration Wizard.
    The Falsification Prevention Wizard - 1/5 window appears.
    Select the name of the table to be changed to a falsification prevented table, and then in the Password text box, enter the password of the table owner. The value entered here is case-sensitive.
  4. Click the Next button.
    The Falsification Prevention Wizard - 2/5 window appears.
    In this window, set the deletion prevented duration. If you do not set the deletion prevented duration, make sure that Do not delete table data is selected. If you set a deletion prevented duration, select Allow deletion of data in table after a certain period of time, and then set Insert history maintenance column name and Deletion prevented duration.
  5. Click the Next button.
    The Falsification Prevention Wizard - 3/5 window appears.
    In this window, set the updatable columns. If no updatable columns are set, make sure that Do not allow per-column data updates is selected. If you set updatable columns, select Allow updates of some columns. Next, from the Columns list, select the names of the columns to make updatable. Then, click the right arrow button to add them to the Updatable columns list.
  6. Click the Next button.
    The Falsification Prevention Wizard - 4/5 window appears.
    In this window, specify the directory for the temporary files that are used while the table is being changed. The default values appear under Temporary file storage locations. Make changes if necessary.
  7. Click the Next button.
    The Falsification Prevention Wizard - 5/5 window appears.
    Check the conditions that were set. If you want to change the settings, click the Back button to return to the previous screens.
  8. When you are satisfied, click the Execute button. Processing for changing the table begins.
    Note
    After the falsification prevention wizard has been executed, make backups of the dictionary RDAREA and the RDAREAs required for the recovery of the table data. You can make backups by executing HiRDB Control Manager's backup wizard.
    Reference note
    In HiRDB Control Manager, a falsification prevented table has a different appearance from a normal table. You can verify that the changed table has the falsification prevention attribute by selecting Tables from the Map tab menu to display the Table Map window.

(2) Using HiRDB commands

The following procedure shows how to change a table into a falsification prevented table using HiRDB commands.

Procedure
Change table T1 stored in an RDAREA (RDAREA01) into a falsification prevented table.
  1. Using the pdhold command, place a backup hold on the RDAREA that stores the falsification-unprevented table and the RDAREA for the data dictionary (RDDIC01).
     
    pdhold -r RDAREA01,RDDIC01 -b
     
  2. Swap the system log files of the servers to which the RDAREA to be backed up belongs (bes01 and dic01).
     
    pdlogswap -d sys -s bes01 -w
    pdlogswap -d sys -s dic01 -w
     
  3. Execute the database copy utility (pdcopy) to make a backup of the RDAREA.
    For details about how to make backups, see the HiRDB Version 9 System Operation Guide.
     
    pdcopy -m /hirdb/rdarea/mast/mast01 -M r -p /usr/hirdb/pdcopy/pdcopy01 -b /usr/hirdb/pdcopy/backup/backup01 -r RDAREA01,RDDIC01
     
  4. Use the pdrels command to release the hold on the data dictionary RDAREA.
     
    pdrels -r RDDIC01
     
  5. Use the database reorganization utility (pdrorg) to unload data from the falsification-unprevented table. Make sure that you specify the -W option so that the unloaded data can be used as input data for the database load utility (pdload). For details about the control statement file (control_file), see the manual HiRDB Version 9 Command Reference.
     
    pdrorg -k unld -t T1 -W bin control_file
     
  6. Use the pdrels command to release the hold on the user RDAREA. Do not access RDAREAs after this until you again place a hold on the RDAREA in step 9. If the table you are working with is updated during this period, data might lose integrity.
     
    pdrels -r RDAREA01
     
  7. Use PURGE TABLE to delete all data from the falsification-unprevented table.
     
    PURGE TABLE T1
     
  8. Use ALTER TABLE with the falsification prevention option specified to change the table to a falsification prevented table.
     
    ALTER TABLE T1 CHANGE INSERT ONLY
     
  9. Using the pdhold command, place a hold on the RDAREA that stores the falsification-prevented table.
     
    pdhold -r RDAREA01
     
  10. Use the database load utility (pdload) to load the data that was unloaded in step 5. For details about the control statement file (control_file), see the manual HiRDB Version 9 Command Reference.
     
    pdload -b -W T1 control_file
     
  11. Use the pdrels command to release the hold on the RDAREA.
     
    pdrels -r RDAREA01
     
  12. Using the pdhold command, place a backup hold on the RDAREA to be backed up.
     
    pdhold -r RDAREA01,RDDIC01 -b
     
  13. Swap the system log files of the servers to which the RDAREA to be backed up belongs (bes01 and dic01).
     
    pdlogswap -d sys -s bes01 -w
    pdlogswap -d sys -s dic01 -w
     
  14. Execute the database copy utility (pdcopy) to make a backup of the RDAREA.
    For details about how to make backups, see the HiRDB Version 9 System Operation Guide.
     
    pdcopy -m /hirdb/rdarea/mast/mast01 -M r -p /usr/hirdb/pdcopy/pdcopy01 -b /usr/hirdb/pdcopy/backup/backup01 -r RDAREA01,RDDIC01
     
  15. Use the pdrels command to release the hold on the RDAREA.
     
    pdrels -r RDAREA01,RDDIC01
     

To determine the timing of setting the falsification prevention option, check the values in the SQL_TABLES data dictionary table. The following table lists the meanings of values in the SQL_TABLES table.

Table 12-8 Meanings of values in the SQL_TABLES table

Falsification prevention option setting SQL_TABLES
Value of INSERT_ONLY column Value of CHANGE_TIME_INSERT_ONLY
Not specified Null Null
Specified during execution of CREATE TABLE Y Null
Specified during execution of ALTER TABLE Y Date and time the table was changed to falsification prevented table