oracle数据库实现不同数据库之间的表格数据定期同步

Posted dreamseekerming

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle数据库实现不同数据库之间的表格数据定期同步相关的知识,希望对你有一定的参考价值。

1、创建数据库连接

CREATE PUBLIC DATABASE LINK DBLINK01 CONNECT TO app IDENTIFIED BY appapp2018 USING (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 134.103.65.206)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  );

2、创建存储过程

create or replace procedure test as   
begin   
DELETE FROM KDFAULTORDER;
INSERT INTO KDFAULTORDER
select
BUSINESSDATAID ID,
TITLE REPORTTITLE,
MAINSN  FAULTNUMBER,
(select SPECIALTYNAME from CCATSUPT.PUB_SPECIALTY@kdogg where SPECIALTYID= BIGSPECIALTY)BIGTYPE,
(select SPECIALTYNAME from CCATSUPT.PUB_SPECIALTY@kdogg where SPECIALTYID= SPECIALTY)SMALLTYPE,
(select BUSINESSNAME from CCATSUPT.sys_business@kdogg where BUSINESSID= BUSINESS)REPORTTYPE,
SOURCEDEPT REPORTRESOURCE,
FIRSTRECEPTTIME  REPORTTIME,
REQREPAIRTIME ENDTIME,
(select objectname from ccatsupt.org_tree@kdogg where itemid= REPAIROPER )DEALPERSON,
HASTENNUM REPAIRNUM,
decode(PROCESSFLAG,DECLARATE,申告,BILLDEAL,工单处理中,HANGUP,挂起,VISIT,待回访) ORDERSTATUS,
ALARMSTATUS WARNSTATUS,
(select objectname from ccatsupt.org_tree@kdogg where itemid= regionid) AREANAME
from  CCATSUPT.Svr_Pub_Da_Mainqueue@kdogg
where
ARCHIVETYPE is null
and FIRSTRECEPTTIME < sysdate -15/1140
and REQREPAIRTIME > sysdate -15/1140;
end;

3、创建定时任务

declare  
job1 number;   
begin  
dbms_job.submit(job1,  
     what => test;,  
     next_date => sysdate,  
     interval => TRUNC(sysdate) + 1 + 1 / (24));
   commit;  
end;
// 查询当前数据库的所有定时任务
declare  
job1 number;   
begin  
dbms_job.submit(job1,  
     what => test;,  
     next_date => sysdate,  
     interval => TRUNC(sysdate) + 1 + 1 / (24));
   commit;  
end;  

// 运行某个定时任务
begin
dbms_job.run(29);
commit;
end;

 

以上是关于oracle数据库实现不同数据库之间的表格数据定期同步的主要内容,如果未能解决你的问题,请参考以下文章

Python 进行 Oracle 与 Mysql 不同数据库类型之间的数据 diff

sortable.js 实现两个不同的表格之间表格行的拖曳的功能

Oracle不同数据库之间同步处理方案

Excel如何实现在不同工作表之间跳转已解决

利用Oracle分析函数实现多行数据合并为一行

oracle历史数据迁移