Duplicate a Database

Use this form of ttRepAdmin to create a new database with the same contents as the master database.

The following must be true for you to perform the ttRepAdmin -duplicate:

  • Only the instance administrator can run ttRepAdmin -duplicate.

  • The instance administrator must have the same operating system username on both source and target computer to run ttRepAdmin -duplicate.

  • You must provide the user name and password with the -UID and -PWD options for an internal user with the ADMIN privilege on the source database.

  • You must run ttRepAdmin on the target host.

  • The DSN specified must be a direct-mode DSN, not a server DSN.

Before running the ttRepAdmin -duplicate command, use ttStatus to ensure the replication agent is started for the source database.

ttRepAdmin -duplicate -from srcDataStoreName
       -host srcDataStoreHost
      [-localIP localIPAddress] [-remoteIP remoteIPAddress]
      [-setMasterRepStart | -noSetMasterRepStart] [-ramLoad] [-delXla]
      -UID userId (-PWD pwd | -PWDCrypt encryptedPwd)
      [-drop { [owner.]table ... | [owner.]sequence |ALL }]
      [-truncate { [owner.]table ... | ALL }]
      [-compression 0 | 1] [-bandwidthmax maxKbytesPerSec]
      [ ( -activeDataGuard [-cacheUid cacheUid [-cachePwd cachePwd]]
         | -initCacheDr [-cacheUid cacheUid [-cachePwd cachePwd]] 
                [-noDRTruncate] [-nThreads]
         | ( -keepCG [-cacheUid cacheUid [-cachePwd cachePwd]] 
             ( [-recoveringNode | -deferCacheUpdate] ))| -nokeepCG  ) ]
      [-remoteDaemonPort portNo] [-verbosity {0|1|2}]
      [-localhost localHostName]
      [-open | -close]
      {destDSN | -connStr connection_string}

Options

ttRepAdmin -duplicate has the options:

Option Description

-close

Closes a database to user connections.

When a database is closed to user connections, new connection attempts will fail, but existing connections are unaffected.

-bandwidthmax maxKbytesPerSec

Specifies that the duplicate operation should not put more than maxKbytesPerSec KB of data per second onto the network. A value of 0 indicates that there should be no bandwidth limitation. The default is 0. The maximum is 9999999.

-compression 0 | 1

Enables or disables compression during the duplicate operation. The default is 0 (disabled).

-connStr connection_string

Specifies the connection string of the destination database, an ODBC connection string that specifies a database location, driver, and optionally other connection attribute settings.

-delXla

Removes all the XLA bookmarks as part of the duplicate operation. Use this option if you do not want to copy the bookmarks to the duplicate database.

destDSN

Indicates the data source name of the destination database.

