Implement dblink Synchronization

Source: Internet
Author: User
Dblink synchronizes oracle databases. Oracledblink uses dblink for scheduled synchronization from oracle to oracle. Take the synchronization just made in the center of the card as an example. 1. Create the database that needs to be connected to dblink (If yes, it is not required) example: View dblink: select * fromdba_db_links; Create dblink: crere

Dblink synchronizes oracle databases. Oracle dblink uses dblink for regular oracle-to-oracle synchronization. Take a synchronization just made on the card center as an example. 1. Create the database connected to the dblink. (If yes, it is not required) example: View dblink: select * from dba_db_links; Create dblink: crere

Dblink synchronizes oracle databases. Oracle dblink
Use dblink for regular synchronization from oracle to oracle. Take a synchronization just made on the card center as an example. 1. Create a database connected to dblink (if it already exists, it is not required). Example: view dblink: select * from dba_db_links; create dblink: create database link ECARDRYXX connect to WPENG using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 202.120.85.118) (PORT = 1521) (CONNECT_DATA = (SID = ORA92) '; 2. create a view that needs to be synchronized to the Peer Data: for example, create or replace view ryxx asselect ryjbxx. userid outid, xyzzj G. bmmc college, xszzjg. bmmc connector name, ryjbxx. major, ryjbxx. typeof, ryjbxx. sfsf, ryjbxx.cn, ryjbxx. email, decode (sys_user.STATUS, '2', 'yes', '4', 'No', 'no') inetUserStatus from (select t1.xh userid, t1.xym, t1.xsm, t2.zymc major, 'Student 'typeof, t1.sfsf sfsf, t1.xm cn, t1.dzxx email from nation t1, idc_u_0000mis.0000_zyxx t2 where t1.zyh = t2.zydh (+) -- undergraduate union allselect t1.xh useri D, t1.xym, t1.xsm, t2.zymc, 'student 'typeof, ''sfsf, t1.xm cn, t1.email email from Region t1, Region t2 where t1.zydm = t2.zydm (+) -- graduate student union allselect t1.zgh userid, ''xym, ''xsm, ''major, 'teacher' typeof, ''sfsf, t1.xm cn, t1.dzxx email from idc_u_rs.rs_zzryjbxx t1 -- In-Service Staff union allselect t1.zgh userid, ''xym, ''xsm, ''major, 'teacher' typeof, ''sfs F, t1.xm cn, t1.dzxx email from mongot1 -- new personnel) ryjbxx, idc_u_pub.sys_user, idc_u_rs.rs_zzjg xyzzjg, xszzjgwhere ryjbxx. userid = sys_user.userid and ryjbxx. xym = xyzzjg. bmbh (+)-School Organization and ryjbxx. xym = xszzjg. bmbh (+)-department and institution 3. create the pl/SQL to be synchronized: for example, to use more modular and centralized, we recommend that you write the pl/SQL for the same database in the same package. Create or replace package ecard is procedure ryxxsync; END; create or replace package body ecard is procedure ryxxsync is begin delete from wpeng. ryxx @ ecardryxx; -- delete data insert into wpeng. ryxx @ ecardryxx (outid, college, education name, major, typeof, sfsf, cn, email, inetuserstatus) select outid, college, education name, major, typeof, sfsf, cn, email, inetuserstatus from ryxx; -- Insert the latest data END; 4. create a job and run the job regularly. Row synchronization: for example, open the SQL command window: variable ryxxsyncjob number; begin dbms_job.submit (: ryxxsyncjob, 'ecard. RYXXSYNC; ', SYSDATE, 'trunc (SYSDATE) + 1 + 100'); -- execute the command at every day. Commit; end;

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.