Home Database Mysql Tutorial 实现利用dblink同步

实现利用dblink同步

Jun 07, 2016 pm 02:54 PM
use Synchronize accomplish

dblink实现oracle对oracle数据库的同步。 Oracle dblink 利用dblink 做oracle到oracle的定时同步,以刚为卡中心做的一个同步为例1、创建需要的dblink连接的数据库(若已经有,则不需要) 例:查看 dblink : select * from dba_db_links; 创建 dblink : cre

dblink实现oracle对oracle数据库的同步。 Oracle dblink
利用dblink 做oracle到oracle的定时同步,以刚为卡中心做的一个同步为例

1、创建需要的dblink连接的数据库(若已经有,则不需要)
 
例:
查看 dblink :  select * from dba_db_links; 
 
创建 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 or replace view ryxx as
select ryjbxx.userid outid, xyzzjg.bmmc college, xszzjg.bmmc departname, 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 idc_u_xs.xs_xsjbxx t1, idc_u_jwmis.jw_zyxx t2
       where  t1.zyh = t2.zydh(+)                                                 -- 本科生
union all
select t1.xh userid, t1.xym, t1.xsm, t2.zymc, 'student' typeof, '' sfsf, t1.xm cn, t1.email email
       from idc_u_yjs.yjs_yjsjbxx t1, idc_u_yjs.yjs_dict_bsxkzydm t2
       where t1.zydm = t2.zydm(+)                                                  -- 研究生
union all
select t1.zgh userid, '' xym, '' xsm, '' major, 'teacher' typeof, '' sfsf,  t1.xm cn, t1.dzxx email
       from idc_u_rs.rs_zzryjbxx t1                                                --  在职人员
union all
select t1.zgh userid, '' xym, '' xsm, '' major, 'teacher' typeof, '' sfsf,  t1.xm cn, t1.dzxx email
       from idc_u_rs.rs_xjrylsb t1                                                 -- 新增人员
) ryjbxx, idc_u_pub.sys_user, idc_u_rs.rs_zzjg xyzzjg, idc_u_rs.rs_zzjg xszzjg
where
      ryjbxx.userid = sys_user.userid
      and ryjbxx.xym = xyzzjg.bmbh(+)    --  学院组织机构
      and ryjbxx.xym = xszzjg.bmbh(+)    --   院系组织机构

3. 创建需要执行同步的pl/sql :
 
例如:
   为了使用更模块化,更集中,建议同面向同一个库的pl/sql,写在同一个包下。
 
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; --删除数据
            insert into wpeng.ryxx@ecardryxx(outid, college, departname, major, typeof, sfsf, cn, email, inetuserstatus)
                   select outid, college, departname, major, typeof, sfsf, cn, email, inetuserstatus from ryxx;  --插入最新数据
       END;
END;
 

4. 创建job,定时执行同步:
 
例:
打开 sql命令窗口:
 
variable ryxxsyncjob number; 
 
 
begin
     dbms_job.submit(:ryxxsyncjob, 'ECARD.RYXXSYNC;',
                                   SYSDATE, 'TRUNC(SYSDATE) + 1 + 2/24');  --每天凌晨两点执行。
     commit;
end;
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

One or more items in the folder you synced do not match Outlook error One or more items in the folder you synced do not match Outlook error Mar 18, 2024 am 09:46 AM

When you find that one or more items in your sync folder do not match the error message in Outlook, it may be because you updated or canceled meeting items. In this case, you will see an error message saying that your local version of the data conflicts with the remote copy. This situation usually happens in Outlook desktop application. One or more items in the folder you synced do not match. To resolve the conflict, open the projects and try the operation again. Fix One or more items in synced folders do not match Outlook error In Outlook desktop version, you may encounter issues when local calendar items conflict with the server copy. Fortunately, though, there are some simple ways to help

How to implement dual WeChat login on Huawei mobile phones? How to implement dual WeChat login on Huawei mobile phones? Mar 24, 2024 am 11:27 AM

