With the newer releases of the IBM Informix Dynamic Server engine, the capability to perform backups to the file system has been greatly improved. The TAPEDEV onconfig parameter can now be set to a single file, a directory, or the value STDIO for standard output. With the ability to write directly to the file systems now in place, the next question is often: what is the best method to compress the archives?

The first option that comes to mind is just to compress the file when the backup has been completed. This is a perfectly acceptable method and it’s easy enough to set up a script that will do it for you, but isn’t it generally better to use fewer steps?

The next question is: since we can write to STDIO, why don’t we just pass it to a compression program? Again, this method will work but there are some downsides to performing this process. While the backup can be performed in a single step, the restore can’t. The ontape restore is a two-pass process so when it tries to “rewind” to the beginning of the file, the uncompress program will throw an error.

What this means is that if you want to perform a restore, then you must uncompress the archive file prior to the restore. Also, if you are writing your archives to a directory, then compressing in this way will disrupt the naming system that the engine prefers to use.

So, although these options are workable, there’s a better way. IBM has provided options that allow the engine itself to handle both the compression and decompression of the data as the archive runs. The parameters BACKUP_FILTER and RESTORE_FILTER can be set to enable the engine to handle the tasks while the archive process is being performed.

The commands you need to run are slightly different depending on where you are planning to write your archives, whether to file, directory or STDIO.

We’ll review five different archive options.

1) Ontape to file

The first method we’ll review is the standard ontape to a named file. When using this method, the TAPEDEV parameter is set to a specific file name and the BACKUP and RESTORE filters are not set. The target file for the archive must exist.

For this example:

TAPEDEV $INFORMIXDIR/backups/ontape.backup
BACKUP_FILTER
RESTORE_FILTER

To perform the backup:

[informix@localhost backups]$ ontape -s -L 0

Please mount tape 1 on /opt/IBM/informix/backups/ontape.backup and press Return to continue …
10 percent done.
100 percent done.
Read/Write End Of Medium enabled: blocks = 1107

Please label this tape as number 1 in the arc tape sequence.
This tape contains the following logical logs:

16

Program over.
[informix@localhost backups]$ ls -ltr
total 35424
-rw-rw—-. 1 informix informix 36274176 Apr 20 08:45 ontape.backup
[informix@localhost backups]$ file ontape.backup
ontape.backup: data
[informix@localhost backups]$

To perform a restore:

[informix@localhost backups]$ ontape -r

Please mount tape 1 on /opt/IBM/informix/backups/ontape.backup and press Return to continue …

Archive Tape Information

Tape type: Archive Backup Tape
Online version: IBM Informix Dynamic Server Version 12.10.FC6AEE
Archive date: Wed Apr 20 08:45:34 2016
User id: informix
Terminal id: /dev/pts/0
Archive level: 0
Tape device: /opt/IBM/informix/backups/ontape.backup
Tape blocksize (in k): 32
Tape size (in k): 0
Tape number in series: 1

Spaces to restore:1 [rootdbs]
2 [plog]
3 [llog]
4 [datadbs1]
5 [datadbs2]
6 [datadbs3]
7 [data8dbs1]
8 [data8dbs2]
9 [data8dbs3]
10 [sbspace1]

Archive Information

IBM Informix Dynamic Server Copyright 2001, 2015 IBM Corporation
Initialization Time 03/29/2016 08:15:27
System Page Size 2048
Version 28
Index Page Logging OFF
Archive CheckPoint Time 04/20/2016 08:45:34

Dbspaces
number flags fchunk nchunks flags owner name
1 1 1 1 N A informix rootdbs
2 1000001 2 1 N P A informix plog
3 1 3 1 N A informix llog
4 1 4 1 N A informix datadbs1
5 1 5 1 N A informix datadbs2
6 1 6 1 N A informix datadbs3
7 1 7 1 N A informix data8dbs1
8 1 8 1 N A informix data8dbs2
9 1 9 1 N A informix data8dbs3
10 2001 10 1 N T A informix tmpdbspace
11 8001 11 1 N S A informix sbspace1
12 a001 12 1 N U A informix tmpsbspace

