Archiving Informix On-line from cron
Carl Nichols and Ed Schaefer
To achieve on-line transaction processing (OLTP) performance,
Informix On-line database engine manages its own resources,
creating (and restoring) database archives. Part of
the archive process
is backing up the logical log files, which are critical
On-line data recovery.
Unfortunately, the Informix archive utility, tbtape,
only to be run in the foreground, and thus ties up resources
as monitors (or at least a window) and tape drives.
This article presents
an alternative procedure via a shell script for running
logical logging from a cron or the background. (Note:
shell script examples included within this article are
versions of the originals written at Newport News Shipbuilding,
What Is an Archive?
Informix defines archive-0 as a full database backup,
and archive-2 being incremental backups. Between archives,
log files which occupy contiguous disk space are released
after a full logical log is backed up.
The General Solution
Since UNIX treats devices as files, you can change the
logging tape drives to disk files, thus sending archive
data to a
file rather than to tape. On-line is controlled by a
file pointed to by TBCONFIG; within this file, change
archive device, TAPEDEV, and the logging device, LTAPEDEV,
to disk file names.
Also, UNIX permits standard input to be redirected from
to an ASCII file, which allows interactive commands,
such as tbtape,
to be run in the background. The ASCII files needed
arch_1, and arch_2, with the first line being an octal
carriage return, \012, and the second a 0, 1, or 2,
on the archive. Also, the file tbtape_cr contains just
line, consisting of the same octal carriage return.
Below is the file
The Archive Script: archive.sh
You create an archive by calling archive.sh (Listing
the proper 0, 1, or 2 argument. The script does
Stops logical logging by calling the Ktbtape.sh
script (Listing 2)
Performs the actual archive 0, 1, or 2
Re-starts logical logging in the background by calling
the Stbtape.sh script (Listing 3).
Since the scripts are relatively straightforward, we
on potential On-line problems.
1. Check the parameterized commands for pathname accuracy
2. Make sure the shell scripts and the redirected ASCII
earlier are in the $PWD directory.
3. Make sure that archive.sh is only called from the
4. If you attempt to change TAPEDEV, LTAPEDEV, TAPESIZE,
or LTAPESIZE using the Informix DBA utility, tbmonitor,
the file or device must exist and be owned and readable
by user "informix".
5. Be sure the $BACKARCDIR and $BACKLOGDIR file systems
are large enough to hold the largest expected archives,
and are not
on the same drive as the database partition.
Restoring an Archive
Archives are restored from the archive section of the
utility. tbmonitor will ask the for the base archive-0
and any archive-1 or archive-2 files. Each archive
file must be uncompressed if need be, and moved to the
value of TAPEDEV.
After the last archive is restored, any logical logs
be restored. The logical log file(s) must be moved to
the value LTAPEDEV.
Using cron or a background process to archive files
may free your resources, but you must also develop a
for saving the necessary files. For example, each archive
the copied "full" logical logs after the last
be maintained for recovery purposes.
About the Authors
Carl Nichols is a technical consultant and UNIX system
has been working with AT&T Global Information Solutions
since 1981 and
with UNIX-based systems since 1985. Carl helped design,
implement a 31-node Informix On-line distributed database
Attendance System at Newport New Shipbuilding, Newport
News, VA. He now
administers the system and has automated significant
portions of daily
Ed Schaefer is an Informix software developer and UNIX
administrator at jeTECH Data Systems of Moorpark, CA,
where he develops
Time and Attendance Software. He has been involved with
UNIX and Informix
since 1987 and was previously head of software development
Callendar Pie Shops of Orange, CA.