backup
This section describes how to use the backup command to perform automatic instance backups.
backup & restore manager
The infx backup command uses a backup and restore manager that maps backup functions to commands.
If you use ontape or onbar, the infx backup commands remain the same.
More details BAR manager.
infx backup commands
function | description |
---|---|
dbs | Backup of storage spaces |
ext | External backup |
fake | Does no actual backup, but sets flags etc |
hot | Perform backup to STDOUT, part of the hot copy service |
logs | Backup all outstanding logical logs |
verify | Run archecker verification on the latest backup |
default
The BARMANAGER setting is in config.ini.
In this example, I assume the default setting, which runs the backups with ontape commands.
ontape BAR manager
infx command | ontape command |
---|---|
infx backup type=dbs | ontape -s -v -d |
infx backup type=ext | /infx/local/script/ |
infx backup type=fake | ontape -s -F -L 0 -t /dev/null |
infx backup type=hot | ontape -s -F -L 0 -t STDIO |
infx backup type=logs | ontape -a -d |
infx backup type=verify | /infx/local/scripts/ |
alias
infx uses alias definitions to define short hand versions of all the backup commands.
alias | expanded command |
---|---|
infx L0 | infx backup type=dbs level=0 |
infx L1 | infx backup type=dbs level=1 |
infx L2 | infx backup type=dbs level=2 |
infx logs | infx backup type=logs |
forking backups
infx automatically forks all backup commands into the background, and detaches them from the terminal. If you log out or lose your network connection, the backup continues.
You can manually fork the infx command into background (adding a “&” to the command line), then use the follow service to track progress.
Follow the execution of the backup-dbs service
This short hand version is also valid.
To follow the execution of the most recently started service.
storage space backup
The dbs function of the backup command backs up the storage spaces, and can also be used to set logging modes of databases in the instance.
By default the backups are stored in the instance backup directory.
The location is set in the TAPEDEV variable in the ONCONFIG file, but can also be overridden on the command line.
parameter | description |
---|---|
level | Level of backup, 0=fiull, 1=everything since last level 0, 2=everything since last level 1 |
tapedev | Alternate directory for ontape backup output, this directory must already exist |
ansi | Change database logging mode to ANSI logging. Specify a comma separated list of database names |
buf | Change database logging mode to bufered logging. Specify a comma separated list of database names |
unbuf | Change database logging mode to unbuffered logging. Specify a comma separated list of database names |
nolog | Change database logging mode to non-logged. Specify a comma separated list of database names |
example commands
command | description |
---|---|
infx backup type=dbs buf=db1 | Full backup to the default location. After the backup, db1 will be set to buffered logging mode. |
infx backup type=dbs level=1 | Performs a level 1 backup of the storage spaces, to the default location |
infx backup tapedev |
Perform a level 0 backup, the backup will be written to the /tmp/backup directory |
infx L0 buf=db1 | Performs a backup based on the L0 alias definition, then set db1 to buffered logging mode |
scheduled backups
Use the infx auto command to execute backups against all instances, in sequence.
transaction logs backup
The logs function of the backup command backs up all outstanding logical logs. It does not back up the current log.
Back up all outstanding logical logs.
The location of the logical log backup is determined by the LTAPEDEV parameter in the ONCONFIG file, and by default is /infx/inst/${inst}/backup/logs.
automatic transaction log backups
To automate the logical log backups, modify the ALARMPROGRAM script to run the infx backup-logs command.
To convert the standard alarmprogram.sh script that ships with Informix, make the following changes.
- Set BACKUPLOGS=Y (around line 30)
- Set BACKUP_CMD= "/infx/scripts/infx backup-logs fork=no" (around line 61)
Now, when a logical log fills up, Informix will call the infx backup command and back up the logical logs.
backup verification
The verify function of the backup command is used to run the archecker utility and verify the latest backup.
For ontape backup, the verification is performed using the infx script /infx/local/script/sample/ontape-verify.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#!/bin/sh # # ontape-verify.sh # # Verify the last backup using archecker # FLAG=$INFX_FLAG if [ -z "$FLAG" ] ; then FLAG=-t fi rm -f /tmp/ac_msg.log archecker ${FLAG}dvs passed=`grep "Archive Validation PASSED." /tmp/ac_msg.log | wc -l` if [ $passed -eq 1 ] ; then echo `date` infx_info archive validation passed else echo `date` infx_error archive validation failed fi |
fake backup
A fake backup does not actually do a backup, but can be used to set database logging modes.
This will set the db1 database to unbuffered logging mode.
external backup
The ext function of the backup command is used to run external backups. External backups are done by a utility outside of Informix.
To support this back up type, Informix allows you to block the database server, holding updates while the external utility makes a physical copy of the database chunks.
The external backup command will block the instance, run your external backup command, and then unblock the instance. infx also captures the output into the backup command log.
The command that does the external backup can be any command or script.
This is the default script, which simply makes a tar of the archive files.
1 2 3 4 |
#!/bin/ksh cd /infx/inst/$INFORMIXSERVER/chks tar cvf - . | gzip -c >/scratch/infx/$INFORMIXSERVER.tar.gz |