Oracle 10g Advanced Replication Instance (multi-agent Replication) (reprinted)

Source: Internet
Author: User

Oracle 10g Advanced Replication instances (multi-agent replication)

Objective:

Configured three times, two is one way. The last time is finally two-way. Also a little bit of success in the joy. Joy? Joy does not. It's such a simple thing that I feel ashamed for so long. A lot of data on the network. But they seem to have a bit of a casual writing. Sometimes a little bit of error can make you only have to redo. I'm going to write it again. Available only to beginners. The Master of the configuration will not open resonator. Because I am embarrassed to take out to meet people.

Information:

Principal definition database: testdb.geong.com (make sure you don't get it wrong.) )

Principal database: backdb.geong.com

Operating system: XP

Database version: ORACLE 10g-10.2.0.1.0

Note: The principal definition database refers to the database in which replication work is configured.

Advanced replication process: (The following are not specifically described to operate on both databases).

1 . Processing Database parameters: (two databases to configure)

1 . 1 set Global_name to True. (Global_name is made up of two parts.) +<db_domain>.)

Sql> Show Parameter Global_name

NAME TYPE VALUE

------------------------------------ ----------- --------

Global_names Boolean TRUE

If False Please change

alter system set GLOBAL_NAME=TRUE Scope=spfile; ( written in the SPFile file.) Need to be re-started to work)

1.2 renaming Global_name

ALTER DATABASE rename Global_name to. <domain_name>.

Such as:

ALTER DATABASE global_name to testdb.geong.com;

It should be finished.

Two databases are re-set.

The parameters have been modified.

2 . Start User Configuration: (two databases have the same configuration)

2.1 Configure the replication data test user first.

With System user action:

Create user test identified by test default tablespace users;

Grant Connect,resource to test;

2 . 2 switch to test user

Conn Test/test

CREATE TABLE Test (ID number,name varchar2 (), Constraint TEST_ID_PK primary key (ID));( the primary key must be) ;

2 . 3 insert some test data

INSERT into test values (1, ' tanfufa1 ');

INSERT into test values (1, ' tanfufa1 ');

INSERT into test values (1, ' tanfufa1 ');

Commit

2 . 4 Create public link with system user;

Create on TestDB

Create public database Link "backdb.geong.com" Using ' backdb ';

Test connectivity:

SELECT * from [email protected] backdb.geong.com

Global_name

---------

Backdb. Geong.com

If not, check the tnsname. Be sure to make a pass. Otherwise, you won't have to do it later.

Create on BACKDB

Create public database Link "backdb.geong.com" Using ' backdb ';

Test connectivity:

SELECT * from [email protected] testdb.geong.com

Global_name

---------

TESTDB. Geong.com

If not, check the tnsname. Be sure to make a pass. Otherwise, you won't have to do it later.

3. Configure the Replication management user. (All two databases have the same configuration)

3.1

Conn System/tanfufa

Sql>create user repadmin identified by repadmin default tablespace users temporary tablespace temp;

User created.

Sql>execute dbms_defer_sys.register_propagator (' repadmin ');

PL/SQL procedure successfully completed.

Sql>grant execute any procedure to repadmin;

Grant succeeded.

Sql>execute dbms_repcat_admin.grant_admin_any_repgroup (' repadmin ');

PL/SQL procedure successfully completed.

Sql>execute Dbms_repcat_admin.grant_admin_any_schema (username = ' repadmin ');

PL/SQL procedure successfully completed.

Sql>grant Comment any table to repadmin;

Grant succeeded.

Sql>grant lock any table to repadmin;

Grant succeeded.

Sql>grant Select any dictionary to repadmin;

Grant succeeded.

4. Create the database link with the repadmin user. (All two databases have the same configuration)

in TestDB created on:

Create DATABASE Link "backdb.geong.com" Connect to repadmin identified by repadmin.

Test connectivity:

SELECT * from [email protected] backdb.geong.com

Global_name

---------

Backdb. Geong.com

If not, check the tnsname. Be sure to make a pass. Otherwise, you won't have to do it later.

in Backdb created on:

Create DATABASE Link "backdb.geong.com" Connect to repadmin identified by repadmin.

Test connectivity:

SELECT * from [email protected] testdb.geong.com

Global_name

---------