-drop {[owner.]table ... |[owner.]sequence |ALL

Drops any tables or sequences that are copied as part of the -duplicate operation but which are not included in the replication scheme. ttRepAdmin ignores the option if the table is a cache group table.

-duplicate

Creates a duplicate of the specified database using replication to transmit the database contents across the network. See Duplicating a Database in Oracle TimesTen In-Memory Database Replication Guide.

-from srcDataStoreName

Used with -duplicate to specify the name of the sender (or master) database. The srcDataStoreName is the last component in the database path name.

-host srcDataStoreHost

Defines the host name or TCP/IP address of the sender (or master) database.

-initCacheDr [-cacheUid cacheUid -cachePwd cachePwd]

Initializes disaster recovery. Must provide the cache admin user id and password.

  • cacheUid is the cache administration user ID.

  • cachePwd is the password for the cache administrator user.

If no password is provided, ttRepAdmin prompts for a password.

( -keepCG [-cacheUid cacheUid -cachePwd cachePwd] ([-recoveringNode | -deferCacheUpdate])) | -noKeepCG

-keepCG and -noKeepCG specify whether tables in cache groups should be maintained as cache group tables or converted to regular tables in the target database. The default is -noKeepCG.

  • cacheUid is the cache administration user ID.

  • cachePwd is the password for the cache administrator user.

If no password is provided, ttRepAdmin prompts for a password.

If you cannot connect to the Oracle database or the Oracle database is down, then specify the -recoveringNode option when the -duplicate is being used to recover a failed node for a replication scheme that includes all AWT or incremental autorefresh cache groups. Otherwise, specify the -deferCacheUpdate option. These options defer changes to metadata on the Oracle database (that is used to manage AWT or incremental autorefresh cache groups) until after the duplicate operation completes, the cache and replication agents are started, and these agents can connect to the Oracle database. See Duplicating a Database in Oracle TimesTen In-Memory Database Replication Guide for more information.

-localhost hostName

Use with -duplicate and -setMasterRepStart to explicitly identify the name or IP address of the local host.

-localIP localIPAddress

Specifies the alias or IP (IPv4 or IPv6) address of the local network interface to be used. If not specified, ttRepAdmin chooses any compatible interface.

-noDRTruncate

Used with the -initCacheDr option, -noDRTruncate disables truncation of Oracle tables during the initial rollout process for the remote subscriber on the Disaster Recovery site. When –noDRTruncate is specified, TimesTen does not truncate the Oracle Database tables that correspond to the Asynchronous Writethrough cache group tables in an active standby pair replication scheme.

-nThreads n

Used with the -initCacheDr option, -nThreads indicates the number of threads used to truncate the Oracle database tables and push the data in the cache into Oracle during the initialization process.

-open

Opens a database to user connections.

A database is open to user connections by default upon creation.

-PWD pwd

The password of the internal user specified in the -UID option.

-PWDCrypt encryptedPwd

The encrypted password of the user specified in the -UID option.

-ramLoad

Keeps the database in memory upon completion of the duplicate operation. This option avoids the /reload database cycle to improve the performance of the duplicate operation when copying large databases. After the duplicate option, RAM Policy for the database is set to manual. Use the ttAdmin utility to make further changes to the RAM policy.

-remoteDaemonPort portNo

The port number of the remote main daemon.

The port number supplied as an argument to this option is used unless the value is zero. In that case the default behavior to determine the port number is used.

The -remoteDaemonPort option cannot be used to duplicate databases that have stores which use automatic port configuration.

-remoteIP remoteIPAddress

Specifies the alias or IP (IPv4 or IPv6) address of the remote or destination network interface to be used. If not specified, ttRepAdmin chooses any compatible interface.

-setMasterRepStart

This is on by default.

When -duplicate option is set, the replication state for the newly created database is set to the start state just before the database is copied across the network. This ensures that all changes made to the source database after the duplicate operation starts are replicated to the newly duplicated target database. Any unnecessary transaction log files for the database are removed.

Set the -noSetMasterRepStart option if you do not want this behavior.

-noSetMasterRepStart

Used with the -duplicate option. The replication state for the target database is not modified during the duplicate operation. Thus, if the state of the target database is set to stopped, or failed, then any changes made to the source database after the duplicate operation starts are not replicated to the newly duplicated target database.

-truncate [owner.]table ...| ALL

Truncates any tables that are copied as part of the -duplicate operation but which are not included in the replication scheme. ttRepAdmin ignores the option if the table is a cache group table.

-UID userid

The user ID of a user having the ADMIN privilege on the source database must be supplied. This must be an internal user.

-verbosity {0 | 1 | 2}

Provide details of the communication steps within the duplicate process and reports progress information about the duplicate transfer.

0 (default) - No diagnostics are returned.

1 - Reports details of the duplicate parameters to stdout.

2 - Reports details of the duplicate parameters and details of the duplicate transfer operation to stdout.

Examples

Duplicating a Database

On the source database, create a user and grant the ADMIN privilege to the user:

CREATE USER sampleuser IDENTIFIED BY sampleuser;
User created.

GRANT admin TO sampleuser;

The instance administrator must have the same user name on both instances involved in the duplication. Logged in as the instance administrator, duplicate the ds1 database on server1 to the ds2 database:

% ttRepAdmin -duplicate -from ds1 -host "server1" 
           -UID sampleuser -PWD sampleuser
           -connStr "dsn=ds2;UID=sampleuser;PWD=sampleuser" 

Duplicating a Database with Cache Groups

Use the -keepCG option to keep cache group tables when you duplicate a database. Specify the cache administration user ID and password with the -cacheuid and -cachepwd options. If you do not provide the cache administration user password, ttRepAdmin prompts for a password.

If the cache administration user ID is orauser and the password is orapwd, duplicate database dsn1 on host1:

% ttRepAdmin -duplicate -from dsn1 -host host1 -uid sampleuser -pwd sampleuser 
        -keepCG -cacheuid orauser -cacheuid orapwd "DSN=dsn2;UID=;PWD="

The UID and PWD for dsn2 are specified as null values in the connection string so that the connection is made as the current operating system user, which is the instance administrator. Only the instance administrator can run ttRepAdmin -duplicate. If dsn2 is configured with PWDCrypt instead of PWD, then the connection string should be "DSN=dsn2;UID=;PWDCrypt=".

Setting the Replication State on the Source Database

The -setMasterRepStart option causes the replication state in the srcDataStoreName database to be set to the Start state before it is copied across the network and then keeps the database in memory. It ensures that any updates made to the master after the duplicate operation has started are copied to the subscriber.

You can use the -localhost option to identify the local host by host name or IP address. These options ensure that all updates made after the duplicate operation are replicated from the remote database to the newly created or restored local database.

ttRepAdmin -duplicate -from srcDataStoreName -host srcDataStoreHost
        -setMasterRepStart -ramLoad
        -UID timesten_user -PWD timesten_user]
        -localhost localHostName 
        [destDSN | -connStr connection_string ]

Notes

This utility can duplicate any temporary table definition in a database, but it does not replicate the contents of temporary tables.

You cannot use this utility to duplicate databases across major releases of TimesTen.