The following articles mainly describe the synchronization-related replication of Oracle Advanced Replication. If a company needs to set up a server (Oracle) in several related places throughout the country, the consistency of related DB data is required. One of the following is a test scheme: Synchronous replication.
Detailed steps for configuring Oracle Advanced Replication and synchronous Replication
[Oracle] Oracle Advanced copy synchronization configuration steps
First, the database must have the Oracle Advanced replication function. log on to the database as a system and view the v $ option view. If Advanced replication is set to TRUE, the Advanced replication function of Oracle is supported; otherwise, it is not supported)
I. basic information about the database
Database version A: Oracle 10.2.0.1 database name sid: eread
Database B version Oracle 10.1.0.3 database name sid: test
Subject-defined site: A eread
Main Site: B test
Note: The subject-defined site refers to the site configured for replication.
Users involved in this example.
Copy administrator: repadmin
Application User: cqm
In this example, the Oracle Advanced copy object is the reptest data table.
Prerequisites for this example: You need to set the corresponding parameters. job_queue_processes must be greater than 0, global_name = true, and the corresponding db link is created.
- alter system set global_names=true scope=both;
2. Create application users CQM on the two databases respectively
- CREATE USER CQM IDENTIFIED BY CQM DEFAULT TABLESPACE CQM TEMPORARY TABLESPACE TEMP;
- GRANT DBA TO CQM;
3. Create a copy administrator user REPADMIN on the two databases respectively.
Create a repadmin user to manage the Oracle Advanced Replication Environment
- CREATE USER REPADMIN IDENTIFIED BY REPADMIN;
- ALTER USER REPADMIN DEFAULT TABLESPACE USERS;
- ALTER USER REPADMIN TEMPORARY TABLESPACE TEMP;
- GRANT connect, resource TO REPADMIN;
Grant repadmin user permissions to manage any subject groups on the current site
- EXECUTE dbms_repcat_admin.grant_admin_any_schema('REPADMIN');
Grant the repadmin user permission to create a snapshot logs for any table
- GRANT comment any table TO REPADMIN;
- GRANT lock any table TO REPADMIN;
Specify the repadmin user as propagator and grant the permission to execute any procedure.
- EXECUTE dbms_defer_sys.register_propagator('REPADMIN');
- GRANT execute any procedure TO REPADMIN;
4. Change the global names of the two databases
- alter database rename global_name to A.TEST.COM.CN;
- alter database rename global_name to B.TEST.COM.CN;
A: eread.im.com.cn
B: test.im.com.cn
5. Create database links on two databases
- create public database link test.im.com.cn connect to REPADMIN identified by REPADMIN using 'test';
- create public database link eread.im.com.cn connect to REPADMIN identified by REPADMIN using 'eread';
6. Create a table under CQM of two Database Application Users
In the database EREAD user CQM: note that the table for advanced Oracle replication must have a primary key.
- CREATE TABLE TEST(ID NUMBER(10),TIMESTAMP DATE DEFAULT sysdate);
- ALTER TABLE TEST ADD(CONSTRAINT TEST_PK PRIMARY KEY(ID));
Under user CQM on Database EREAD:
- CREATE TABLE TEST(ID NUMBER(10),TIMESTAMP DATE DEFAULT sysdate);
- ALTER TABLE TEST ADD(CONSTRAINT TEST_PK PRIMARY KEY(ID));
7. Start operations on the subject-defined site (Database A: eread)
Log on to the database eread with REPADMIN
Create a replication group:
- execute dbms_repcat.create_master_repgroup('rep_hh');
- execute dbms_repcat.create_master_repgroup('repg');
Add a copy object to the copy group:
- execute dbms_repcat.create_master_repobject(sname=>'cqm',oname=>'test',type=>'table',use_existing_object=>true,gname=>'repg');,copy_rows=>false);
Supports copying objects:
- execute dbms_repcat.generate_replication_support('cqm','test','table');
Add a master copy node:
- execute dbms_repcat.add_master_database(gname=>'repg',master=>'test.im.com.cn',use_existing_objects=>true,copy_rows=>false, propagation_mode => 'synchronous');
Start Oracle Advanced Replication at the subject-defined site:
- execute dbms_repcat.resume_master_activity('repg',true);
8. Now the configuration is complete.
Test:
1) Test the simulated small data volume: OK
2) simulate a large data volume test:
- CREATE OR REPLACE procedure insert_into_test
- as
- i number;
- m NUMBER;
- n NUMBER;
- BEGIN
- n:=0;
- FOR i IN 1..10000 LOOP
- m:=i;
- INSERT INTO test(id)VALUES (m);
- nn:=n+1;
- IF n=1000 THEN
- COMMIT;
- n:=0;
- END IF;
- END LOOP;
- COMMIT;
- END;
- /
The above content describes the synchronous replication of Oracle Advanced Replication, hoping to help you in this regard.