8. BAR manager

This section describes how to use the backup and restore manager to configure backup and restore services.

definition

The BAR manager defines a set of backup and restore commands, their options, and flags.

You can define multiple BAR managers and assign them on an instance by instance or host wide basis.

backup and restore services

The BAR manager allows you to map different types of backup and restore. You define the commands and parameters, and infx sets up the environment and executes the commands.

In this guide, I will describe the basic types of backup and restore. These are the default types and commands defined in the ontape config file, sub-infx-ontape.ini.

Default commands for onbar backup and restore are in: sub-infx-onbar.ini.

define backup types

The following types of backups are supported,  and a command has been defined for each. See the backup reference for more details.

 type  description
 dbs  Back up all storage spaces
 fake  An internal "fake" backup, does no backup but does set flags etc
 hot  The backup portion of the hot copy service
 ext  An external backup, back up the chunk data files using a third party tool
 logs  Back up logical logs
 verify Run archecker verification on the latest backup

define restore types

The following types of restores are supported, and a command has been defined for each. See the restore reference for more details. 

 type  description
 full  Complete restore of all storage spaces and available logical logs
 physical  Restore of storage spaces only, no transaction roll forward.
 logical  Restore of logical log transactions only
 endlogical  End the continuous restore of logical log transactions,
 salvage  Salvage the current logical logs
 warm  Online restore of selected storage spaces
 external  Restore chunk files with an external utility
 hot  Restore this instance from a "hot" copy taken directly of the source instance

define parameters

The following parameters have been defined for backup and restore commands. The BAR manager allows you to map these options to flags, as well as specify which options are valid for which backup and restore types.

 option  description
 dbspacelist  A list of storage spaces to restore, separated by commas.
 tapedev  Specify an alternative device for backup
 level  The level of backup to perform, 0 = full, 1/2 = incremental, defaults to 0 if not set.
 ansi  A list of databases to make ANSI mode logging after the backup
 buff  A list of databases to make buffered mode logging after the backup 
 unbuff  A list of databases to make un-buffered mode logging after the backup 
 nolog  A list of databases to turn off logging for after the backup 
 rename  The full pathname of a file containing new chunk paths 

If a parameter is not set, then nothing is passed. The exception to this is the level parameter, which is defaulted to 0 if not set.

specify options

You must specify which parameters are valid for which commands, and optionally specify a list of accepted values. infx uses this information to validate the backup and restore commands.

back up options

 type  options
 dbs  level=0|1|2 tapedev ansi buff unbuff nolog
 fake  ansi buff unbuff nolog
 ext  
 logs  
 hot
 verify 

level=0|1|2 specifies that the level parameter only accepts the values 0, 1 and 2. The backup service will generate an error if you pass an invalid value. Passing any additional options to the ext, logs, verify or hot backup will also generate an error.

restore options

 type  options
 full  rename tapedev force=yes|no online=yes|no
 physical  rename tapedev salvage=yes|no force=yes|no online=yes|no
 ext  force=yes|no
 logical  cont=yes|no online=yes|no
 endlogical  online=yes|no
 warm  dbspacelist
 hot  rename force=yes|no online=yes|no

specify flags

Change the way the parameters are passed to the commands. By default, infx puts the parameters as key/value pairs on the command line. You can change how the options are passed,

For example, instead of "level=0", pass "-L 0" for the ontape command.

level = -L

These are the default mappings for the ontape command.

 parameter  flag
 tapedev  -t
 dbspacelist  -D
 level  -L
 ansi  -A
 buff  -B
 nolog  -N
 unbuff  -U
 rename  -rename -f

specify commands

A command must be defined for each type of backup and restore. The command definitions support ${var} variables in the definition, which represent the parameters passed from the command line. These will be expanded at run time.

Example: definition for full backup, command infx backup type=dbs

[[backup]]
 type=dbs
 command=ontape -s ${level} ${ansi} ${buff} ${nolog} ${unbuff} ${tapedev} -v -d
 options=level=0|1|2 tapedev ansi buff unbuff nolog
 pre=rm -f ${tapedev}/${host}_${servernum}_[0-9]*
 post=ls -l ${tapedev}/*
 pass=100 percent done.

Example:  backup command translation to ontape command.

 service  command
 infx backup type=dbs level=1  ontape -s -L 1 -v -d
 infx backup type=dbs tapedev=/tmp/backup  ontape -s -L 0 -t /tmp/backup -v -d
 infx backup typre=dbs buff=db1 ontape -s -L 0 -B db1

optional: verification

After a backup or restore command completes, infx can perform an additional failure verification check.

By default, infx checks the command output for the word "failed", and considers the service failed if it is found. You can change this value for each type of command.

For example, check for the string 'error" in the output of the external backup command.

fail=error

You can specify an optional pass check, which is a string that must be found in the output to verify it completed successfully. 

For example, only consider ontape backups successful if the string "100 percent done." is found in the output.

pass=100 percent done.

optional: pre & post commands

You can specify optional commands to be executed before and after the backup or restore command. 

Example, remove old backup files from the directory before each backup.

pre=rm -f ${tapedev}/${host}_${servernum}_[0-9]* 

Example, execute an ls of the backup directory after each back up.

post=ls -l ${tapedev}/*

No flags are added to the parameters when they are passed to the pre or post commands.

backup commands

These are the ontape commands defined by default.

 type  command
 dbs  ontape -s ${level} ${ansi} ${buff} ${nolog} ${unbuff} ${tapedev} -v -d
 fake  ontape -s -F -L 0 ${ansi} ${buff} ${nolog} ${unbuff} -t /dev/null
 hot  ontape -s -F -L 0 -t STDIO
 ext  infx script script=sample/ext-backup.sh
 logs  ontape -a -d

The backup_hot command can still use ontape, even if you use onbar for the other back up types. It must be compatible with the restore_hot command definition.

restore commands

 type  command
 full  ontape -r ${rename} ${dbspacelist} ${tapedev} -v -d
 physical  ontape -p ${rename} ${tapedev} -v -d
 logical  ontape -l -C -d
 endlogical  ontape -l -X -d
 salvage  ontape -S -d
 warm  ontape -r ${dbspacelist} ${tapedev} -v -d
 external  infx script script=sample/ext-restore.sh
 hot  ontape -p ${rename} -t STDIO -v

The ext-backup.sh and ext-restore.sh scripts are only provided as an example. You should provide your own external backup and restore commands.