Migrating from Linux to Linux for Amazon RDS for Db2 - Amazon Relational Database Service

Migrating from Linux to Linux for Amazon RDS for Db2

With this migration approach, you back up your self-managed Db2 database to an Amazon S3 bucket. Then, you use Amazon RDS stored procedures to restore your Db2 database to an Amazon RDS for Db2 DB instance. For more information about using Amazon S3, see Integrating an Amazon RDS for Db2 DB instance with Amazon S3.

Backup and restore for RDS for Db2 follows the IBM Db2 supported upgrade paths and restrictions. For more information, see Supported upgrade paths for Db2 servers and Upgrade restrictions for Db2 servers in the IBM Db2 documentation.

Limitations and recommendations for using native restore

The following limitations and recommendations apply to using native restore:

  • Amazon RDS only supports migrating on-premises versions of Db2 that match supported RDS for Db2 versions. For more information about the supported versions, see Supported Db2 minor versions on Amazon RDS.

  • Amazon RDS only supports offline and online backups for native restore. Amazon RDS doesn't support incremental or Delta backups.

  • You can't restore from an Amazon S3 bucket in an AWS Region that is different from the Region where your RDS for Db2 DB instance is located.

  • You can't restore a database if your RDS for Db2 DB instance already contains a database.

  • Amazon S3 limits the size of files that are uploaded to an Amazon S3 bucket to 5 TB. If your database backup file exceeds 5 TB, then split the backup file into smaller files.

  • Amazon RDS doesn't support non-fenced external routines, incremental restores, or Delta restores.

  • You can't restore from an encrypted source database, but you can restore to an encrypted Amazon RDS DB instance.

When you restore your database, the backup is copied and then extracted on your RDS for Db2 DB instance. We recommend that you provision storage space for your RDS for Db2 DB instance that is equal to or greater than the sum of the backup size plus the original database's size on disk.

The maximum size of the restored database is the maximum database size that is supported minus the size of the backup. For example, if the maximum database size that is supported is 64 TiB and the size of the backup is 30 TiB, then the maximum size of the restored database is 34 TiB.

64 TiB - 30 TiB = 34 TiB

Backing up your database to Amazon S3

To back up your database on Amazon S3, you need the following AWS components:

  • An Amazon S3 bucket to store your backup files: Upload any backup files that you want to migrate to Amazon RDS. We recommend that you use offline backups for migrations that can handle downtime. If you already have an S3 bucket, you can use that bucket. If you don't have an S3 bucket, see Creating a bucket in the Amazon S3 User Guide.

    Note

    If your database is large and would take a long time to transfer to an S3 bucket, you can order an AWS Snow Family device and ask AWS to perform the backup. After you copy your files to the device and return it to the Snow Family team, the team transfers your backed-up images to your S3 bucket. For more information, see the AWS Snow Family documentation.

  • An IAM role to access the S3 bucket: If you already have an IAM role, you can use that role. If you don't have a role, see Step 2: Create an IAM role and attach your IAM policy.

  • An IAM policy with trust relationships and permissions attached to your IAM role: For more information, see Step 1: Create an IAM policy.

  • The IAM role added to your RDS for Db2 DB instance: For more information, see Step 3: Add your IAM role to your RDS for Db2 DB instance.

Creating a default automatic storage group

Your source database must have a default automatic storage group. If your database doesn't have a default automatic storage group, you must create one.

To create a default automatic storage group
  1. Connect to your source database. In the following example, replace source_database with the name of your database.

    db2 connect to source_database
  2. Create an automatic storage group and set it as the default. In the following example, replace storage_path with the absolute path to where the storage group is located.

    db2 "create stogroup IBMSTOGROUP ON storage_path set as default"
  3. Terminate backend processes.

    db2 terminate
  4. Deactivate the database and stop all database services. In the following example, replace source_database with the name of the database that you created the storage group for.

    db2 deactivate db source_database
  5. Back up the database. In the following example, replace source_database with the name of the database that you created the storage group for. Replace file_system_path with the absolute path to where you want to back up the database.

    db2 backup database source_database to file_system_path

Restoring your Db2 database

After you back up your database on Amazon S3 and create an automatic storage group, you are ready to restore your Db2 database to your RDS for Db2 DB instance.

To restore your Db2 database to your RDS for Db2 DB instance
  1. Connect to your RDS for Db2 DB instance. For more information, see Connecting to your Amazon RDS for Db2 DB instance.

  2. (Optional) To make sure your database is configured with the optimal settings for the restore operation, you can call rdsadmin.show_configuration to check the values for RESTORE_DATABASE_PARALLELISM and RESTORE_DATABASE_NUM_BUFFERS. Call rdsadmin.set_configuration to change these values, as needed. Explicitly setting these values can improve the performance when restoring databases with large volumes of data.

  3. Restore your database by calling rdsadmin.restore_database. For more information, see rdsadmin.restore_database.