Saving and restoring system-period temporal tables
Both the system-period temporal table and its history table must be explicitly saved. The database manager does not save both files when only one of the files is saved.
When a system-period temporal table is restored without its corresponding history table or a history table is restored without its corresponding system-period temporal table, the restored table's versioning relationship remains defined but is not established. When this happens, the table's versioning status is changed to the defined state. A CPI3231 informational message is issued when a system-period temporal table's versioning status is changed to the defined state. There are restrictions to the actions that can be performed on a system-period temporal table or a history table when the table is in defined state. Inserts, updates, and deletes are prevented. Most DDL changes are also prevented. The only operations that are allowed are:
- ALTER TABLE ADD VERSIONING
- ALTER TABLE DROP VERSIONING
- DROP TABLE
To determine if a system-period temporal table is in the defined state, you can query the QSYS2/SYSPERIODS catalog view. To determine whether a history table is in the defined state, you can query the QSYS2/SYSHISTORYTABLES catalog view. Both views have the column, VERSIONING_STATUS, that contains an 'E' if a versioning relationship between the system-period temporal table and the history table has been established or a 'D' if a versioning relationship between the system-period temporal table and the history table has been defined but not established.
For more information, see Saving physical files that are temporal and Restoring physical files that are temporal.