ttRepAdmin

Displays existing replication definitions and monitors replication status. The ttRepAdmin utility is also used when upgrading to a new release of TimesTen.

Required Privilege

This utility requires the ADMIN privilege.

Usage in TimesTen Scaleout and TimesTen Classic

This utility is supported in TimesTen Classic but not supported in TimesTen Scaleout.

Syntax

ttRepAdmin {-h | -help | -?}
ttRepadmin {-V | -version}
ttRepAdmin -self -list [-scheme [owner.]schemeName]
       {DSN | -connStr connection_string}

ttRepAdmin -receiver [-name receiverName]
      [-host receiverHostName] [-state receiverState] [-reset]
      [-list] [-scheme [owner.]schemeName]
      {DSN | -connStr connection_string} 

ttRepAdmin -log {DSN | -connStr connection_string}

ttRepAdmin -showstatus -detail {-awtmoninfo} {DSN | -connStr connection_string}

ttRepAdmin -showconfig {DSN | -connStr connection_string}

ttRepAdmin -bookmark {DSN | -connStr connection_string}

ttRepAdmin -wait [-name receiverName] [-host receiverHostName] 
      [-timeout seconds] {DSN | -connStr connection_string}

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}

ttRepAdmin Operations

Use the ttRepAdmin utility for many replication operations. These operations fall into the following categories:

Help and Version Information

Use this form of ttRepAdmin to obtain help and the current version of TimesTen.

ttRepAdmin {-h | -help | -?}
ttRepadmin {-V | -version}
Option Description

-h

-help

-?

Display help information.

-V | -version

Display TimesTen version information.

Database Information

Use this form of ttRepAdmin to obtain summary information about a database.

ttRepAdmin -self -list [-scheme [owner.]schemeName]
{DSN | -connStr connection_string}

Options

ttRepAdmin has the options:

Option Description

DSN

Data source name of a master or subscriber database.

-connStr connection_string

Connection string of a master or subscriber database, an ODBC connection string that specifies a database location, driver, and optionally other connection attribute settings.

-self

Specified database.

-list

Lists database name, host, port number, and bookmark position.

-scheme [owner.]schemeName]

Name of replication scheme when there is more than one scheme.

Examples

% ttRepAdmin -self -list my_dsn

The above syntax prints out information about the replication definition of the database my_dsn.

Subscriber Database Operations

Use this form of ttRepAdmin to check the status or reset the state of a subscriber (receiver) database.

ttRepAdmin -receiver [-name receiverName]
[-host receiverHostName] 
       [-state receiverState] [-reset]
       [-list] [-scheme [owner.]schemeName]
       {DSN | -connStr connection_string}

Options

ttRepAdmin -receiver has the options:

Option Description

DSN

Data source name of the master database.

-connStr connection_string

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

-receiver

Subscriber databases receiving updates from the master. Use -name and -host to specify a specific subscriber database.

-name receiverName

A specific subscriber (receiving) database. The receiverName is the last component in the database path name.

-host receiverHostName

Host name or TCP/IP address of the subscriber host.

-state start

-state stop

-state pause

Sets the state of replication for the subscriber.

start (default) - Starts replication to the subscriber.

stop - Stops replication to the subscriber, discarding updates.

pause - Pauses the replication agent, preserving updates.

See Set the Replication State of Subscribers in Oracle TimesTen In-Memory Database Replication Guide for more information.

-reset

Clears the bookmark in the master database log for the latest transaction to be sent to a given subscriber. This option should only be used when the transaction numbering of the master database is changed, such as when the database is re-created using ttMigrate or ttBackup. If the master database is saved and restored using ttBackup and ttRestore, transaction numbering is preserved and this option should not be used.

-list

Lists information about a replication definition.

-scheme [owner.]schemeName]

Specifies the replication scheme name when there is more than one scheme.

Examples

% ttRepAdmin -receiver -list my_dsn

The above syntax lists replication information for all the subscribers of the master database, my_dsn.

% ttRepAdmin -receiver -name rep_dsn -list my_dsn

The above syntax lists replication information for the rep_dsn subscriber of the master database, my_dsn.

% ttRepAdmin -receiver -name rep_dsn -reset my_dsn

The above syntax resets the replication bookmark with respect to the rep_dsn subscriber of the master database. Should only be used when migrating a replicated database with ttMigrate or ttBulkCp.

% ttRepAdmin -receiver -name rep_dsn -state Start my_dsn

The above syntax resets the replication state of the rep_dsn subscriber database to the Start state with respect to the master database, my_dsn.

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.

Wait for Updates to Complete

Use this form of ttRepAdmin to assure that all the updates in the log are replicated to all subscribers before call returns.

ttRepAdmin -wait [-name receiverName] [-host receiverHostName]
[-timeout seconds] {DSN | -connStr connection_string} 