Chunks
chk/dbs offset size free bpages flags pathname
1 1 0 78848 67832 PO— /opt/IBM/informix/storage/rootdbs
2 2 0 32768 0 PO–E /opt/IBM/informix/storage/ol_informix1210_plog_p_1
3 3 0 32768 15 PO–E /opt/IBM/informix/storage/ol_informix1210_llog_p_1
4 4 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs1_p_1
5 5 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs2_p_1
6 6 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs3_p_1
7 7 0 32768 29652 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs1_p_1
8 8 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs2_p_1
9 9 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs3_p_1
10 10 0 32768 32332 PO–E /opt/IBM/informix/storage/ol_informix1210_tmpdbspace_p_1
11 11 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_sbspace1_p_1
12 12 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_tmpsbspace_p_1

Continue restore? (y/n)y
Do you want to back up the logs? (y/n)n
Warning: Parameter’s user-configured value was adjusted. (DS_MAX_SCANS)
Warning: Parameter’s user-configured value was adjusted. (ONLIDX_MAXMEM)

Read/Write End Of Medium enabled: blocks = 1107
Restore a level 1 archive (y/n) Restore a level 1 archive (y/n) n
Do you want to restore log tapes? (y/n)n
/opt/IBM/informix/bin/onmode -sy

Program over.

[informix@localhost backups]$ onmode -m
[informix@localhost backups]$ onstat –

IBM Informix Dynamic Server Version 12.10.FC6AEE — On-Line — Up 00:00:28 — 219400 Kbytes

This method is commonly used and the backups can be compressed/decompressed as needed.

2) Ontape using FILTERs

Next we’ll look at using the FILTER parameter.

For this example:

TAPEDEV $INFORMIXDIR/backups/ontape.backup.compressed
BACKUP_FILTER /usr/bin/gzip
RESTORE_FILTER /usr/bin/gunzip

To perform the backup:

[informix@localhost backups]$ ontape -s -L 0

Please mount tape 1 on /opt/IBM/informix/backups/ontape.backup.compressed and press Return to continue …
Using the backup and restore filter /usr/bin/gzip.
10 percent done.
100 percent done.
Read/Write End Of Medium enabled: blocks = 74

Please label this tape as number 1 in the arc tape sequence.
This tape contains the following logical logs:

16

Program over.

To perform a restore:

[informix@localhost backups]$ ontape -r

Please mount tape 1 on /opt/IBM/informix/backups/ontape.backup.compressed and press Return to continue …
Using the backup and restore filter /usr/bin/gunzip.

Archive Tape Information

Tape type: Archive Backup Tape
Online version: IBM Informix Dynamic Server Version 12.10.FC6AEE
Archive date: Wed Apr 20 09:14:14 2016
User id: informix
Terminal id: /dev/pts/0
Archive level: 0
Tape device: /opt/IBM/informix/backups/ontape.backup.compressed
Tape blocksize (in k): 32
Tape size (in k): 0
Tape number in series: 1
Backup filter: /usr/bin/gzip

Spaces to restore:1 [rootdbs]
2 [plog]
3 [llog]
4 [datadbs1]
5 [datadbs2]
6 [datadbs3]
7 [data8dbs1]
8 [data8dbs2]
9 [data8dbs3]
10 [sbspace1]

Archive Information

IBM Informix Dynamic Server Copyright 2001, 2015 IBM Corporation
Initialization Time 03/29/2016 08:15:27
System Page Size 2048
Version 28
Index Page Logging OFF
Archive CheckPoint Time 04/20/2016 09:14:13

Dbspaces
number flags fchunk nchunks flags owner name
1 1 1 1 N A informix rootdbs
2 1000001 2 1 N P A informix plog
3 1 3 1 N A informix llog
4 1 4 1 N A informix datadbs1
5 1 5 1 N A informix datadbs2
6 1 6 1 N A informix datadbs3
7 1 7 1 N A informix data8dbs1
8 1 8 1 N A informix data8dbs2
9 1 9 1 N A informix data8dbs3
10 2001 10 1 N T A informix tmpdbspace
11 8001 11 1 N S A informix sbspace1
12 a001 12 1 N U A informix tmpsbspace

