Performing an Initial Load

GoldenGate only refreshes cache tables in TimesTen with modified data. Thus, before starting a GoldenGate Replicat process for continuous replication, you need to perform an initial load of data to populate the cached tables in the TimesTen database with the rows from the source database tables.

The initial table data load is used to establish data synchronization when instantiating GoldenGate replication. In general, there may be a workload running against the source database tables while you do this.

To perform the initial load (and the switch for continuous replication), perform the following:

  1. Make sure that you have started the GoldenGate Extract process on the source Oracle database. It is vital that GoldenGate has started change data capture and propagation on the source database before proceeding to the next step.

  2. On the source Oracle database, determine the current SCN value. For example, run the following SQL query through SQL*Plus:

    Command>SELECT CURRENT_SCN FROM V$DATABASE;

    In this example, the SCN value returned by this query is 12345678.

  3. Connect to the TimesTen database as a suitable database user using the TimesTen ttIsql utility. This user must meet the following criteria:

    1. The user must exist in both the target TimesTen database and the source Oracle database.

    2. You must know the password for that user for both TimesTen and Oracle databases. The passwords may differ on each of the databases.

    3. In TimesTen, the user must have a minimum of the CREATE SESSION and INSERT privileges on all tables to be loaded.

    4. In the Oracle database, the user must have sufficient privileges to execute the load query.

    The following example connects to the TimesTen database with the cacheadmin user that was created earlier:

    $ ttIsql -connStr "DSN=cache1;UID=cacheadmin;PwdWallet=/wallets/cacheadminwallet"
  4. The initial table data load is used to establish data synchronization when instantiating GoldenGate replication. To achieve the best performance for the initial table data load:

    • Use the TimesTen ttLoadFromOracle built-in procedure for the initial table data load if the backend database is an Oracle database. See ttLoadFromOracle in the Oracle TimesTen In-Memory Database Reference.

    • Use the TimesTen ttBulkCp utility for the initial table data load if the backend database is a non-Oracle database. Export the table data in CSV format and then load it into TimesTen using the ttBulkCP utility. See ttBulkCp in the Oracle TimesTen In-Memory Database Reference.

    Load the data for each of the GoldenGate target tables using the TimesTen ttLoadFromOracle built-in procedure, specifying a flashback query targeting the SCN value determined in step (2) above. For example:

    Command>call ttLoadFromOracle('cacheadmin', 'cachetab1', 'SELECT * FROM 
       oratt.cachetab1 AS OF SCN 12345678');
    Command>call ttLoadFromOracle('cacheadmin', 'cachetab2', 'SELECT * FROM 
       oratt.cachetab2 AS OF SCN 12345678');
    …

Note:

If there are no dependencies (such as foreign key constraints) between tables, then you can load them in parallel using separate ttIsql sessions. Provided that resources are not a constraint, this can reduce the time required for the initial data load.

You have now populated the TimesTen cache tables with data from the source Oracle database. For more information, see Loading Data from an Oracle Database into a TimesTen Table Without Cache in the Oracle TimesTen In-Memory Database Operations Guide.