代码备份ORACLE数据库表同步DBLINK
Posted 断梳
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了代码备份ORACLE数据库表同步DBLINK相关的知识,希望对你有一定的参考价值。
---创建目标数据库连接DBLINK
create database link testdblink
connect to xxx identified by "xxx"
using \'(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = xxx.xxx.x.x)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = emis)))\';
---创建存储过程
CREATE OR REPLACE PROCEDURE PROC_A IS
begin
merge into A@testdblink b
using A c
on (b.ID = c.ID)
when matched then
update set b.STATE = c.STATE where b.ID = c.ID
when not matched then
insert
(b.STATE,
b.ID)
values
(c.STATE,
c.ID);
commit;
end PROC_A;
--创建DBMS_JOBS定时器,定时执行存储过程
declare jobno number;
begin
dbms_job.submit(jobno,\'PROC_A;\', sysdate, \'sysdate+1/24/60\');
commit;
end;
/
以上是关于代码备份ORACLE数据库表同步DBLINK的主要内容,如果未能解决你的问题,请参考以下文章