REFRESH REPLICATION updates the whole replication with all the user spaces that are current in the replication.
REFRESH REPLICATION FOR SPACE updates the catalog space of the replication and all specified user spaces. If the replication contained more user spaces than specified, these will be logically deleted from the replication (“previous replication spaces”). The replication will become a partial replication of the original replication. Previous replication spaces are not physically deleted.
The database administrator must make available all the logging files from a certain period and the CAT-REC copy of the original database. The job variable SESAM.replication.NEXT-REPL-LOG contains the number and the subnumber of each of the files to be made available first. The job variable is created in CREATE REPLICATION and updated in each case in REFRESH REPLICATION.
All the user spaces of a replication must be included in the logging in the original database. Spaces, for which logging was interrupted in the original, can no longer be updated. In this case, the replication can be reduced using REFRESH REPLICATION FOR SPACE if the affected space is not specified in the space list in FOR SPACE.
Logging is interrupted by the statements ALTER SPACE NO LOG, LOAD OFFLINE, IMPORT TABLE, RECOVER INDEX, RECOVER TO and MIGRATE, see also “Suspension of logging by SESAM/SQL in its own utility statements”.
A replication can also be reduced with REFRESH REPLICATION FOR SPACE if spaces of the replication are invalid or are no longer required in the replication.
Spaces become invalid through DROP SPACE in the original, RECOVER SPACE USING REPLICATION RENAME, RECOVER SPACE TO REPLICATION or RECOVER SPACE USING REPLICATION TO mark.
Figure 21: Update a replication
Switching the log files and creating a CAT-REC copy
Updating the replication by means of logging files and the CAT-REC copy
Procedure
At a given moment, the replication is to be updated to the status of the original database. To do this, use CHANGE-CATLOG or COPY CATALOG_SPACE to swap the CAT-LOG and DA-LOG files in the original. This creates a CAT-REC copy.
Transactions which are still active are rolled back in the replication at the end of the update.
If transactions have been rolled back, all logging files from the start of the rolled back transaction onwards must be processed when REFRESH REPLICATION is subsequently called. This is the only way that a defined state can be obtained in the replication.
REFRESH REPLICATION should therefore be avoided if long-lasting transactions are open. In the worst case, sometimes several times, the modifications may be applied to these transactions, these transactions then may be rolled back and, then again, the modifications may be applied to these transactions.
REFRESH REPLICATION restarts from the replication's CAT-REC file. The difference from CAT-REC copy determines which CAT-LOG files must be incorporated in the catalog space. After the CAT-LOG files have been incorporated, the current RECOVERY_UNITS and DA-LOGS catalog tables of the processed catalog space can be used to determine to which DA-LOG files in the user spaces the modifications have to be applied. Then the modifications are applied to the DA-LOG files.
The replication is identical to the original at the time the CAT-REC copy was used.
The numbers of the oldest logging files which are required for the next REFRESH REPLICATION are entered in a job variable.
In the same way as for RECOVER in the service task, the catalog space and the user spaces are updated in a DBH which the modifications are applied to.
The replication is locked if an error occurs during the applying of the modifications, e.g. because of a missing log file, a memory bottleneck or because the service task has terminated. Once the cause of the error has been eliminated, the replication can be completed using REFRESH REPLICATION.
If REFRESH REPLICATION aborts because the DBH is terminated or because it is executing an internal restart, it is not possible to repeat REFRESH REPLICATION. In this case, the replication is marked as defective and has to be recreated.
CREATE SPACE in the original automatically changes an existing replication to a partial replication since the new space is not yet present in the replication.