Informix Backup Recovery

Informix Architecture

Instance

An Informix instance is a single connection to shared memory. It is represented by one or more oninit processes. When Informix is started or stopped, these processes appear and disappear.

Database

Informix cannot recover a single database inside an instance. However, a DBA who isolated a database by putting it into a separate dbspace then could recover that database by recovering that dbspace.

BLOB space

All Informix Binary Large Object (BLOB) data is kept inside the database, but there is a special dbspace for BLOB data.

Chunk

A chunk is a physical portion of disk on which Informix stores its data. A chunk can be either a raw partition or a filesystem file.

Page

An Informix page is a physically contiguous portion of a chunk.

Extent

An extent is a logical grouping of at least four physically contiguous pages. When you create a table in Informix, you specify the amount of space in kilobytes. Informix then will allocate as many contiguous pages as possible to satisfy this request. If it cannot allocate enough space in one contiguous section, other extents will be created as necessary. As a table grows, the existing extents that a table is using are used up, and Informix will allocate additional pages for that table. It will try to allocate physically contiguous pages if it can. If not, it again will allocate another extent.

tblspace

The space that a table occupies within a chunk. That is, it is a logical grouping of the extents within a chunk that are allocated to a table. They may or may not be physically contiguous.

dbspace

A dbspace is a storage element that consists of one or more chunks. A dbspace contains one or more tblspaces. Although Informix backups usually are done on the instance level, restores can be done on the dbspace level. That is, you can restore a single dbspace.

Fragment

When a table is partitioned across multiple dbspaces, the portion of the table that resides in a single dbspace is called a fragment. It does not present any unique backup requirements.

sysmaster database

The sysmaster database is the database of databases. That is, it is the master database within an Informix instance that keeps track of all databases within that instance. Remember, though, there may be multiple Informix instances on a single host, and there is no master database of all master databases.

Backup Data

The ontape utility supports several different destination targets for your backup data: directory, stdio, tape, file, named pipe.

Types of backups:

  • Level-0: A full backup contains all used pages at the time of the backup.
  • Level-1: A level-1-backup contains all modified pages since the last level-0-backup.
  • Level-2: A level-2-backup contains all modified pages since the last level-1-backup.

Keep in mind that ontape backups can only be exchanged between the same platforms and the same IDS versions. dbexport is platform and version independent.

Backup to Directory

Backing up to directory is the recommended backup method.

Edit parameter TAPEDEV in /usr/informix/etc/onconfig and add the backup directory. Then you can perform a full backup with the command ontape -s -L 0 -d.

Backup Logs

ontape allows several methods of log backup:

  • Discarding Logs (setting LTAPEDEV to /dev/null)
  • Automatic Backup (thru the IDS alarmprogram mechanism)
  • Manual Backup (ontape -a)
  • Continuous Backup (ontape -c)

Restore

Restore from Directory

The ontape utility can be started in interactive or non-interactive mode. In non-interactive mode (option -d) ontape assumes that the backup files to be restored are available in the backup directory (onconfig parameter TAPEDEV) with their original filename. In interactive mode, ontape will ask you for the respective backup files.

Restore Data (Physical Restore)

  • non-interactive mode: ontape -p -d
  • interactive mode: ontape -p

You can now decide if you wish to perform a logical restore after the physical restore: ontape -l -d
Or you might directly switch the IDS instance to online mode without restoring any logical logs: onmode -m

dbexport

Used to backup a single database in an platform independent format (ASCII). The utility places an exclusive lock on the database during the export to guarantee consistent data.

The following command exports database stores_demo to directory /tmp. The option -ss preserves the locking mode of your tables (page or row) and also preserves the dbspace names where your tables are located.

The dbexport utility will create a sub-directory called <database>.exp in the current directory or in the directory specified through the -o option. This sub-directory contains:

  • SQL file - stores_demo.sql - that contains all necessary commands to create tables, triggers, stored procedures, grant permissions etc.
  • ASCII unload files of all tables.

An additional log file named dbexport.out will be written to the current directory.

dbimport

dbimport imports imports a database that has been exported by the dbexport utility.

*Import database stores_demo from the current directory in dbspace datadbs: dbimport stores_demo -d datadbs

dbschema

The dbschema command is used as follows:

dbschema {[-t <tabname>]
          [-s <user>]
          [-p <user>]
          -d <dbname>
          [-ss]
          [<filename>]}

The options in this command are defined as follows:

-t <tabname> is the name of the table to extract or the word <all> to generate the schema for all tables in the database.

-s <user> generates create synonym statements for <user> or <all> for all users.

-p <user> generates grant statements to grant permissions to <user> or <all> for all users.

-d <dbname> indicates the name of the database used to extract the schema files.

-ss generates server-specific syntax.

<filename> is the name of the ASCII file that receives the SQL statements generated.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.