beautypg.com

4 populating the database, 1 using sql statements – IBM Data Server DB2 User Manual

Page 246

background image

232

DB2 Deployment Guide

Target directories:

If the backup image contains restrictions to specific directories, these
directories must exist on the target system. Otherwise, performing a
redirected restore is required.

Different platforms:

Cross platform restore is not supported. You have to prepare a separate
backup image for each platform because the backup image from a Windows
system cannot be restored to a UNIX system. You also must have different
images for 32-bit and 64-bit versions of the different operation systems.

Online/Offline backup image:

If you ship an offline backup with your installation package, this backup can
be restored directly. If you ship an online backup, make sure you also ship the
required log files — otherwise the backup cannot be restored. When you take
the database backup, you can enable it to include the required log file in the
database backup image.

We recommend that restoring the backup image is handled separately from the
installation of your application. Providing some documentation about the source
database layout can help the restore process.

5.4 Populating the database

If the pre-configured database is deployed by restoring a backup image, the data
is in place after the database is restored. Populating the data is required for the
database created from scratch.

You can populate the database using the INSERT statement or by the load or
import utilities. There are other data movement tools. In this section, we focus on
the approaches that utilize the DB2 features and functions.

5.4.1 Using SQL statements

Populating data using SQL statements is usually a preferable method if the data
to be inserted is input by users or is generated on the fly. There are several
options to create the INSERT statements. A straightforward but time consuming
method is to create the INSERT statements manually and store them in a file. If
the statements are to be executed by an application, they can be created on the
fly. This is appropriate, for instance, if the statements depend on user inputs. You
also can store the data and rules in a repository and use an application to
generate a script with all the statements.