Examples: Manage storage devices with Informix® Primary Storage Manager

Learn how to set up and use Informix® Primary Storage Manager to manage storage devices that the onbar utility uses for backing up and restoring instances. Each example shows how you can use the storage manager for a specific backup strategy.

Before you begin

Prerequisites:

  • Informix® 14.10 is installed with the ON-Bar utility.
  • Environment variable INFORMIXDIR is set to the path where the database server is installed.
  • Environment variable ONCONFIG is set to the file in $INFORMIXDIR/etc that contains the configuration parameters for your database. The name of the file must be unique for each database server instance.
  • User informix or root privileges.

About this task

In these examples, storage manager refers to Informix® Primary Storage Manager.

Example 1: Storing backups for an instance

This example shows how to set up and use Informix® Primary Storage Manager to back up the data and logical logs for a single database server instance to a directory: $INFORMIXDIR/backups.

About this task

In this example, you update the configuration file so that the Informix® Primary Storage Manager can communicate with ON-Bar and you specify the directory where you want backups stored. Then you use the onbar utility to perform a standard, level-0 backup of all online storage spaces and used logical logs. You validate the backup by checking the messages that were logged and by using the onpsm utility to confirm that storage objects were created.

Procedure

  1. Set the BAR_BSALIB_PATH configuration parameter to the full path and name of the shared library for the storage manager.

    For example, on Linux, Solaris:

    BAR_BSALIB_PATH	$INFORMIXDIR/lib/libbsapsm.so

    You must use the version of the XBSA shared library that is provided for Informix® Primary Storage Manager. If you do not specify the path with the BAR_BSALIB_PATH configuration parameter, you must ensure that the XBSA library is in the default location on your operating system.

  2. If needed, create the directory in which to store the backup objects.

    By default, the storage manger includes the default pools LOGPOOL and DBSPOOL, with the default directory $INFORMIXDIR/backups in each pool.

    • If you want to use the default backup directory, verify that the $INFORMIXDIR/backups directory exists.
    • If you want to use a different backup directory, use the onpsm -D add command to add a new backup directory for LOGPOOL and DBSPOOL. For example, run the following commands to add different backup directories for the LOGPOOL and DBSPOOL pools:
      onpsm -D add /backups/infx/logs -g LOGPOOL -p HIGHEST -t FILE
      onpsm -D add /backups/infx/spaces -g DBSPOOL -p HIGHEST -t FILE

      Use the HIGHEST priority for the device that should be filled first. Only one device in a pool can have the priority setting of HIGHEST.

  3. Run the onbar utility to perform a standard, level-0 backup of all online storage spaces and used logical logs.
    onbar -b -L 0
    If the storage catalog tables do not exist, they are created in the $INFORMIXDIR/etc/psm directory.
  4. Validate that the storage manager is set up and that the backup objects are created.
    1. Look in the ON-Bar activity log to confirm that the storage manager is ready and that ON-Bar recognizes the storage manager.

      For example, the first message is from the storage manager and the second message is from the backup utility:

      2012-01-03 15:51:23 11193  2569 Informix PSM is ready.
      2012-01-03 15:51:23 11193  2569 Using Informix PSM version 14.10.FC1 
      as the Storage Manager. XBSA API version is 1.0.3.
      By default, the storage manager posts messages to the ON-Bar activity log. The location of the activity log is set by the BAR_ACT_LOG configuration parameter. If you want the storage manager messages to be logged separately, you must set the PSM_ACT_LOG configuration parameter.
    2. Run the onpsm -O list command to list the storage objects that were created:

      The list, as shown in the following example, includes the storage object IDs, the date the storage objects were created, the size of the storage objects, and where the storage objects are in the storage device. The object IDs are also stored in the ixbar file and are used by ON-Bar to locate the objects.

      ============================
      Object List Report
      
                                              Logical Path
      Obj ID  Date Created        Size (MB)    Name.Version (omits piece #)
      -------
           1  2012-08-06 12:02:10      12.5  /serv1/rootdbs/0/serv1.1
           2  2012-08-06 12:02:12       0.1  /serv1/logdbs/0/serv1.1
           3  2012-08-06 12:02:12       0.1  /serv1/dbs2/0/serv1.1
           4  2012-08-06 12:02:12       0.1  /serv1/dbs1/0/serv1.1
           5  2012-08-06 12:02:13       0.1  /serv1/physdbs/0/serv1.1
           6  2012-08-06 12:02:14       0.3  /serv1/10/9/serv1.1
           7  2012-08-06 12:02:14       0.0  /serv1/crit_files/ixbar/serv1.1
           8  2012-08-06 12:02:14       0.0  /serv1/crit_files/oncfg/serv1.1
           9  2012-08-06 12:02:14       0.1  /serv1/crit_files/onconfig/serv1.1
          10  2012-08-06 12:02:14       0.0  /serv1/crit_files/sqlhosts/serv1.1
      ============================
    3. Run the onpsm -D list command to display a list that shows that the device was added to the DBSPOOL and LOGPOOL pools. The following example shows output of the command:
      Type  Prio     Block/Size (MB)  Pool Name   Device Name---
      FILE   HIGHEST       --/--         DBSPOOL     /backups/infx/logs
      
      FILE   HIGHEST       --/--         LOGPOOL     /backups/infx/spaces
      

Results

With a few simple steps, you configured the storage manager and performed a full backup of an instance to a file device. Very little configuration was required because the storage manager uses the default settings for various ON-Bar configuration parameters.

What to do next

Storage catalog tables are not included in a backup. Be sure to back up the storage catalog tables with your operating system tools as part of a disaster recovery strategy. If the storage catalog tables are lost, the onbar utility cannot restore the backup objects that Informix® Primary Storage Manager created. The location of the storage catalog tables is set by the PSM_CATALOG_PATH configuration parameter (default = $INFORMIXDIR/etc/psm).

To restore the instance from the backup objects, use the onbar utility. The storage manager tracks the backup objects and storage devices for you.

Example 2: Storing backups for two instances

This example shows how to configure one instance of Informix® Primary Storage Manager to manage the storage devices for two database server instances in a multiple residency environment.

About this task

In this example, you set up two independent database server environments on the same computer. Each database server is installed in a separate directory: (/usr/informix/ids1210fc1 and /usr/informix/ids1210fc1b) and has a database server instance. Storage for backup operations on both database server instances is managed by one instance of Informix® Primary Storage Manager. Pools of storage devices for physical and logical data are configured for each instance.

Procedure

  1. For each instance, edit the onconfig file to configure storage management for ON-Bar.
    Table 1. Configuration parameters and their associated values

    This table lists the configuration parameters that you must set and the values to specify for each parameter.

    Configuration parameter Value
    BAR_BSALIB_PATH
    Specify the full path and name of the shared library for the storage manager.
    /usr/informix/ids1210fc1b/lib/libbsapsm.so
    PSM_CATALOG_PATH
    Specify the path of the storage catalog tables.
    /usr/informix/ids1210fc1b/etc/psm
    PSM_DBS_POOL
    Specify the name for a group of devices for storing online data (dbspace) backups.

    FC1: DBSPOOL_FC1

    FC1B: DBSPOOL_FC1B

    PSM_LOG_POOL
    Specify the name for a group of devices for storing online logical log backups.

    FC1: LOGPOOL_FC1

    FC1B: LOGPOOL_FC1B

  2. For each instance, create a directory in which to store the backup objects.
    mkdir $INFORMIXDIR/backups/dev_for_1201fc1
    mkdir $INFORMIXDIR/backups/dev_for_1201fc1b
  3. Run the onpsm utility to create device pools for each instance. For example, specify:
    onpsm -P add DBSPOOL_FC1
    onpsm -P add LOGPOOL_FC1
    onpsm -P add DBSPOOL_FC1B
    onpsm -P add LOGPOOL_FC1B
  4. Run the onpsm utility to add the storage devices.
    onpsm -D add $INFORMIXDIR/backups/dev_for_1201fc1 -t FILE -g DBSPOOL_FC1 
    onpsm -D add $INFORMIXDIR/backups/dev_for_1201fc1 -t FILE -g LOGPOOL_FC1 
    onpsm -D add $INFORMIXDIR/backups/dev_for_1201fc1b -t FILE -g DBSPOOL_FC1B 
    onpsm -D add $INFORMIXDIR/backups/dev_for_1201fc1b -t FILE -g LOGPOOL_FC1B
  5. For each instance, run the onbar utility to perform a standard, level-0 backup of all online storage spaces and used logical logs.
    onbar -b -L 0
  6. Validate that the storage manager is set up and that the backup objects are created.
    1. For each instance, look in the ON-Bar activity log to confirm that the storage manager is ready and that ON-Bar recognizes the storage manager. For example, look for this information:
      2012-01-03 15:51:23 11193  2569 Informix PSM is ready.
      2012-01-03 15:51:23 11193  2569 Using Informix PSM version 14.10.FC1 
      as the Storage Manager. XBSA API version is 1.0.3.
    2. Use the onpsm utility to list the storage objects that were created:
      onpsm -O list

      The report includes the storage object IDs, the date the storage objects were created, the size of the storage objects, and the location of the storage objects in the storage device.

Example 3: Exporting backups to and restoring them from another directory

This example shows how to export backups to a new directory and import the backup objects from that directory.

About this task

Suppose that you keep five generations of backups. As an added precaution, you also keep copies of the most recent backups in a separate directory. In this example, you use the onsmsync utility to export your most recent backup to and import it from the Informix® Primary Storage Manager external pool in a separate directory.

The storage manager tracks devices in the external device pool (EXTPOOL) so it can copy objects to and from external devices. (Although the storage manager tracks devices, it does not track files and objects that are inside the EXTPOOL pool in the storage manager catalogs.)

Procedure

  1. Store backups for an instance, following the steps in Example 1: Storing backups for an instance.
  2. Run the onpsm -D list command to check that there is a device in the EXTPOOL pool.
    1. If there is no device in the EXTPOOL pool, add one using the onpsm -D add command.

      The following example shows how to add a device with the path /export/informix/psm_exportdir to the EXTPOOL pool.

      $ onpsm -D add /export/informix/psm_exportdir -g EXTPOOL -t FILE
  3. Run the onsmsync command to export all backup objects in the generation 1 level-0 backup, using prefix pw_sept5, which becomes the name of the subdirectory in which the utility places the backup:
    onsmsync -E -p pw_sept5 -g 1
    After you run the onsmsync -E command to export the backup objects, you will see a subdirectory in the EXTPOOL directory that includes a directory holding the backup objects and a file called export.bom.

What to do next

Suppose that something happens to the backup generation stored in your primary backup directory and you want to import the pw_sept5 backup generation from the second directory. To import the backup generation:
  1. Run the onsmsync command to import all backup objects in the pw_sept5 subdirectory:
    onsmsync -I -p pw_sept5

Use your own file-transfer methods to move the exported backups, as needed, to other machines.

Example 4: Exporting a backup from one server and importing it into another server

This example shows how to use the onsmsync utility to export a backup from a database server that has the name informix_serv1. Then the example shows how to use the onsmsync utility to import the data into a server that has the name informix_serv2.

Procedure

  1. Set up and export files on database server informix_serv1:
    1. Set the INFORMIXDIR, INFORMIXSERVER, ONCONFIG, PATH, INFORMIXSQLHOSTS environment variables for informix_serv1.
    2. Run the onpsm -D list command to check that there is a device in the EXTPOOL pool. If there is no device in the EXTPOOL pool, add one using the onpsm -D add command.
    3. Run the onsmsync command to export all backup objects in the generation 1 level-0 backup, using prefix serv1_20120810, which becomes the name of the subdirectory in which the utility places the backup:
      $ onsmsync -E -p serv1_20120810 -g 1
  2. Prepare to import files on the second database server, informix_serv2, as follows:
    1. Set the INFORMIXDIR, INFORMIXSERVER, ONCONFIG, PATH, INFORMIXSQLHOSTS environment variables for informix_serv2.
    2. Run the onpsm -D list command to determine if the EXTPOOL has the same device that you viewed or added in step 1b. (This could occur for shared devices). If there is no device in the EXTPOOL pool, add one using the onpsm -D add command.
    3. Copy the previously exported backup objects (for example, subdirectory serv1_20120810) into the EXTPOOL device from which you will import the backup objects.
    4. Run the following command to import backup objects from EXTPOOL device:
      $ onsmsync -I -p serv1_20120810
      After you run the onsmsync -I command to import the backup objects, the objects are stored in the new LOGPOOL and DBSPOOL pools.
    5. Run the onpsm -O list command to view the imported objects.
      Notice that the import command also creates a new ixbar file in $INFORMIXDIR/etc/ directory.
      $ ls -l $INFORMIXDIR/etc/*ixbar*
      
      -rw-rw-- 1 informix informix     0 Aug 10 19:44 
       /usr/informix/etc/ixbar.12.20120810.194441
      -rw-rw-- 1 informix informix  2704 Aug 10 19:44 
       /usr/informix/etc/ixbar.12

      The new ixbar file lists the imported backup objects so that you can perform an ON-BAR cold restore to restore the informix_serv1 instance from the first database server to the informix_serv2 instance on the second database server.