Oracle Database Synchronization

Source: Internet
Author: User
Oracle Database Synchronization The test is successful between two Oracle databases. The following is a summary:
Requirements:
There are two Oracle database servers A and B (A and B can be on the same Intranet or two independent machines on the Internet ). Both A and B have testable tables with the same structure. Now, when the testable table in database a changes, the testable data in database B also changes accordingly.

My solutions:
Create a link to database B in database A, create a synonym for the table to be synchronized, and create a trigger. Of course, the current user you are using must have the appropriate permissions to perform these operations.

When synchronizing data from A to B, all settings should be made on:
1. To ensure connection to the database of another remote server, you need to create a DB link. However, pay attention to the syntax format: Using + "connect string ", this connect string should exist in the tnsnames of the Oracle server. in the ora file, listenProgramThe remote server will be retrieved from here
The IP address and other information. I have defined a '123' connect string as follows:

251 =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.168.0.20.) (Port = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = mychoice)
)
)

Store it in your tnsnames. ora file.

2. Then you can define the DB link:

Create public database link test2.us. Oracle. com
Connect to user name
Identified by "password"
Using '000000 ';

3. Create synonym (synonymous)

Create or replace synonym test01
For MYCHOICE.TESTABLE@TEST2.US.ORACLE.COM;

After the creation, you can use:
Select * From test01
The preceding statement is equivalent to executing on server B:
Select * From testable

4. feudal triggers:
When the testable table in Table A changes (insert operation is only considered here), the corresponding data will be inserted to the testable of remote database B:

Create or replace trigger rtest
After insert on testable
For each row
Begin

 

Insert into test01 (something) values (: New. Something );
End;

OK. Now we can test it. you can insert a record to the testable table in database a to see if database B has been added accordingly.

Http://blog.chinaunix.net/u/11317/showart_189040.html

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.