Zero Downtime Installation Guide for IBM DB2

Zero Downtime Installation Guide for IBM DB2

Prepare the IBM DB2 Databases

Prepare the IBM DB2 Databases

Back up the IBM DB2 source database that contains the MDM Hub Store. Then copy and restore the backup on the target database. When you are finished, the target database has the same tablespaces as the source database.
  1. On the source system, navigate to the following directory:
    <MDM installation directory>/hub/server/database/stored_procs/db2/zdt/samples/SOURCE
  2. Open the
    0_PREPARE_DB_FOR_REPLICATION.db2
    stored procedure in an editor. Replace the example values with values for your source database, and save the file.
  3. Run the stored procedure.
    C:/> db2 -tvf 0_PREPARE_DB_FOR_REPLICATION.db2
    The stored procedure turns off transaction mode, sets the directory for log files, and creates a backup of the database.
  4. Copy the backup file to a directory on the target system. Make a note of the timestamp in the file name.
    For example, given a backup name of SRCDB.0.DB2.NODE0000.CATN0000.20150917213129.001, use 20150917213129 as the backup timestamp.
  5. On the target system, navigate to the directory that contains the saved backup.
  6. Restore the source database into the target database and create a generic restore script. In the following command, substitute the names of the databases as necessary and specify the timestamp of the backup:
    D:\zdt\BACKUPS\SRCDB> db2 "RESTORE DB
    srcdb
    TAKEN AT
    backup timestamp
    INTO
    tgtdb
    REDIRECT GENERATE SCRIPT restore_2tgtdb.db2"
  7. Open the generic restore script
    restore_2tgtdb.db2
    in an editor. Specify a directory path on the target system for the log files and data files.
    • LOGTARGET 'D:/db2data/tgtdb/logs'
    • NEWLOGPATH 'D:/db2data/tgtdb/LOGS'
    • For each tablespace:
      FILE 'D:/db2data/tgtdb/<
      tablespace name
      >/<
      dat file name
      >.dat
  8. Save the file.
  9. Drop the target database.
    D:\> db2 drop db
    tgtdb
  10. Restore the target database.
    D:\zdt\BACKUPS\SRCDB> db2 -tvf restore_2tgtdb.db2
    The restore process creates all the tablespaces in the specified directory.

0 COMMENTS

We’d like to hear from you!