Chunks
chk/dbs offset size free bpages flags pathname
1 1 0 78848 67824 PO— /opt/IBM/informix/storage/rootdbs
2 2 0 32768 0 PO–E /opt/IBM/informix/storage/ol_informix1210_plog_p_1
3 3 0 32768 15 PO–E /opt/IBM/informix/storage/ol_informix1210_llog_p_1
4 4 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs1_p_1
5 5 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs2_p_1
6 6 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs3_p_1
7 7 0 32768 29652 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs1_p_1
8 8 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs2_p_1
9 9 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs3_p_1
10 10 0 32768 32332 PO–E /opt/IBM/informix/storage/ol_informix1210_tmpdbspace_p_1
11 11 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_sbspace1_p_1
12 12 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_tmpsbspace_p_1

Continue restore? (y/n)y
Do you want to back up the logs? (y/n)n
Using the backup and restore filter /usr/bin/gunzip.
Warning: Parameter’s user-configured value was adjusted. (DS_MAX_SCANS)
Warning: Parameter’s user-configured value was adjusted. (ONLIDX_MAXMEM)
Read/Write End Of Medium enabled: blocks = 74
Restore a level 1 archive (y/n) n
Do you want to restore log tapes? (y/n)n
/opt/IBM/informix/bin/onmode -sy

Program over.


[informix@localhost backups]$ onmode -m
[informix@localhost backups]$ onstat –

IBM Informix Dynamic Server Version 12.10.FC6AEE — On-Line — Up 00:00:28 — 219400 Kbytes

You’ll notice the only difference between this and the previous backup/restore is the line noting which tool is being used to perform the compress/decompress portion of the process.

3) Ontape using STDIO

The next method that we’ll examine is using STDIO to pass the archive to a compression program. For this example, TAPEDEV needs to be set to STDIO or overridden by the ontape -t flag and the FILTER parameters should not be set.

For this example:

TAPEDEV STDIO
BACKUP_FILTER
RESTORE_FILTER

To perform the backup:

[informix@localhost backups]$ ontape -s -L 0 -t STDIO | gzip > ontape.compressed.gz
[informix@localhost backups]$ ls -ltr

total 37708
-rw-rw----. 1 informix informix 36274176 Apr 20 08:45 ontape.backup
-rw-rw-r--. 1 informix informix 2336216 Apr 20 09:02 ontape.compressed.gz
[informix@localhost backups]$

To perform a restore:

Unfortunately, this method takes two steps to perform the restore.

[informix@localhost backups]$ onmode -ky
[informix@localhost backups]$ gunzip ontape.compressed.gz | ontape -r -t STDIO

Physical restore failed - function read archive backup failed code 1 errno 0

[informix@localhost backups]$ gunzip ontape.compressed.gz
[informix@localhost backups]$ cat ontape.compressed | ontape -r -t STDIO
[informix@localhost backups]$ onmode -m
[informix@localhost backups]$ onstat -

IBM Informix Dynamic Server Version 12.10.FC6AEE — On-Line — Up 00:00:23 — 219400 Kbytes

4) Ontape using a directory without filters

The preferred method for performing backups is to use a directory. This allows the engine to maintain the filenames which in turns makes it easier for you to determine the date and level of the archives.

For this example, we’ll set the TAPEDEV to a directory and leave the FILTERS unset.:

TAPEDEV $INFORMIXDIR/backups
BACKUP_FILTER
RESTORE_FILTER

To perform the backup:

[informix@localhost backups]$ ontape -s -L 0
10 percent done.
100 percent done.
File created: /opt/IBM/informix/backups/localhost.localdomain_0_L0

Please label this tape as number 1 in the arc tape sequence.
This tape contains the following logical logs:

16

Program over.

To perform a restore:

[informix@localhost backups]$ ontape -r
Restore will use level 0 archive file /opt/IBM/informix/backups/localhost.localdomain_0_L0. Press Return to continue …

Archive Tape Information

