• No results found

Sample Backup Procedures

In document Caché High Availability Guide (Page 56-61)

Caché Backup on UNIX Caché Backup on OpenVMS Incremental Backup on UNIX Schedule Backups with Task Manager

2.8.1 External UNIX Backup Script

Caché makes it easy to integrate with such utilities. The following is an example of a UNIX procedure:

1. Clear the list of database blocks modified since the last backup. This synchronization point later allows you to identify all database blocks modified during the backup. Call the application program interface (API), CLRINC^DBACK("QUIET"), in the backup script; this completes instantly.

2. Using your preferred backup utility, copy the CACHE.DAT files which may be in use.

3. Perform an incremental backup of the blocks modified by users during the backup. This should be an output sequential file. Since it is likely to be a small set of blocks, this step should complete very quickly. Call the API, BACKUP^DBACK(), in the backup script.

Important: The journal file should be switched at this time.

4. Copy the incremental file to the backup save-set, using your preferred UNIX command.

The following is an abbreviated example of the cbackup script:

../bin/cuxs -s . -U "" -B << cleanup s x=\$\$CLRINC^DBACK("NOISY")

i x s x=\$\$BACKUP^DBACK("","E","UNIX Backup via call_os_backup","","","") o "cback_temp":"WAS" u "cback_temp" w x c "cback_temp"

h cleanup

CLRINC and BACKUP("","E") are performed in one Caché session.

2.8.2 UNIX Backup and Restore

You should perform a UNIX level backup of your system periodically. You can perform a UNIX level backup either from the UNIX prompt or using the UNIX/Caché backup facility cbackup discussed below.

2.8.2.1 Using UNIX Backup Utilities

Use a UNIX backup utility in place of Caché Backup in the following situations:

• To restore sequential files or other software that is not part of Caché.

• To move Caché data between systems when you cannot transfer databases directly The following table lists UNIX utilities you may find useful for these types of backups.

UNIX Backup Utilities and Commands Function

Utility/Command

Copies or moves the given file or files to a different file, directory, or file system. Example: move the manager's directory (and the binary files in /usr/bin) to another directory, using the following command:#mv /usr/cache/*

