Back up and restore the database

When you use the backupDatabases and restoreDatabases toolkit tasks to back up and restore the database in your deployment, a call to the database management system is made. The toolkit tasks create and restore a full backup of the database.

Intro

  • The backupDatabases toolkit task completes a full backup of the database. The application must be stopped before you can back up the database and there must be no active connections to the database.

    • Refer to your database management system documentation to learn how to ensure that there are no connections to your database before you create the backup.

  • The toolkit task is aimed for smaller deployments where the system can be offline while the database backup is completed. If you have a larger deployment or don't want the system to be offline at all, you can back up the database manually. To back up and restore the database manually refer to the documentation for your database management system:

  • If you back up the database manually, you can still use the toolkit tasks to back up the i2 Analyze configuration and the Solr index.

  • When you back up a deployment of i2 Analyze, the database must be backed up after the Solr index. When you restore the database, you must restore the database before the Solr index.

Backup location

In the environment.properties file, the backup.db.location.dir setting is the location where the database backup are created and restored from. This location must be accessible from the database server. The user that is specified in the credentials.properties file for your database management system must have write permissions to this location.

Toolkit tasks

  • backupDatabases

    The backupDatabases toolkit task backs up the database to the backup.db.location.dir location.For example:

    setup -t backupDatabases
  • restoreDatabases

    The restoreDatabases toolkit task restores the database from a backup. You must pass the timestamp parameter to the toolkit task with a value for a backup in the backup.db.location.dir location.For example:

    setup -t restoreDatabases -p timestamp=<timestamp>

Backup files

A backup file is created in the location specified in backup.db.location.dir. The file name includes a timestamp of when the backup is created. For example:

  • On Db2: ISTORE.0.db2inst1.DBPART000.20210604144506.001

  • On SQL Server: ISTORE.20210604152638.bak

  • On PostgreSQL: ISTORE.20210604152638.dump

You can verify the backup file was correctly created by running the following commands on your database server:

  • On Db2: db2ckbkp <backup file>

  • On SQL Server:

    RESTORE VERIFYONLY FROM DISK = "<backup file>";
    GO
  • On PostgreSQL, there is no specific command for verifying a backup. Instead, you can restore the backup onto a different server. Alternatively, you can perform a quick check by using the pg_restore command to list the contents of a backup file without testing their integrity.