backup & restore

This section describes the settings and options available through the infx backup and restore manager.

definition

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

You can have multiple BAR manager definitions and assign them on an instance by instance or host wide basis.

Then, regardless of the backup method being used by an instance, you just use the infx backup command to run a backup.

backup and restore commands

The BAR manager allows you to define different types of backups and restores. You define the commands and parameters for each, and infx sets up the environment and then executes the commands.

default definitions

In this guide, I will describe the basic types of backup and restore.

These are the default commands already defined in the ontape config file: sub-infx-ontape.ini.

You can also see the default commands for onbar backup and restore:sub-infx-onbar.ini.

define backup types

infx allows for the following backups.

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.

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

You need to specify what parameters can be passed on the command line, and how those parameters map to options for the individual commands.

These are the parameters and options for the default ontape commands.

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 each command. You can optionally specify a list of acceptable values.

backup options

type options
dbs level=0|1|2 tapedev ansi buff unbuff nolog
fake ansi buff unbuff nolog

Note that the ext, logs, verify or hot options need no additional parameters.

level=0|1|2 specifies that the level parameter only accepts the values 0, 1 and 2.

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

This section maps how the command line parameters are translated to options for the individual commands.

For example, map the command line parameter of “level=0” to “-L 0” for the ontape command.

default mappings

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
If you do not map a command line parameter it will be based through “as is” to the underlying command

commands

At this point, we define the whole command with options for each type of backup and restore.

In these definitions, use ${var} to represent the parameters from the command line. These will be expanded at run time.

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

Some example infx backup commands translated to ontape.

infx ontape
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 type=dbs buff=db1 ontape -s -L 0 -B db1 -v -d

additional options

You can also optionally define command verification, and pre and post commands.

verification

Historically, the exit status from Informix commands like ontape have been somewhat unreliable, an exit status of 0 does not always indicate a successful backup.

By default, infx checks the command output for the string “failed”, and considers the command failed if it is found.

You can specify the fail option to change which string is searched for.

For example, check for the string ‘error” in the output of the command.

You could instead, specify a string to be searched for that indicates success.

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

pre & post commands

It is quite often a requirement to run another command before or after the backup.

This could be a command that removes old backup files, or does other setup actions.

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

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

backup commands

This is the full list of 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 type=hot command can still use ontape, even if you use onbar for the other backup types. It must be compatible with the restore type=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 must provide your own external backup and restore commands.