Migrating a Database

You can migrate your database from one major release of TimesTen Classic (such as 18.1) to another major release of TimesTen Classic (such as 22.1). You run the ttMigrate utility to achieve this. ttMigrate saves database objects in a binary file and upgrades or downgrades database objects by restoring the objects from the binary file into the target database.

The binary files are platform-dependent. For example, a binary file produced on Linux must be restored on Linux. However, you can use the ttMigrateCS utility to copy a database between platforms (for example, between Linux and UNIX).

For more information, see ttMigrate in the Oracle TimesTen In-Memory Database Reference.

Note:

This section discusses the migration of databases in TimesTen Classic. For information on migrating databases from TimesTen Classic to TimesTen Scaleout and on migrating databases in TimesTen Scaleout, see Migrating, Backing Up and Restoring Data in the Oracle TimesTen In-Memory Database Scaleout User's Guide.

Examples using ttMigrate include:

Moving to a Different Major Release of TimesTen Classic

In TimesTen Classic, you can migrate data between major releases (for example, from TimesTen 18.1 to 22.1 ) by using the ttMigrate utility to export the data from the old release and import it to the new release.

Prerequisites before migrating a database from one major release to another:

Follow these steps:

  1. On the old release, disconnect all applications from your database.
  2. Save a copy of your database with the ttMigrate utility.
    % ttMigrate -c database1 /tmp/database1.data
    ...
    

    For more information about the ttMigrate utility, see ttMigrate in the Oracle TimesTen In-Memory Database Reference.

  3. In the old release, unload the database from memory. See Unload the Database from Memory for details.
  4. In the old release, if necessary, use the ttDestroy utility to destroy the old database. This step is required if the new database will be in the same location as the old database.
  5. Copy the migrate object files to a file system that is accessible by the instance in the new release.
  6. From the instance of the new release, create a database. Ensure that you have modified the connection attributes in the sys.odbc.ini (or odbc.ini) file and that you have sourced the environment variables and started the daemon.

    To create the database:

    % ttIsql -connstr "dsn=new_database1;AutoCreate=1" -e "quit"
    

    The database will be empty at this point.

  7. From the instance of the new release, use ttMigrate with the -r and -relaxedUpgrade options to restore the backed up database to the new release. For example:
    % ttMigrate -r -relaxedUpgrade new_database1 /tmp/database1.data
    

Once the database is operational in the new release, create a backup of this database to have a valid restoration point for your database. Once you have created a backup of your database, you may delete the ttMigrate copy of your database (in this example, /tmp/database1.data). You can also delete the instance and installation from the old release.

Ensure you recompile and relink existing ODBC applications after you perform the upgrade and before you use the new release of TimesTen. See Overview of ODBC API Incompatibilities in the Oracle TimesTen In-Memory Database C Developer's Guide for more information.

Moving a Database to a Different Platform

The internal format of a database differs between platforms. You can use this procedure to move a database from one platform to another, such as from AIX to Linux, and reformat it for the target platform.

  1. Disconnect applications from the database.
  2. From the target system, use ttMigrateCS to connect in client/server mode to the database on the originating system and use the -c option to create a data file for the database on the target system. For example:
    ttMigrateCS -c database1 database1data.dat
    ...
    
  3. On the target system, create a DSN for the database. See Creating a DSN on Linux and UNIX for TimesTen Classic in the Oracle TimesTen In-Memory Database Operations Guide for information.
  4. Confirm that all connection attributes, including the DataStore connection attribute, are set correctly for the location on the new system.
  5. Recreate the database using AutoCreate=1, such as in the following example:
    ttIsql -connstr "dsn=database2;AutoCreate=1" -e "quit"
    

    The database will be empty at this point.

  6. On the target system, import the file created by ttMigrateCS into the new database using the ttMigrate utility with the -r option and the -relaxedUpgrade option. For example:
    ttMigrate -r -relaxedUpgrade database2 database1data.dat
    
  7. As desired, once the database is operational on the new system, use the ttDestroy utility to destroy the database on the old system, and delete the old DSN.