TESTDB. Geong.com

If not, check the tnsname. Be sure to make a pass. Otherwise, you won't have to do it later.

5. The preparations were all done. now go and have a cup of coffee.

6. . Replication Implementation process: ( pay special attention to the following operations on the TestDB database)

6.1 Conn Repadmin/repadmin

Sql> Execute Dbms_repcat.create_master_repgroup (' rep_mytest ');

PL/SQL procedure successfully completed.

To view information about a replication principal group:

Sql> Select Gname,master,status from Dba_repgroup where gname= ' rep_mytest ';

Gname MASTER STATUS

--------------------------- ----------------------------  ------------------------

Rep_mytest Y quiesced

To add a replication object to a principal group:

Sql> Execute dbms_repcat.create_master_repobject (sname=> ' test ',oname=> ' test ', type=> ' TABLE ', use_ Existing_object=>true,gname=> ' Rep_mytest ', copy_rows=>true);

PL/SQL procedure successfully completed.

View information about copying objects in a replication principal group:

Sql>select sname,oname,status,gname from Dba_repobject where gname= ' rep_mytest ';

SNAME oname STATUS Gname

----------------------------- ------------------------------ ------------- ------------------------------

SCOTT DEPT VALID Rep_mytest

To generate replication support for replication objects:

Sql> Execute dbms_repcat.generate_replication_support (' Test ', ' Test ', ' TABLE ');

PL/SQL procedure successfully completed.

Look again at the information about the replication principal group and the corresponding Replication object:

Sql> Select Gname,master,status from Dba_repgroup where gname= ' rep_mytest ';

Gname MASTER STATUS

--------------------------- ----------------------------  ------------------------

Rep_mytest Y quiesced

Sql> Select Sname,oname,status,gname from Dba_repobject where gname= ' rep_mytest ';

SNAME oname STATUS Gname

----------------------------- ------------------------------ ------------- ------------------------------

SCOTT DEPT VALID Rep_mytest

SCOTT DEPT$RP VALID Rep_mytest

SCOTT DEPT$RP VALID Rep_mytest

To add a database primary site for the replication Principal group:

Sql>execute dbms_repcat.add_master_database (gname=> ' rep_mytest ',

Master=> ' backdb.geong.com ', use_existing_objects=>true,copy_rows=>true, Propagation_mode = ' Synchronous ');

PL/SQL procedure successfully completed.

To view replication site information:

Sql> Select Gname,dblink,masterdef,master from dba_repsites where gname= ' rep_mytest ';

Gname DBLINK masterdef MASTER

------------ --------------------------------  ------------------ --------------

Rep_mytest testdb.geong.com y y

Rep_mytest backdb.geong.com N Y

To start the replication process:

Sql> Execute dbms_repcat.resume_master_activity (' rep_mytest ', true);

PL/SQL procedure successfully completed.

Look again at the information about the replication principal group:

Sql> Select Gname,master,status from Dba_repgroup where gname= ' rep_mytest ';

Gname MASTER STATUS

--------------------------- ----------------------------  ------------------------

Rep_mytest Y NORMAL

Note: The state of the replication principal group is determined by quiesced change to normal .

At this point, the replication process is complete. The relevant data operations can be performed for testing.

7. Test:

1. Delete the modified insert data on TestDB to see the BACKDB changes.

2. Delete the modified insert data on BACKDB to see the TestDB changes.

8. If you need to add a table to the group inside, please follow the in action.

After the configuration is ready. If you need to add a table.

Execute the following command:

8.1.exec dbms_repcat.suspend_master_activity (' rep_mytest ');

suppresses suppression.

8.2.sql> Execute Dbms_repcat.create_master_repobject (sname=> ' reptest ',oname=> ' test1 '

,type=> ' TABLE ',use_existing_object=>true,gname=> ' rep_mytest ', copy_rows=>true);

Add a new table for the group.

8.3.execute dbms_repcat.generate_replication_support (' reptest ', ' test1 ', ' TABLE ')

Increased support.

8.4. Execute dbms_repcat.resume_master_activity (' rep_mytest ', true);

Start process

All right. You can go and test your new watch.

http://blog.chinaunix.net/uid-7540710-id-135066.html

Oracle 10g Advanced Replication Instance (multi-agent Replication) (reprinted)

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.