ASG-Rochade Backing up Rochade Databases Quick Start Guide Version 7.00.006 March 5, 2007 ROC0600-700 This publication contains information about backing up databases of ASG-Rochade (herein called Rochade). Backup and Maintenance Advice Daily backups, or backups after extensive transactions, are absolutely required, since a backup copy of the database is prerequisite for restoring it after system crashes and disk errors. There are three ways to back up databases: Backup after server shutdown (see "Backup after Server Shutdown" on page 2) Backup during normal operation - online backup (see "Backup during Normal Operation - Online Backup" on page 3) Backup of data in mirror databases (see "Backup of Data in Mirror Databases" on page 7) All three of these methods are equally suitable for backing up your databases. The method you choose is up to you, but be sure to follow the procedures described here exactly. Apart from that, you can use any system program to back up your databases. Check the backup copy for completeness and actual usability. To this end, you can store the backup copy temporarily on a hard disk (unless it is stored on a hard disk already) and call the rodbucx<os> service program with the -verify option (see also the section about verifying a database in the ASG-Rochade System Administrator s Guide). Copyright 2007 ASG GmbH & Co. KG, a wholly owned subsidiary of Allen Systems Group, Inc. All rights reserved. All names and products contained herein are the trademarks or registered trademarks of their respective holders. 1
In case of a system crash, there is a chance that write operations for some databases could not be completed and, as a result, database files remain open. Therefore, in case of a system crash, be sure to proceed in the manner described in "How to Proceed after a System Crash" on page 9. Backup after Server Shutdown 2 To back up the databases after server shutdown 1 Shut down the server using the Server Operator or this command: $OPER DOWN For a detailed description of this command, see the ASG-Rochade Programmer's Guide Volume 1. 2 Check if the server has been properly shut down. This is how you can tell if the server has been properly terminated: From the initialization file of the server: The server writes the STATE setting into the start section. If the server has been terminated properly, the STATE setting has the value DOWN. From the server event log: If the server has been terminated properly, the server log contains this kind of entry: dd/mm/yyyy 12:30:58 Server termination Return Code: 1 Also when Return Code is given as 1 in the server log, the server has been shut down in regular fashion; however, in this case through an operating system command, not with the operator command $OPER DOWN/TERM. 3 Back up the databases. To carry out the backup, use the standard backup program for your operating system. For information on the files that should be included in the backup, see "Backup Strategy" on page 3. 4 Check the backup copy for completeness and actual usability. To this end, you can store the backup copy temporarily on a hard disk (unless it is stored on a hard disk already) and call the rodbucx<os> service program with the -verify option (see also the section about verifying a database in the ASG-Rochade System Administrator s Guide).
Backup Strategy Under Windows and UNIX Back up the databases by copying the database files to a different directory or to a CD or DVD. Include all the databases of the server in the backup. Under MVS To back up the Rochade databases, you must first unload them (e.g., using the job VSAMREPR) and subsequently run the actual backup (e.g., using the job IEBGENER). To restore the Rochade databases again, you must load them (e.g., using the job VSAMLOAD). The jobs VSAMREPR and VSAMLOAD are located in the dataset PFX?ROPROD.DATA of your Rochade installation. See also the section about unloading extented format for VSAM datasets in the ASG-Rochade System Administrator s Guide. Under BS2000 You can use your operating system-specific tools for the database backup (e.g., ARCHIVE). Backup during Normal Operation - Online Backup The procedure outlined here guarantees data integrity while the server is running: A special operator command starts the backup mode for the server. Upon activation of the backup mode, the server brings the database into a consistent state, closes it, and reopens it immediately for reading. For the duration of the backup, the server executes all write operations in a buffer database. 3
The end of the backup is communicated to the server via an operator command. This is followed by the cleanup phase. The server reopens the database in the original access mode, then it transfers the contents of the buffer database into the actual databases. After the transfer of the buffer database contents, the server deletes the buffer database under these conditions: In Windows and UNIX: Under any conditions. In MVS: If the buffer database was specified via DS name of a VSAM dataset. In BS2000: If the buffer database was specified via an ending xxx. During the backup, server access performance may drop slightly (by about 10 percent). In addition, the server will refuse these operator commands with return code B during online backup: $OPER CREATEDB $OPER MOUNTDB Create database Assign database to server data space ASG recommends that you contact your Rochade administrator and coordinate your work with him to avoid extensive write and delete operations (such as batch imports and subject area deletion) during the backup and cleanup phases of an online backup. If the server is stopped or crashes during backup or cleanup, the transfer of the data from the buffer database to the actual databases remains incomplete. In such a case, it is of utmost importance that the buffer databases as well as all databases that are connected to the server remain unchanged until the next server start. Also be absolutely sure to observe the steps described in "How to Proceed after a System Crash" on page 9. If the server was stopped during cleanup, it will recognize the next time it is started that the buffer database data have not been transferred completely to the actual databases, and it will finish the cleanup procedure. It will do this by performing the activities specified in the ONLINE_BACKUP_MODE setting. You can find a description of this setting in "Initialization File for Starting the Server," on page 22. 4
Prerequisites for Online Backup This setting must be specified in the initialization file of the server: ONLINE_BACKUP_DATABASE=<db_section> where <db_section> is the name of the initialization file section that contains the settings for the buffer database. Under Windows and UNIX, the name of the buffer database may also contain a relative or absolute path. In this case, the specified directory must exist. Under MVS and BS2000, ASG recommends that you specify the buffer database via the DS name of a VSAM dataset or via the ending xxx. This allows the server to dynamically create the buffer database and delete it at the end of the backup. There must be sufficient hard disk space for creating the buffer database. The amount of space required depends on the time the backup takes and the number of write operations to be buffered. For this reason, a general recommendation regarding hard disk space cannot be given. Under MVS, you can use the provided sample job ONLBCKUP to start the online backup. It contains comments to help you customize its code for your Rochade environment. To back up the database while the server is running 1 Check to make sure that the backup mode is not already active. Use this command: $OPER ONLINE_BACKUP SHOW <var1> Only if the command produces the return code T and writes OFF into the variable <var>, can you proceed with step 2. If the return code is not T, you have to find the reason for the failure before you can restart with step 1. If <var1> contains the value ACTIVE or CLEANUP, the server is still in backup mode, and you cannot start a new backup. In this case, wait for the currently running backup to terminate. For a complete description of this command, see the ASG-Rochade Programmer's Guide Volume 1. 5
2 Activate the backup mode using this command: $OPER ONLINE_BACKUP BEGIN <var1> <var2> Only if the command returns T, can you proceed with step 3. Otherwise, you will need to find the reason for the failure first. During the backup, you must not assign any new databases to the data space of the server ($OPER MOUNTDB). The backup has ended when the command $OPER ONLINE_BACKUP SHOW <var1> returns the value OFF in <var1>. 3 Using the standard backup program for your operating system, back up the databases. See "Backup Strategy" on page 3 for information on the files that should be included in the backup. 4 Check whether the backup program has finished. At this point, you can also defragment and compress the data backed up. See also the section the service program rodbucx<os> in the ASG-Rochade System Administrator s Guide. Check the backup copy for completeness and actual usability. To this end, you can store the backup copy temporarily on a hard disk (unless it is stored on a hard disk already) and call the rodbucx<os> service program with the -verify option (see also the section about verifying a database in the ASG-Rochade System Administrator s Guide). Since the server reads the names of the databases again from the initialization file when deactivating the backup mode, you can now replace the actual databases with the compressed ones by changing the database names accordingly in the DFILE setting of the initialization file. Best use the operator command $OPER PROFILE for this. It is not possible to replace the existing databases arbitrarily with other databases. This is because the server writes a set of special records to the databases when activating the backup mode, and uses these records to examine the identity of the databases. Also, defragmented databases can be exchanged only if the service program rodbucx<os> was called exclusively with the option -compress or -defrag. If you combine the options -compress and -defrag with other options (e.g., the option -release or numrebuild), the identity record of the database is modified, and the server will not accept the change. 6
5 Deactivate the backup mode using this command: $OPER ONLINE_BACKUP END <var1> If the command produces the return code T, the backup mode switches off and the server starts transferring data from the buffer database to the actual databases. The server opens the databases connected to the server in their original access mode and examines the special identity records of the buffer database and the actual databases. The server transfers the data from the buffer database only if the identity records match. A transfer between databases that do not match would lead to inconsistencies in the databases. Backup of Data in Mirror Databases Backing up data in mirror databases amounts to keeping duplicate datasets. ASG recommends this way of backing up your data if you need permanent and uninterrupted access to your data, and if, for various reasons, your enterprise cannot afford to lose time by carrying out restore logging after a server crash. To store data in mirror databases 1 Make a backup of all databases that are active at the server. This backup copy will be the basis for keeping mirror databases. 2 Note these entries in the server initialization file: LOG_NAME=ROCH.LOG LOG_CURRENT_SEG=4 LOG_CONSUMED_SEG=3 LOG_MAX_SEG=3 LOG_MAX_SIZE=50 LOG_MAX_TIME=180 The values in italics are examples, to be replaced with the values that meet your requirements. In the example, the server writes the LOG file ROCH04.LOG. When the server opens a new LOG file, it analyzes the value of the setting LOG_CONSUMED_SEG. The difference between the values of the settings LOG_CURRENT_SEG and LOG_CONSUMED_SEG must not exceed the value of LOG_MAX_SEG. The value of LOG_CURRENT_SEG is used by the server for building the file name. Via LOG_MAX_SEG, you specify how many unprocessed LOG files may exist at any one time. You should choose a value greater than 1, since you need at least one additional LOG file to store the write operations that might occur in the original database while you update the mirror database with a LOG file. 7
Via LOG_MAX_SIZE, you specify the maximum size in KB for a LOG file. By specifying the maximum size, you can influence how much time the processing of a LOG file will consume, and how much disk space the LOG files require. Via LOG_MAX_TIME, you specify the time in seconds after which a LOG file will be closed. With this setting, you can, for example, specify a time interval after which the mirror databases will be updated with the LOG files. 3 In a consumer job that controls processing of completed LOG files, you must implement a waiting loop that permanently evaluates the difference between the settings LOG_CURRENT_SEG and LOG_CONSUMED_SEG. For example: FOREVER: While (LOG_CURRENT_SEG - LOG_CONSUMED_SEG <= 1) sleep (n minutes) 4 The server updates the value for the LOG_CURRENT_SEG setting whenever it switches the LOG file. When the server writes to the LOG file ROCH05.LOG, the settings have these values: LOG_CURRENT_SEG=5 LOG_CONSUMED_SEG=3 5 The consumer job recognizes that the server has completed a LOG file and processes it by starting the BACKUP job. In the backup, the mirror database is updated with the completed LOG file by the rodbucx<os> service program. For example: FOREVER: While (LOG_CURRENT_SEG - LOG_CONSUMED_SEG <= 1) sleep (n minutes) number := INC(LOG_CONSUMED_SEG) filename := LOGNAME.ROOT + number + LOGNAME.EXT BACKUP(filename) 6 The consumer job acknowledges processing of the LOG file in the server s initialization file, in which the settings would then have these values: LOG_CURRENT_SEG=5 LOG_CONSUMED_SEG=4 8
How to Proceed after a System Crash As the result of a system crash, it is possible that write operations to some databases are interrupted, causing some database files to still be open. As the server or the service program rodbucx<os> is started, Rochade executes an automatic recovery. In the course of this, all write operations are completed and the databases are properly closed. To proceed after a system crash 1 Make a backup copy of these items: All databases connected to the server The buffer database, if the system crash happened during online backup The file that you have designated as LOG file (LOG_NAME setting) The initialization file (.ini) The server event log file (EVENTLOG setting) 2 Check if the hard disk holding the databases has enough free space. If there is not enough free space, this could have been the cause of the system crash. If so, you must create more free space on the disk. 3 Start the server with exactly the same environment as it had at the time of the system crash. The LOG file matches exactly those databases that were assigned to the server in UPDATE mode at the time of the system crash. For this reason, ASG recommends that you make no changes to the database settings. During recovery, Rochade recognizes if a reconstruction of the databases is necessary, and if so, executes it. If, after the system crash, any of the database settings have been altered, or if a backup of the databases or of the LOG file has been applied, or if databases have been deleted, Rochade recognizes that. Then the server executes a recovery only for those databases whose settings have not been changed, and then quits. In such cases, the LOG file is retained. So you can use it again to execute a recovery for the missing databases. If you want to do this, the settings for the databases must be again as they were at the time of the system crash. 9
4 Check the server event log. You can resume work if you find no indications of errors in these files. If you find any indications of errors in these files, execute step 5. 5 Perform this step if errors occurred in step 3, you found signs of errors in the log files, or the server continues to crash frequently. Use the service program program rodbucx<os> to inspect the state of the Rochade databases more closely. For information on this service program, see the ASG-Rochade System Administrator s Guide. 10