How to implement dual WeChat login on Huawei mobile phones? With the rise of social media, WeChat has become one of the indispensable communication tools in people's daily lives. However, many people may encounter a problem: logging into multiple WeChat accounts at the same time on the same mobile phone. For Huawei mobile phone users, it is not difficult to achieve dual WeChat login. This article will introduce how to achieve dual WeChat login on Huawei mobile phones. First of all, the EMUI system that comes with Huawei mobile phones provides a very convenient function - dual application opening. Through the application dual opening function, users can simultaneously

PHP Programming Guide: Methods to Implement Fibonacci Sequence PHP Programming Guide: Methods to Implement Fibonacci Sequence Mar 20, 2024 pm 04:54 PM

The programming language PHP is a powerful tool for web development, capable of supporting a variety of different programming logics and algorithms. Among them, implementing the Fibonacci sequence is a common and classic programming problem. In this article, we will introduce how to use the PHP programming language to implement the Fibonacci sequence, and attach specific code examples. The Fibonacci sequence is a mathematical sequence defined as follows: the first and second elements of the sequence are 1, and starting from the third element, the value of each element is equal to the sum of the previous two elements. The first few elements of the sequence

How to implement the WeChat clone function on Huawei mobile phones How to implement the WeChat clone function on Huawei mobile phones Mar 24, 2024 pm 06:03 PM

How to implement the WeChat clone function on Huawei mobile phones With the popularity of social software and people's increasing emphasis on privacy and security, the WeChat clone function has gradually become the focus of people's attention. The WeChat clone function can help users log in to multiple WeChat accounts on the same mobile phone at the same time, making it easier to manage and use. It is not difficult to implement the WeChat clone function on Huawei mobile phones. You only need to follow the following steps. Step 1: Make sure that the mobile phone system version and WeChat version meet the requirements. First, make sure that your Huawei mobile phone system version has been updated to the latest version, as well as the WeChat App.

Master how Golang enables game development possibilities Master how Golang enables game development possibilities Mar 16, 2024 pm 12:57 PM

In today's software development field, Golang (Go language), as an efficient, concise and highly concurrency programming language, is increasingly favored by developers. Its rich standard library and efficient concurrency features make it a high-profile choice in the field of game development. This article will explore how to use Golang for game development and demonstrate its powerful possibilities through specific code examples. 1. Golang’s advantages in game development. As a statically typed language, Golang is used in building large-scale game systems.

PHP Game Requirements Implementation Guide PHP Game Requirements Implementation Guide Mar 11, 2024 am 08:45 AM

PHP Game Requirements Implementation Guide With the popularity and development of the Internet, the web game market is becoming more and more popular. Many developers hope to use the PHP language to develop their own web games, and implementing game requirements is a key step. This article will introduce how to use PHP language to implement common game requirements and provide specific code examples. 1. Create game characters In web games, game characters are a very important element. We need to define the attributes of the game character, such as name, level, experience value, etc., and provide methods to operate these

How to implement exact division operation in Golang How to implement exact division operation in Golang Feb 20, 2024 pm 10:51 PM

Implementing exact division operations in Golang is a common need, especially in scenarios involving financial calculations or other scenarios that require high-precision calculations. Golang's built-in division operator "/" is calculated for floating point numbers, and sometimes there is a problem of precision loss. In order to solve this problem, we can use third-party libraries or custom functions to implement exact division operations. A common approach is to use the Rat type from the math/big package, which provides a representation of fractions and can be used to implement exact division operations.

What does TikTok recommended video mean? How to use Douyin to recommend videos? What does TikTok recommended video mean? How to use Douyin to recommend videos? Mar 27, 2024 pm 03:01 PM

As a world-renowned short video social platform, Douyin has won the favor of a large number of users with its unique personalized recommendation algorithm. This article will delve into the value and principles of Douyin video recommendation to help readers better understand and make full use of this feature. 1. What is Douyin recommended video? Douyin recommended video uses intelligent recommendation algorithms to filter and push personalized video content to users based on their interests and behavioral habits. The Douyin platform analyzes users' viewing history, like and comment behavior, sharing records and other data to select and recommend videos that best suit users' tastes from a huge video library. This personalized recommendation system not only improves user experience, but also helps users discover more video content that matches their preferences, thereby enhancing user stickiness and retention rate. at this

See all articles