/usr/cache.old/*

cp and mv (copy and move)

Standard UNIX command to copy files and directories, extract files from tape, and list the files on a tape. Produces more portable output than cpio or dump.

tar (tape archiver)

In conjunction with the find command, performs backups similar to the tar command.

cpio

Performs complete system backups.

dump

A third-party backup and restore utility. Before using it on your system, verify that it works properly and meets your requirements.

bru

2.8.2.2 cbackup Utility

A UNIX utility called cbackup allows you to back up your Caché databases using a system-level backup while automatically updating your Caché internal incremental backup. Using cbackup allows you to use the backup tools available on your operating system to back up your Caché databases and synchronize the bitmap information with the Caché internal incremental backup facility. This updates your Caché backup history so that you can use cbackup for full backups and the Caché Backup utility for incremental backups.

On Caché for UNIX, you must initiate all restores after backup interactively through the BACKUP utility.

Note: The cbackup utility is called from the shell environment. The backup utility halts Caché while it performs the backup and then restarts it.

To enable journaling you must first set up the call_os_backup file to choose your UNIX backup utility.

The call_os_backup file is automatically installed in your system manager directory. The example below uses tar as the backup utility.

:

# InterSystems Corporation

#

# File: call_os_backup

#

# This is a template for the user-specific backup procedure.

# It should backup Cache database files from a directory list contained in

# the cback_dir_list file, which is generated by the cbackup script that

# calls this one.

#

# Do not forget to include database extension files if any!

#

# Variable 'backstatus' should be set to 1 for success

# 0 for failure

#

# For example:

#

# sed -e "s/\/$//" cback_dir_list > cback_tar_list

# if tar cvfF /dev/rmt0 cback_tar_list

# then backstatus=1

# else backstatus=0

# fi

To use tar as your UNIX backup utility remove the comment marks from the last five lines above. If you want to use a different utility, use the form presented above to set up the backup utility.

#

echo "This message is from the call_os_backup script, which should contain a"

echo "user-defined backup procedure to backup Cache database files according"

echo "to a list of directories stored in cback_dir_list."

echo ""

echo " !!! Do not forget to include database extension files if any !!!"

echo ""

echo " Variable 'backstatus' should be set to 1 for success"

echo " 0 for failure"

#

backstatus=1

#

exit $backstatus

Performing Both Caché and System-level Backups Using cbackup 1. Be sure Caché is running and that you are in the manager's directory.

2. Enter the Backup Menu to ensure that you have selected all the directories you want to back up.

3. Halt out of Caché to return to the UNIX shell.

4. Type cbackup at the UNIX shell prompt. You will be prompted for confirmation of the directories to be backed up. The cbackup script automatically shuts down Caché and activates the

call_os_backup script which performs the backup.

2.8.3 OpenVMS Backup

To perform OpenVMS BACKUP you must shut down Caché. The OpenVMS backup copies entire CACHE.DAT and CACHE.EXT files.

CACHE.DAT and CACHE.EXT files created with either the Caché Database utility or the character-based MSU utility are RMS files. Thus, they can be backed up and copied using OpenVMS utilities, such as BACKUP.

You can defragment your Caché databases by using the OpenVMS BACKUP utility monthly to backup and restore your CACHE.DAT and CACHE.EXT files.

You can use the OpenVMS BACKUP utility to perform your weekly full backup as part of your strategy to ensure the physical integrity of your database. OpenVMS BACKUP provides greater redundancy and error checking than Caché backup. As a result, it is more proficient at recovering from tape errors.

The disadvantage of OpenVMS BACKUP is that, normally, Caché must be shut down to run the OpenVMS BACKUP. However, you can overcome this disadvantage by doing a OpenVMS BACKUP while Caché is running and following it with an incremental backup. See Using CBACKUP.COM.

2.8.3.1 Running OpenVMS BACKUP for a Caché Database

If you are using the OpenVMS BACKUP utility by itself, rather than in conjunction with Caché incremental backup as in the CBACKUP.COM example file, use this procedure:

1. Have users log off the system and set OpenVMS interactive logins to zero.

2. Stop Caché using the ccontrol stop command procedure.

3. Use OpenVMS BACKUP to back up the system.

4. If you are doing the backup to defragment your files, use the Restore option of the utility.

5. Start Caché using the ccontrol start command procedure and resume operation.

6. Enable OpenVMS logins.

7. Record this full backup in the Management Information option of the Caché BACKUP Utility.

2.8.3.2 Using CBACKUP.COM

InterSystems supplies a command procedure, CBACKUP.COM, which provides a model of how to use entry points in Caché backup routines to perform a backup while Caché is running. This command procedure gives you examples of various combinations of OpenVMS and Caché backups.

CBACKUP.COM is loaded into the CACHESYS directory during Caché installation from the file CBACKUP_PROTO.COM on the distribution tape.

CBACKUP.COM checks that the process which is executing it meets one of the following three criteria:

• Has the system manager's UIC

• Is authorized to hold SYSPRV

• Is authorized to hold CMKRNL

This privilege is required because CBACKUP.COM uses the /IGNORE=INTERLOCK qualifier in the OpenVMS BACKUP command. If the process does not meet one of the criteria, an error message is printed and CBACKUP.COM terminates.

CBACKUP.COM carries out these actions:

1. Performs the OpenVMS backup.

2. Records the date, time, and a brief description of the OpenVMS full backup in the Caché Backup History. This information is used later when you request a restore.

3. Runs a Caché incremental backup.

InterSystems recommends that you examine this procedure in detail, modify it as necessary, and use it if you wish to use OpenVMS BACKUP or any entry points to Caché Backup.

In document Caché High Availability Guide (Page 56-61)