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.
- Use the pdhold command to shut down the RDAREA that contains the falsification-unprevented table.
- 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
|
- Use PURGE TABLE to delete all data from the falsification-unprevented table.
- 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
|
- 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
|
- Use the database load utility (pdload) to load the data that was unloaded in step 2.
pdload -b -W T1 control_file
|
- 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
|
- Use the pdrels command to release the RDAREA from shutdown status.
To determine the timing of setting the falsification prevention option, check the values in the SQL_TABLES data dictionary table. Table 12-9 lists and describes the 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 |
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.