This subsection describes how to change an existing table into 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.
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.
- 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 |
- 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 |
- 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 C:\hirdb\rdarea\mast\mast01 -M r -p C:\usr\hirdb\pdcopy\pdcopy01 -b C:\usr\hirdb\pdcopy\backup\backup01 -r RDAREA01,RDDIC01 |
- Use the pdrels command to release the hold on the data dictionary RDAREA.
- 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 |
- 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.
- Use PURGE TABLE to delete all data from the falsification-unprevented table.
- Use ALTER TABLE with the falsification prevention option specified to change the table to a falsification prevented table.
ALTER TABLE T1 CHANGE INSERT ONLY |
- Using the pdhold command, place a hold on the RDAREA that stores the falsification-prevented table.
- 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 |
- Use the pdrels command to release the hold on the RDAREA.
- Using the pdhold command, place a backup hold on the RDAREA to be backed up.
pdhold -r RDAREA01,RDDIC01 -b |
- 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 |
- 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 C:\hirdb\rdarea\mast\mast01 -M r -p C:\usr\hirdb\pdcopy\pdcopy01 -b C:\usr\hirdb\pdcopy\backup\backup01 -r RDAREA01,RDDIC01 |
- 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-9 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 |