ITPub博客

首页 > 数据库 > > DG环境下通过心跳表从业务角度监控数据同步

DG环境下通过心跳表从业务角度监控数据同步

作者:Abraham林老师 时间:2020-09-04 16:45:06 0 删除 编辑

我们通过一个例子演示如何创建心跳表,以及如何执行定时任务来更新心跳表相关字段。

SQL> show user
USER is "SYS"

1 创建测试表
SQL> create table dg_heartbeat tablespace users as
select dbid, name, sysdate as last_update from v$database;

Table created.


SQL> select * from dg_heartbeat;

DBID NAME LAST_UPDATE
---------- ------------------------------ ---------------
2727953090 ZDHYJL 20200429 101928

2 定时job更新心跳表中的计时字段
SQL> var job number
SQL> exec dbms_job.submit(job => :job, what => 'update dg_heartbeat set last_update=sysdate;', next_date => trunc(sysdate, 'MM') + 1/1440, interval => 'sysdate + 1/1440');

PL/SQL procedure successfully completed.

SQL> print job

JOB
----------
1301

SQL> commit;




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31540773/viewspace-3152152/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-07-18

  • 博文量
    169
  • 访问量
    1543