Tape type: Archive Backup Tape
Online version: IBM Informix Dynamic Server Version 12.10.FC6AEE
Archive date: Wed Apr 20 09:20:26 2016
User id: informix
Terminal id: /dev/pts/0
Archive level: 0
Tape device: /opt/IBM/informix/backups/
Tape blocksize (in k): 32
Tape size (in k): system defined for directory
Tape number in series: 1

Spaces to restore:1 [rootdbs]
2 [plog]
3 [llog]
4 [datadbs1]
5 [datadbs2]
6 [datadbs3]
7 [data8dbs1]
8 [data8dbs2]
9 [data8dbs3]
10 [sbspace1]

Archive Information

IBM Informix Dynamic Server Copyright 2001, 2015 IBM Corporation
Initialization Time 03/29/2016 08:15:27
System Page Size 2048
Version 28
Index Page Logging OFF
Archive CheckPoint Time 04/20/2016 09:20:26

Dbspaces
number flags fchunk nchunks flags owner name
1 1 1 1 N A informix rootdbs
2 1000001 2 1 N P A informix plog
3 1 3 1 N A informix llog
4 1 4 1 N A informix datadbs1
5 1 5 1 N A informix datadbs2
6 1 6 1 N A informix datadbs3
7 1 7 1 N A informix data8dbs1
8 1 8 1 N A informix data8dbs2
9 1 9 1 N A informix data8dbs3
10 2001 10 1 N T A informix tmpdbspace
11 8001 11 1 N S A informix sbspace1
12 a001 12 1 N U A informix tmpsbspace

Chunks
chk/dbs offset size free bpages flags pathname
1 1 0 78848 67808 PO— /opt/IBM/informix/storage/rootdbs
2 2 0 32768 0 PO–E /opt/IBM/informix/storage/ol_informix1210_plog_p_1
3 3 0 32768 15 PO–E /opt/IBM/informix/storage/ol_informix1210_llog_p_1
4 4 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs1_p_1
5 5 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs2_p_1
6 6 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs3_p_1
7 7 0 32768 29652 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs1_p_1
8 8 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs2_p_1
9 9 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs3_p_1
10 10 0 32768 32332 PO–E /opt/IBM/informix/storage/ol_informix1210_tmpdbspace_p_1
11 11 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_sbspace1_p_1
12 12 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_tmpsbspace_p_1

Continue restore? (y/n)y
Do you want to back up the logs? (y/n)n
Warning: Parameter’s user-configured value was adjusted. (DS_MAX_SCANS)
Warning: Parameter’s user-configured value was adjusted. (ONLIDX_MAXMEM)
Restore a level 1 archive (y/n) n
Do you want to restore log tapes? (y/n)n
/opt/IBM/informix/bin/onmode -sy

Program over.


[informix@localhost backups]$ onmode -m
on[informix@localhost backups]$ onstat –

IBM Informix Dynamic Server Version 12.10.FC6AEE — On-Line — Up 00:00:32 — 219400 Kbytes

5) Ontape to a directory using filters

Here’s how it works using the FILTER parameters. This allows Informix to manage the file names while enabling compression.

For this example:

TAPEDEV $INFORMIXDIR/backups
BACKUP_FILTER /usr/bin/gzip
RESTORE_FILTER /usr/bin/gunzip

To perform the backup:

[informix@localhost backups]$ ontape -s -L 0

Using the backup and restore filter /usr/bin/gzip.
10 percent done.
100 percent done.
File created: /opt/IBM/informix/backups/localhost.localdomain_0_L0

Please label this tape as number 1 in the arc tape sequence.
This tape contains the following logical logs:

16

Program over.

To perform a restore:

[informix@localhost backups]$ ontape -r

Restore will use level 0 archive file /opt/IBM/informix/backups/localhost.localdomain_0_L0. Press Return to continue …

Using the backup and restore filter /usr/bin/gunzip.

Archive Tape Information

Tape type: Archive Backup Tape
Online version: IBM Informix Dynamic Server Version 12.10.FC6AEE
Archive date: Wed Apr 20 09:43:36 2016
User id: informix
Terminal id: /dev/pts/0
Archive level: 0
Tape device: /opt/IBM/informix/backups/
Tape blocksize (in k): 32
Tape size (in k): system defined for directory
Tape number in series: 1
Backup filter: /usr/bin/gzip

