TimesTen Database Replication Learning: 9. Change Active Standby Pair

Source: Internet
Author: User
Tags create index

Copy DDL statements in active Standby pair

In the following example, Active Master is CACHEDB2 and standby master is CACHEDB1

Copying database objects in active Standby pair

The Ddlreplicationlevel Connection property controls the behavior of the copied object.
Ddlreplicationlevel = 1: Do not copy tables, indexes, and synonyms for Create and drop, copy only the Add and delete column operations of the replicated table
Ddlreplicationlevel = 2: Default, Create and drop;ddlreplicationaction for duplicate tables, indexes, and synonyms must be set to include (default)
Ddlreplicationlevel = 3: In addition to all behaviors of 2, it also duplicates views, sequences, ttcacheuidpwdset, and can add a non-empty column to a table

Control the behavior of replication

The following is the case of Ddlreplicationlevel = 2 (default)

Cachedb2>Call ttconfiguration;......<Ddlreplicationaction, INCLUDE><Ddlreplicationlevel,2 >Cachedb2>CREATE TABLE A1 (a int, primary key (a)); cachedb1> Select *From A1;CACHEDB2>Insert intoA1 VALUES (1); cachedb1> Select *from A1;< 1 >Cachedb2>drop table A1;CACHEDB1> Select *from A1;2206: Table tthr.A1 notFoundcachedb2>CREATE TABLE A2 (a int);17061: When Ddlreplicationaction=' INCLUDE 'Tables must be created withA primary keyorA UNIQUE constraint onNon-nullableColumn (s) cachedb2>ALTER SESSIONSETDdl_replication_action=' EXCLUDE ';<-Just don't copy dml,ddl still copy session altered.Cachedb2>Call Ttconfiguration (' Ddlreplicationaction ');<Ddlreplicationaction, EXCLUDE>Cachedb2>CREATE TABLE A1 (a int, primary key (a)); cachedb1> Select *From A1;CACHEDB2>Insert intoA1 VALUES (1); cachedb1> Select *From A1;CACHEDB2>CREATE TABLE A2 (a int); CACHEDB1> Select *From A2;CACHEDB1>Repschemes; Replication Scheme Active Standby:master store:cachedb2 onTimesTen-holMaster STORE:CACHEDB1 onTimesTen-holExcluded Tables:<-Watch this tthr..A1 Tthr.A2 excludedCacheGroups:NoneExcluded sequences:NoneStore:cachedb1 onTimesTen-holPort: (Auto)LogFail Threshold: (None) Retry Timeout: -Seconds Compress traffic:disabled STORE:CACHEDB2 onTimesTen-holPort: (Auto)LogFail Threshold: (None) Retry Timeout: -Seconds Compress traffic:disabled Store: _oracle from TimesTen-holPort: (Auto)LogFail Threshold: (None) Retry Timeout: -Seconds Compress TRAFFIC:DISABLEDCACHEDB2>ALTER ACTIVE STANDBYPAIRINCLUDE TABLE A1;CACHEDB2>Insert intoA1 VALUES (3); cachedb1> Select *from A1;< 3 >Cachedb2>Repschemes; Replication Scheme Active Standby:master store:cachedb2 onTimesTen-holMaster STORE:CACHEDB1 onTimesTen-holExcluded Tables:tthr.A2 Included Tables:<-Watch this tthr..A1 excludedCacheGroups:NoneExcluded sequences:NoneStore:cachedb1 onTimesTen-holPort: (Auto)LogFail Threshold: (None) Retry Timeout: -Seconds Compress traffic:disabled STORE:CACHEDB2 onTimesTen-holPort: (Auto)LogFail Threshold: (None) Retry Timeout: -Seconds Compress traffic:disabled Store: _oracle from TimesTen-holPort: (Auto)LogFail Threshold: (None) Retry Timeout: -Seconds Compress TRAFFIC:DISABLEDCACHEDB2>CREATE INDEX IDX onA1 (a);17063: CREATE INDEX can only refer toEmpty tables when Ddlreplicationlevel> 1

Do not copy a table, and subsequently add it to the replication plan

cachedb2> drop table a2;cachedb2> ALTER SESSION set  ddl_replication_action= ' exclude ' ; Session altered.cachedb2> create  table A2 (a int not< /span> null);cachedb1> select  * from  A2; cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE A2; 8000 : No primary or  Unique index  on  non-nullable  column found for  replicated table Tthr. a2cachedb2> create  UNIQUE index  ixnewtab Span class= "Hljs-keyword" >on  A2 (a);cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE A2; 

The following example shows that if a table is not initially in the replication plan and then joins the replication schedule, the table must be empty

SET ddl_replication_action=‘exclude‘createinto a2 values(1into a2 values(2);cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE a2;17059forisnotemptyfrom a2;cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE a2;
Objects that can be copied automatically

The following objects can be copied automatically when Ddlreplicationlevel = 2 or 3
* Create, ALTER, or drop a user with the Create user, alter USER, or drop US ER statements.
* Grant or revoke privileges from a user with the Grant or revoke statements.
* Alter a table to add or drop a column with the Alter table ... ADD COLUMN or ALTER TABLE ... DROP COLUMN statements. These is the only ALTER TABLE clauses that is replicated. However, when ddlreplicationlevel=2, your cannot alter a table to add a not NULL column to a table so is part of a replic ation scheme with the ALTER TABLE ... ADD COLUMN not NULL DEFAULT statement. You can execute the this statement if ddlreplicationlevel=3.
* Create or drop a table, including global temporary tables with the CREATE TABLE or drop TABLE statements. The new table is also included in the active standby pair.
* Create or drop a synonym with the Create synonym or drop synonym statements.
* Create or drop an index with the Create index or DROP INDEX statements.

The following objects can be automatically copied only when Ddlreplicationlevel = 3
* View
* Sequence (sequence)
* Ttcacheuidpwdset operation

None of the above replication operations need to stop the replication agent.

Changes to the AutoRefresh Mode,pl/sql are not replicated for materialized view operations
If you need to create a PL/SQL function, you need to execute the CREATE statement in all databases and empower

Only indexes created in empty tables will be copied, and if you need to replicate the indexes, you can set Ddlreplicationlevel to 1 and then manually build them on all the databases

Other change actions for active standby pair

The following operations must first stop the replication agent:
* Include or exclude a cache group.
* ADD or drop a subscriber.
* Change values in the STORE clause.
* Change network operations (ADD route or DROP route clause).

The procedure for the above operation is as follows:
1. Stop the rep agent on active
2. If the ASP contains a cache group, stop the cache agent on active
3. Modify the copy schema with alter ACTIVE STANDBY pair
4. Start the rep agent on active
5. If the ASP contains a cache group, start the cache agent on active
6. Destroy all the standby and subscriber
7. Cloning standby using Ttrepadmin
8. Start the rep agent on standby
9. Wait for the standby status to automatically change to standby (Ttrepstateget)
10. If the ASP includes a cache group, start the cache agent on standby
11. Cloning SUBSC by standby
12. Start the replication agent on the Subscriber

TimesTen Database Replication Learning: 9. Change Active Standby Pair

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.