Options

ttRepAdmin -wait has the options:

Option Description

DSN

Indicates the data source name of the master database.

-connStr connection_string

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

-wait

Waits for replication to become current before continuing.

-name receiverName

Identifies the database. The database name is the last component in the database path name.

-host receiverHostName

Defines the host name or TCP/IP address of the subscriber host.

-timeout seconds

Specifies timeout value in seconds. ttRepAdmin returns within this amount of time, even if all updates to subscribers have not been completed.

Examples

% ttRepAdmin -wait -name receiverName -host receiverHostName
-timeout seconds -dsn DSN 

The above syntax provides a way to ensure that all updates, committed at the time this program was invoked, have been transmitted to the subscriber, receiverName, and the subscriber has acknowledged that all those updates have been durably committed at the subscriber database. The timeout in seconds limits the wait.

Note:

If ttRepAdmin -wait is invoked after all write transaction activity is quiesced at a store (there are no active transactions and no transactions have started), it may take 60 seconds or more before the subscriber sends the acknowledgment that all updates have been durably committed at the subscriber.

% ttRepAdmin -wait -dsn DSN

In the above syntax, if no timeout and no subscriber name are specified, ttRepAdmin does not return until all updates committed at the time this program was invoked have been transmitted to all subscribers and all subscribers have acknowledged that all those updates have been durably committed at the subscriber database.

Replication Status

Use this form of ttRepAdmin to check the size of the transaction log files, bookmark position, or replication configuration of a master database.

ttRepAdmin -log {DSN | -connStr connection_string}
ttRepAdmin -showstatus -detail {-awtmoninfo} {DSN | -connStr connection_string}
ttRepAdmin -showconfig {DSN | -connStr connection_string}
ttRepAdmin -bookmark {DSN | -connStr connection_string}

Options

The ttRepAdmin monitor operations have the options:

Option Description

DSN

Indicates the data source name of the master database.

-awtmoninfo

If you have enabled monitoring for AWT cache groups by calling the AwtMonitorConfig procedure, you can display the monitoring results by using the this option.

If AWT monitoring is enabled, ttrepadmin -awtmoninfo displays the output:

  • TimesTen processing time: The total number of milliseconds spent in processing AWT transaction data since monitoring was enabled.

  • Oracle bookmark time: The total number of milliseconds spent in managing AWT metadata on Oracle since monitoring was enabled.

-connStr connection_string

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

-detail

Indicates whether the replication agent transmitters and receivers are using TLS (indicated as SSL)

-log

Prints out number and size of transaction log files retained by replication to transmit updates to other databases.

-showconfig

Lists the entire replication configuration.

See Show the Configuration of Replicated Databases in Oracle TimesTen In-Memory Database Replication Guide Oracle TimesTen In-Memory Database Replication Guide for more information.

-showstatus

Reports the current status of the specified replicated database.

See Use ttRepAdmin to Show Replication Status in Oracle TimesTen In-Memory Database Replication Guide for more information.

-bookmark

Reports the latest marker record from where replication must read the log, the most recently created log sequence number, and the latest log sequence number whose record has been flushed to disk.

Bookmarks are not supported if you have configured parallel replication.

See Show Replicated Log Records in Oracle TimesTen In-Memory Database Replication Guide for more information.

Result Set

If AWT monitoring is enabled, this utility displays the following information in addition to other ttRepAdmin -showstatus output.

  • TimesTen processing time: The total number of milliseconds spent in processing AWT transaction data since monitoring was enabled.

  • Oracle bookmark time: The total number of milliseconds spent in managing AWT metadata on Oracle since monitoring was enabled.

  • Oracle execute time: The total number of milliseconds spent in OCI preparation, binding and execution for AWT SQL operations since monitoring was enabled. This statistic includes network latency between TimesTen and the Oracle database.

  • Oracle commit time: The total number of milliseconds spent in committing AWT updates on Oracle since monitoring was enabled. This statistic includes network latency between TimesTen and the Oracle database.

  • Time since monitoring was started.

  • Total number of TimesTen row operations: The total number of rows updated in AWT cache groups since monitoring was enabled.

  • Total number of TimesTen transactions: The total number of transactions in AWT cache groups since monitoring was enabled.

  • Total number of flushes to Oracle: The total number of times that TimesTen data has been sent to the Oracle database.

The output also includes the percentage of time spent on TimesTen processing, Oracle bookmark, Oracle execution and Oracle commits.

See Use ttRepAdmin to Show Replication Status in Oracle TimesTen In-Memory Database Replication Guide for more information.

Examples

% ttRepAdmin -log DSN

The above syntax reports the number of transaction log files that replication is retaining to transmit updates to other databases. The replication agent retains a transaction log file until all updates in that transaction log file have been successfully transferred to each subscriber database.

