Skip Headers
Oracle® TimesTen In-Memory Database SQL Reference
Release 11.2.1

Part Number E13070-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

ALTER REPLICATION

The ALTER REPLICATION statement adds, alters, or drops replication elements and changes the replication attributes of participating data stores.

Most ALTER REPLICATION operations are supported only when the replication agent is stopped (ttAdmin -repStop). However, it is possible to dynamically add a subscriber data store to a replication scheme while the replication agent is running. See "Altering Replication" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide for more information.

Required privilege

ADMIN

SQL syntax

The ALTER REPLICATION statement has the syntax:

ALTER REPLICATION [Owner.]ReplicationSchemeName
     ElementOperation [...] | StoreOperation |
     NetworkOperation [...]

Specify ElementOperation one or more times:

ADD ELEMENT ElementName
    {DATASTORE | {TABLE [Owner.]TableName [CheckConflicts]} | 
                 SEQUENCE [Owner.]SequenceName}
             { MASTER | PROPAGATOR } FullStoreName
             { SUBSCRIBER FullStoreName [, … ]
                [ReturnServiceAttribute] } [ … ] }
             { INCLUDE | EXCLUDE }{TABLE [[Owner.]TableName[,...]] | 
                    CACHE GROUP [[Owner.]CacheGroupName[,...]]| 
                    SEQUENCE [[Owner.]SequenceName[,...]]}[,...]
    ALTER ELEMENT { ElementName | * IN FullStoreName]
     ADD SUBSCRIBER FullStoreName [,...[ReturnServiceAttribute] |
            ALTER SUBSCRIBER FullStoreName [, …]   |
                SET [ReturnServiceAttribute]   |
            DROP SUBSCRIBER FullStoreName [, … ]
    ALTER ELEMENT * IN FullStoreName
             SET { MASTER | PROPAGATOR } FullStoreName
    ALTER ELEMENT ElementName
             {SET NAME NewElementName | SET CheckConflicts}
    ALTER ELEMENT ElementName 
             { INCLUDE | EXCLUDE }{TABLE [Owner.]TableName |
                    CACHE GROUP [Owner.]CacheGroupName | 
                    SEQUENCE [Owner.]SequenceName}[,...] 
    DROP ELEMENT { ElementName | * IN FullStoreName }

CheckConflicts can only be set when replicating TABLE elements. The syntax is described in "CHECK CONFLICTS".

Syntax for ReturnServiceAttribute is:

{ RETURN RECEIPT [BY REQUEST] | NO RETURN }

StoreOperation clauses:

ADD STORE FullStoreName [StoreAttribute [… ]]
    ALTER STORE FullStoreName SET StoreAttribute [… ]

Syntax for the StoreAttribute is:

[DISABLE RETURN {SUBSCRIBER | ALL} NumFailures]
[RETURN SERVICES {ON | OFF} WHEN [REPLICATION] STOPPED]
[DURABLE COMMIT {ON | OFF}]
[RESUME RETURN MilliSeconds ]
[LOCAL COMMIT ACTION {NO ACTION| COMMIT}]
[RETURN WAIT TIME Seconds]
[COMPRESS TRAFFIC {ON | OFF} ]
[PORT PortNumber ]
[TIMEOUT Seconds ]
[FAILTHRESHOLD Value]
[CONFLICT REPORTING SUSPEND AT Value ]
[CONFLICT REPORTING RESUME AT Value ]
[TABLE DEFINITION CHECKING {EXACT|RELAXED}]

Specify NetworkOperation one or more times:

ADD ROUTE MASTER FullStoreName SUBSCRIBER FullStoreName
    { { MASTERIP MasterHost | SUBSCRIBERIP SubscriberHost }
    PRIORITY Priority } [...] 
DROP ROUTE MASTER FullStoreName SUBSCRIBER FullStoreName
     { MASTERIP MasterHost | SUBSCRIBERIP SubscriberHost } [...] 

Parameters

The ALTER REPLICATION statement has the parameters:

Parameter Description
[Owner.]ReplicationSchemeName Name assigned to the replication scheme.
ADD ELEMENT ElementName Adds a new ELEMENT to the existing replication scheme. ElementName is an identifier of up to 30 characters. With DATASTORE elements, the ElementName must be unique with respect to other DATASTORE element names within the first 20 chars.

If the ELEMENT is a DATASTORE, all tables and cache groups are included in the data store. SEQUENCE elements that are part of the data store do not have their return services modified by this statement.

ADD ELEMENT ElementName DATASTORE

{INCLUDE | EXCLUDE}

{TABLE [[Owner.]TableName [,...]]|

CACHE GROUP [[Owner.]CacheGroupName [,...]]|

SEQUENCE [[Owner.]SequenceName[,...]]} [,...]

Adds a new DATASTORE ELEMENT to the existing replication scheme. ElementName is an identifier of up to 30 characters. With DATASTORE elements, the ElementName must be unique with respect to other DATASTORE element names within the first 20 chars.

INCLUDE includes in the data store only the tables and cache groups listed. Use one INCLUDE clause for each object type (table, cache group or sequence).

EXCLUDE includes in the data store all tables and cache groups except the tables, cache groups and sequences listed. Use one EXCLUDE clause for each object type (table, cache group or sequence).

If the element is a sequence, RETURN attributes are not applied, no conflict checking is supported and sequences that cycle return an error.

ADD SUBSCRIBER FullStoreName Indicates an additional subscriber data store. FullStoreName is the data store file name specified in the DataStore attribute of the DSN description.
ALTER ELEMENT * IN FullStoreName

SET { MASTER | PROPAGATOR } FullStoreName

Makes a change to all elements for which FullStoreName is the MASTER or PROPAGATOR. FullStoreName is the data store file name specified in the DataStore attribute of the DSN description.

This syntax can be used on a set of element names to:

  • Add, alter, or drop subscribers.

  • Set the MASTER or PROPAGATOR status of the element set.

SEQUENCE elements that are part of the data store being altered do not have their return services modified by this statement.

ALTER ELEMENT ElementName Name of the element to which a subscriber is to be added or dropped.
ALTER ELEMENT

ElementName1

SET NAME ElementName2

Renames ElementName1 with the name ElementName2. You can only rename elements of type TABLE.
ALTER ELEMENT ElementName

{INCLUDE|EXCLUDE}

{TABLE [Owner.]TableName |

CACHE GROUP [Owner.]CacheGroupName |

SEQUENCE [Owner.]SequenceName} [,...]

ElementName is the name of the element to be altered.

INCLUDE adds to the data store the tables and cache groups listed. Use one INCLUDE clause for each object type (table or cache group).

EXCLUDE removes from the data store the tables and cache groups listed. Use one EXCLUDE clause for each object type (table, cache group or sequence).

If the element is a sequence, RETURN attributes are not applied, no conflict checking is supported and sequences that cycle return an error.

ALTER SUBSCRIBER FullStoreName

SET RETURN RECEIPT

[BY REQUEST]|NO RETURN

Indicates an alteration to a subscriber data store to enable, disable, or change the return receipt service. FullStoreName is the data store file name specified in the DataStore attribute of the DSN description.
CheckConflicts Check for replication conflicts when simultaneously writing to bidirectionally replicating TABLE elements between data stores. You cannot check for conflicts when replicating elements of type DATASTORE. See "CHECK CONFLICTS".
COMPRESS TRAFFIC {ON | OFF} Compress replicated traffic to reduce the amount of network bandwidth. ON specifies that all replicated traffic for the data store defined by STORE be compressed. OFF (the default) specifies no compression. See "Compressing replicated traffic" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide for details.
CONFLICT REPORTING SUSPEND AT Value Suspends conflict resolution reporting.

Value is a non-negative integer. The default is 0 and means never suspend. Conflict reporting is suspended when the rate of conflict exceeds Value. If you set Value to 0, conflict reporting suspension is turned off.

Use this clause for table level replication.

CONFLICT REPORTING RESUME AT Value Resumes conflict resolution reporting.

Value is a non-negative integer. Conflict reporting is resumed when the rate of conflict falls below Value. The default is 1.

Use this clause for table level replication.

DISABLE RETURN {SUBSCRIBER | ALL} NumFailures Set the return service failure policy so that return service blocking is disabled after the number of timeouts specified by NumFailures. Selecting SUBSCRIBER applies this policy only to the subscriber that fails to acknowledge replicated updates within the set timeout period. ALL applies this policy to all subscribers should any of the subscribers fail to respond. This failure policy can be specified for either the RETURN RECEIPT or RETURN TWOSAFE service.

If DISABLE RETURN is specified but RESUME RETURN is not specified, the return services remain off until the replication agent for the data store has been restarted.

See "Managing return service timeout errors and replication state changes" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide for details.

DURABLE COMMIT {ON | OFF} Set to override the DurableCommits setting on a data store and enable durable commit when return service blocking has been disabled by DISABLE RETURN.
DROP ELEMENT * IN FullStoreName Deletes the replication description of all elements for which FullStoreName is the MASTER. FullStoreName is the data store file name specified in the DataStore attribute of the DSN description.
DROP ELEMENT ElementName Deletes the replication description of ElementName.
DROP SUBSCRIBER FullStoreName Indicates that updates should no longer be sent to the specified subscriber data store. This operation fails if your replication scheme has only one subscriber. FullStoreName is the data store file name specified in the DataStore attribute of the DSN description.
FAILTHRESHOLD Value The number of log files that can accumulate for a subscriber data store. If this value is exceeded, the subscriber is set to the Failed state.

The value 0 means "No Limit." This is the default.

See "Setting the log failure threshold" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide for more information.

FullStoreName The data store, specified as one of the following:
  • SELF

  • The prefix of the data store file name

For example, if the data store path is directory/subdirectory/data.ds0, then data is the data store name.

This is the data store file name specified in the DataStore attribute of the DSN description with optional host ID in the form:

DataStoreName [ON Host]

Host can be either an IP address or a literal host name assigned to one or more IP addresses, as described in "Configuring host IP addresses" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide. Host names containing special characters must be surrounded by double quotes. For example: "MyHost-500".

LOCAL COMMIT ACTION

{NO ACTION | COMMIT}

Specifies the default action to be taken for a RETURN TWOSAFE transaction in the event of a timeout.

NO ACTION: On timeout, the commit function returns to the application, leaving the transaction in the same state it was in when it entered the commit call, with the exception that the application is not able to update any replicated tables. The application can only reissue the commit. The transaction may not be rolled back. This is the default.

COMMIT: On timeout, the commit function attempts to perform a COMMIT to end the transaction locally. No more operations are possible on the same transaction.

This setting can be overridden for specific transactions by calling the ttRepSyncSet procedure with the localAction parameter.

MASTER FullStoreName The data store on which applications update the specified ELEMENT. The MASTER data store sends updates to its SUBSCRIBER data stores. FullStoreName is the data store file name specified in the DataStore attribute of the DSN description.
NO RETURN Specifies that no return service is to be used. This is the default.

For details on the use of the return services, see "Using a return service" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide.

PORT PortNumber The TCP/IP port number on which the replication agent on this data store listens for connections. If not specified, the replication agent allocates a port number automatically.

All TimesTen data stores that replicate to each other must use the same port number.

PROPAGATOR FullStoreName The data store that receives replicated updates and passes them on to other data stores.
RESUME RETURN MilliSeconds If return service blocking has been disabled by DISABLE RETURN, this attribute sets the policy on when to re-enable return service blocking. Return service blocking is re-enabled as soon as the failed subscriber acknowledges the replicated update in a period of time that is less than the specified MilliSeconds.

If DISABLE RETURN is specified but RESUME RETURN is not specified, the return services remain off until the replication agent for the data store has been restarted.

RETURN RECEIPT [BY REQUEST] Enables the return receipt service, so that applications that commit a transaction to a master data store are blocked until the transaction is received by all subscribers.

RETURN RECEIPT applies the service to all transactions. If you specify RETURN RECEIPT BY REQUEST, you can use the ttRepSyncSet procedure to enable the return receipt service for selected transactions. For details on the use of the return services, see "Using a return service" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide.

RETURN SERVICES {ON | OFF} WHEN [REPLICATION] STOPPED Set the return service failure policy so that return service blocking is either enabled or disabled when the replication agent is in the "stop" or "pause" state.

OFF is the default when using the RETURN RECEIPT service. ON is the default when using the RETURN TWOSAFE service.

See "Managing return service timeout errors and replication state changes" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide for details.

RETURN TWOSAFE [BY REQUEST] Enables the return twosafe service, so that applications that commit a transaction to a master data store are blocked until the transaction is committed on all subscribers.

RETURN TWOSAFE applies the service to all transactions. If you specify RETURN TWOSAFE BY REQUEST, you can use the ttRepSyncSet procedure to enable the return receipt service for selected transactions. For details on the use of the return services, see "Using a return service" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide.

RETURN WAIT TIME Seconds Specifies the number of seconds to wait for return service acknowledgement. The default value is 10 seconds. A value of '0' means there is no timeout. Your application can override this timeout setting by calling the ttRepSyncSet procedure with the returnWait parameter
SET {MASTER | PROPAGATOR} FullStoreName Sets the given data store to be the MASTER or PROPAGATOR of the given elements. The FullStoreName must the be data store's file base name.
SUBSCRIBER FullStoreName A data store that receives updates from the MASTER data stores. FullStoreName is the data store file name specified in the DataStore attribute of the DSN description.
TABLE DEFINITION CHECKING {EXACT|RELAXED} Specifies type of table definition checking that occurs on the subscriber:
  • EXACT - The tables must be identical on master and subscriber.

  • RELAXED - The tables must have the same key definition, number of columns and column data types.

The default is EXACT.

TIMEOUT Seconds The amount of time a data store waits for a response from another data store before resending the message. Default: 120 seconds.
ADD ROUTE MASTER FullStoreName SUBSCRIBER FullStoreName Adds NetworkOperation to replication scheme. Allows you to control the network interface that a master store uses for every outbound connection to each of its subscriber stores.

Can be specified more than once.

For FullStoreName, ON "host" must be specified.

DROP ROUTE MASTER FullStoreName SUBSCRIBER FullStoreName Drops NetworkOperation from replication scheme.

Can be specified more than once.

For FullStoreName, ON "host" must be specified.

MASTERIP MasterHost | SUBSCRIBERIP SubscriberHost MasterHost and SubscriberHost are the IP addresses for the network interface on the master and subscriber stores. Specify in dot notation or canonical format or in colon notation for IPV6.

Clause can be specified more than once. Valid for both ADD and DROP ROUTE MASTER.

PRIORITY Priority Variable expressed as an integer from 1 to 99. Denotes the priority of the IP address. Lower integral values have higher priority. An error is returned if multiple addresses with the same priority are specified. Controls the order in which multiple IP addresses are used to establish peer connections.

Required syntax of NetworkOperation clause. Follows MASTERIP MasterHost | SUBSCRIBERIP SubscriberHost clause.


Description

To transfer ownership of the master elements to the subscriber:

Examples

This example sets up replication for an additional table westleads that is updated on data store west and replicated to data store east.

ALTER REPLICATION r1
   ADD ELEMENT e3 TABLE westleads
     MASTER west ON "westcoast"
     SUBSCRIBER east ON "eastcoast";

This example adds an additional subscriber (backup) to table westleads.

ALTER REPLICATION r1
   ALTER ELEMENT e3
     ADD SUBSCRIBER backup ON "backupserver";

This example changes the element name of table westleads from e3 to newelementname.

ALTER REPLICATION r1
   ALTER ELEMENT e3
     SET NAME newelementname;

This example makes newwest the master for all elements for which west currently is the master.

ALTER REPLICATION r1
   ALTER ELEMENT * IN west
     SET MASTER newwest;

This element changes the port number for east.

ALTER REPLICATION r1
   ALTER STORE east ON "eastcoast" SET PORT 22251;

This example adds my.tab1 table to the ds1 data store element in my.rep1 replication scheme.

ALTER REPLICATION my.rep1
  ALTER ELEMENT ds1 DATASTORE
     INCLUDE TABLE my.tab1;

This example adds my.cg1 cache group to ds1 data store in my.rep1 replication scheme.

ALTER REPLICATION my.rep1
  ALTER ELEMENT ds1 DATASTORE
     INCLUDE CACHE GROUP my.cg1;

This example adds ds1 data store to my.rep1 replication scheme. Include my.tab2 table, my.cg2 cache group, and my.cg3 cache group in the data store.

ALTER REPLICATION my.rep1
  ADD ELEMENT ds1 DATASTORE
     MASTER rep2
     SUBSCRIBER rep1, rep3
     INCLUDE TABLE my.tab2
     INCLUDE CACHE GROUP my.cg2, my.cg3;

This example adds ds2 data store to a replication scheme but exclude my.tab1 table, my.cg0 cache group and my.cg1 cache group.

ALTER REPLICATION my.rep1
  ADD ELEMENT ds2 DATASTORE
     MASTER rep2
     SUBSCRIBER rep1
     EXCLUDE TABLE my.tab1
     EXCLUDE CACHE GROUP my.cg0, my.cg1;

Add NetworkOperation clause:

ALTER REPLICATION r
ADD ROUTE MASTER rep1 ON "machine1" SUBSCRIBER rep2 ON "machine2"
MASTERIP "1.1.1.1" PRIORITY 1 SUBSCRIBERIP "2.2.2.2"
    PRIORITY 1
MASTERIP "3.3.3.3" PRIORITY 2 SUBSCRIBERIP "4.4.4.4" PRIORITY 2;

Drop NetworkOperation clause:

ALTER REPLICATION r
DROP ROUTE MASTER repl ON "machine1" SUBSCRIBER rep2 ON "machine2"
MASTERIP "1.1.1.1" SUBSCRIBERIP "2.2.2.2"
MASTERIP "3.3.3.3" SUBSCRIBERIP "4.4.4.4";

See also


ALTER ACTIVE STANDBY PAIR
CREATE ACTIVE STANDBY PAIR
CREATE REPLICATION
DROP ACTIVE STANDBY PAIR
DROP REPLICATION

To drop a table from a data store, see "Altering a replicated table" in Oracle TimesTen In-Memory Database TimesTen to TimesTen Replication Guide.