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

If a table contains no data, you can use the ALTER TABLE definition SQL statement to change its definition to a falsification prevented table. If the table contains data, ALTER TABLE cannot be used to change it to a falsification prevented table. In such a case, you must first unload the data, change the table to a falsification prevented table, and then load the data back into the table. The following example describes how to change an existing falsification-unprevented table containing data to a falsification prevented table:

To change a falsification-unprevented table to a falsification prevented table:
This example changes the existing falsification-unprevented table T1 that is stored in RDAREA RDAREA01 to a falsification prevented table.
  1. Use the pdhold command to shut down the RDAREA that contains the falsification-unprevented table.

    pdhold -r RDAREA01 -c

  2. 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).

    pdrorg -k unld -t T1 -W bin control_file

  3. Use PURGE TABLE to delete all data from the falsification-unprevented table.

    PURGE TABLE T1

  4. If you want to make some columns updatable, use ALTER TABLE to change their column attribute to updatable column.

    ALTER TABLE T1 CHANGE COLUMNA UPDATE

  5. Use ALTER TABLE with the falsification prevention option specified to change the table to a falsification prevented table.

    ALTER TABLE T1 CHANGE INSERT ONLY WHILE 10 YEARS BY COLUMNB

  6. Use the database load utility (pdload) to load the data that was unloaded in step 2.

    pdload -b -W T1 control_file

  7. Because the database load utility (pdload) was executed, use the database copy utility (pdcopy) to make a backup.

    pdcopy -m /hirdb/rdarea/mast/mast01 -M r -p /usr/hirdb/pdcopy/list/list01
    -b /usr/hirdb/pdcopy/backup/backup01 -r RDAREA01

  8. Use the pdrels command to release the RDAREA from shutdown status.

    pdrels -r RDAREA01 -o

To determine the timing of setting the falsification prevention option, check the values in the SQL_TABLES data dictionary table. Table 13-9 lists and describes the values in the SQL_TABLES table.

Table 13-9 Meanings of values in the SQL_TABLES table

Falsification prevention option settingSQL_TABLES
Value of INSERT_ONLY columnValue of CHANGE_TIME_INSERT_ONLY
Not specifiedNullNull
Specified during execution of CREATE TABLEYNull
Specified during execution of ALTER TABLEYDate and time the table was changed to falsification prevented table