% ttRepAdmin -showconfig DSN

The above syntax reports the entire replication configuration. It lists all the subscribers for the specified DSN, the names and details of the tables being replicated, and all the subscriptions.

% ttRepAdmin -showstatus DSN

The above syntax reports the current state of the database for the specified DSN. The output includes the state of all the threads in the replication agents for the replicated databases, bookmark locations, port numbers, and communication protocols.

For example, consider how to use the ttRepAdmin -showstatus utility to display status for a unidirectional replication scheme from the rep1 database to the rep2 database.

The first ttRepAdmin -showstatus output shows the status of the rep1 database and its TRANSMITTER thread. The second output shows the status of the rep2 database and its RECEIVER thread.

% ttRepAdmin -showstatus rep1

DSN                      : rep1
Process ID               : 1980
Replication Agent Policy : MANUAL
Host                     : MYHOST
RepListener Port         : 1113 (AUTO)
Last write LSN           : 0.1487928
Last LSN forced to disk  : 0.1487928
Replication hold LSN     : 0.1486640

Replication Peers:
  Name                   : rep2
  Host                   : MYHOST
  Port                   : 1154 (AUTO)
  Replication State      : STARTED
  Communication Protocol : 12

TRANSMITTER thread(s):
  For                     : rep2
    Start/Restart count   : 2
    Send LSN              : 0.1485960
    Transactions sent     : 3
    Total packets sent    : 10
    Tick packets sent     : 3
    MIN sent packet size  : 48
    MAX sent packet size  : 460
    AVG sent packet size  : 167
    Last packet sent at   : 17:41:05
    Total Packets received: 9
    MIN rcvd packet size  : 48
    MAX rcvd packet size  : 68
    AVG rcvd packet size  : 59
    Last packet rcvd'd at : 17:41:05
    Earlier errors (max 5):
    TT16060 in transmitter.c (line 3590) at 17:40:41 on 08-25-2004
    TT16122 in transmitter.c (line 2424) at 17:40:41 on 08-25-2004

The replication status for the rep2 database should look similar to the following:

> ttRepAdmin -showstatus rep2

DSN                      : rep2
Process ID               : 2192
Replication Agent Policy : MANUAL
Host                     : MYHOST
RepListener Port         : 1154 (AUTO)
Last write LSN           : 0.416464
Last LSN forced to disk  : 0.416464
Replication hold LSN     : -1.-1

Replication Peers:
  Name              : rep1
  Host              : MYHOST
  Port              : 0 (AUTO)
  Replication State : STARTED
  Communication Protocol : 12

RECEIVER thread(s):
  For                   : rep1
  Start/Restart count   : 1
  Transactions received : 0
  Total packets sent    : 20
  Tick packets sent     : 0
  MIN sent packet size  : 48
  MAX sent packet size  : 68
  AVG sent packet size  : 66
  Last packet sent at   : 17:49:51
  Total Packets received: 20
  MIN rcvd packet size  : 48
  MAX rcvd packet size  : 125
  AVG rcvd packet size  : 52
  Last packet rcvd'd at : 17:49:51
% ttRepAdmin -bookmark DSN

The above syntax prints out the log sequence numbers of the earliest log record still needed by replication, the last log record written to disk, and the last log record generated.

% ttRepAdmin -showstatus -awtmoninfo database1

[other -showstatus output]
...
AWT Monitoring statistics
--------------------------
TimesTen processing time : 0.689000 millisecs (0.164307 %)
   Oracle bookmark  time : 3.229000 millisecs (0.770027%)
   Oracle execute time : 342.908000 millisecs (81.774043 %)
   Oracle commit time : 72.450000 millisecs (17.277315 %)
   Time since monitoring was started: 8528.641000 millisecs
   Cache-connect Operational Stats :
      Total Number of TimesTen row operations : 2
      Total Number of TimesTen transactions : 2
      Total Number of flushes to Oracle : 2

The above syntax and output shows the AWT monitoring status.

Notes

The ttRepAdmin utility is supported only for TimesTen Data Manager DSNs. It is not supported for TimesTen Client DSNs.

You must use the -scheme option when specifying more than one replication scheme, or when more than one scheme exists involving the specified database.

Using SQL configuration, you can create multiple replication schemes in the same database. If there is only one replication scheme, the ttRepAdmin utility automatically determines the scheme. If there is more than one scheme, you must use the ttRepAdmin -scheme option to specify which scheme to use.

When configuring replication for databases with the same name on different hosts, you can indicate which database you want to operate on by using -host. For example, if all the subscribers have the name DATA, you can set the replication state on host SW1 with:

% ttRepAdmin -receiver -name DATA -host SW1 -state start DSN

See Also