Spaces to restore:1 [rootdbs]
2 [plog]
3 [llog]
4 [datadbs1]
5 [datadbs2]
6 [datadbs3]
7 [data8dbs1]
8 [data8dbs2]
9 [data8dbs3]
10 [sbspace1]

Archive Information

IBM Informix Dynamic Server Copyright 2001, 2015 IBM Corporation
Initialization Time 03/29/2016 08:15:27
System Page Size 2048
Version 28
Index Page Logging OFF
Archive CheckPoint Time 04/20/2016 09:43:35

Dbspaces
number flags fchunk nchunks flags owner name
1 1 1 1 N A informix rootdbs
2 1000001 2 1 N P A informix plog
3 1 3 1 N A informix llog
4 1 4 1 N A informix datadbs1
5 1 5 1 N A informix datadbs2
6 1 6 1 N A informix datadbs3
7 1 7 1 N A informix data8dbs1
8 1 8 1 N A informix data8dbs2
9 1 9 1 N A informix data8dbs3
10 2001 10 1 N T A informix tmpdbspace
11 8001 11 1 N S A informix sbspace1
12 a001 12 1 N U A informix tmpsbspace

Chunks
chk/dbs offset size free bpages flags pathname
1 1 0 78848 67808 PO— /opt/IBM/informix/storage/rootdbs
2 2 0 32768 0 PO–E /opt/IBM/informix/storage/ol_informix1210_plog_p_1
3 3 0 32768 15 PO–E /opt/IBM/informix/storage/ol_informix1210_llog_p_1
4 4 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs1_p_1
5 5 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs2_p_1
6 6 0 32768 32715 PO–E /opt/IBM/informix/storage/ol_informix1210_datadbs3_p_1
7 7 0 32768 29652 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs1_p_1
8 8 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs2_p_1
9 9 0 32768 32556 PO–E /opt/IBM/informix/storage/ol_informix1210_data8dbs3_p_1
10 10 0 32768 32332 PO–E /opt/IBM/informix/storage/ol_informix1210_tmpdbspace_p_1
11 11 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_sbspace1_p_1
12 12 0 32768 8466 POS– /opt/IBM/informix/storage/ol_informix1210_tmpsbspace_p_1

Continue restore? (y/n)y
Do you want to back up the logs? (y/n)n
Using the backup and restore filter /usr/bin/gunzip.
Warning: Parameter’s user-configured value was adjusted. (DS_MAX_SCANS)
Warning: Parameter’s user-configured value was adjusted. (ONLIDX_MAXMEM)
Restore a level 1 archive (y/n) n
Do you want to restore log tapes? (y/n)n
/opt/IBM/informix/bin/onmode -sy

Program over.


[informix@localhost backups]$ onmode -m
[informix@localhost backups]$ onstat –

IBM Informix Dynamic Server Version 12.10.FC6AEE — On-Line — Up 00:00:38 — 219400 Kbytes
Again, you’ll see the only difference is the line that notes the compression/decompression method.

Archive output

Finally, we’ll take a look at the files that were generated from the different backup methods.

Standard ontape:

[informix@localhost backups]$ ls -ltr
total 78388
-rw-rw----. 1 informix informix 36274176 Apr 20 08:45 ontape.backup

Standard ontape with the BACKUP_FILTER:

-rw-rw-r--. 1 informix informix 2344058 Apr 20 09:07 ontape.compressed.gz

Using STDIO piped through a compress command:

-rw-rw----. 1 informix informix 2424832 Apr 20 09:14 ontape.backup.compressed

Standard ontape to a directory:

-rw-rw----. 1 informix informix 36765696 Apr 20 09:20 localhost.localdomain_0_20160420_092026_L0

Standard ontape to a directory with the BACKUP_FILTER:

-rw-rw----. 1 informix informix 2457600 Apr 20 09:43 localhost.localdomain_0_L0

Share This