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
- Example 1: Storing backups for an instance
- Example 2: Storing backups for two instances
- Example 3: Exporting backups to and restoring them from another directory
- Example 4: Exporting a backup from one server and importing it into another server
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
- 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.
- 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.
- 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. - Validate that the storage manager is set up and that the
backup objects are created.
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
- 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
- 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
- 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
- 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
- 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
- Validate that the storage manager is set up and that the
backup objects are created.
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
- Store backups for an instance, following the steps in Example 1: Storing backups for an instance.
- Run the onpsm -D list command to check
that there is a device in the EXTPOOL pool.
- 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
pw_sept5
backup
generation from the second directory. To import the backup generation:- 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
- Set up and export files on database server
informix_serv1
: - Prepare to import files on the second database server,
informix_serv2
, as follows: