Oracle processing data comparison automatic push scheme

Oracle processing data comparison automatic push scheme


The following scenarios are only used as a drill to demonstrate the entire process, and individuals should do it according to their actual situation.

Drill server situation:

Server list:

11.71.253.66

10.74.132.107

10.74.132.85

11.71.253.126


1. On the 11.71.253.66 server at 8:20 every day, use the Kettle data migration tool to push the information in the PostgreSQL database of Hikvision TIM to the Oracle database on the 11.71.253.66 server.

The table table includes: crossing, lane, region, tim_wf, vvt_cross_lane.


2. On the 10.74.132.107 server at 9:00 every day, extract data from the 11.71.253.66 server through the Oracle Job task (handle_config).

detailed execution steps

2.1. First, back up the table data to the bak table.

2.2. Insert table data from the 11.71.253.66 server. Including: crossing, lane, region, tim_wf, vvt_cross_lane.

2.3. View the information in the bak table.

To check whether it is the latest date every day, check the SQL:

select to_char(cjrq,'yyyy-mm-dd hh24:mi:ss') cjrqstr,t.* from CROSSING_BAK t order by cjrq desc;
select to_char(cjrq,'yyyy-mm-dd hh24:mi:ss') cjrqstr,t.* from LANE_BAK t order by cjrq desc;
select to_char(cjrq,'yyyy-mm-dd hh24:mi:ss') cjrqstr,t.* from REGION_BAK t order by cjrq desc;
select to_char(cjrq,'yyyy-mm-dd hh24:mi:ss') cjrqstr,t.* from TIM_WF_BAK t order by cjrq desc;
select to_char(cjrq,'yyyy-mm-dd hh24:mi:ss') cjrqstr,t.* from VVT_CROSS_LANE_BAK t order by cjrq desc;

3. On the 10.74.132.107 server at 9:00 every day, the integrated daily illegal data is extracted from the 10.74.132.85 server through the Oracle Job task (do_your_job_123).

Involved table: RM_WF
daily check whether it is the latest date, execute the following SQL to check:

select to_char(cjrq,'yyyy-mm-dd hh24:mi:ss') cjrqstr,t.* from TIM_WF_BAK t order by cjrq desc;

4. Generate a report through the Oracle Job task (rm_report) on the 10.74.132.107 server at 9:30 every day.

Tables involved:

select * from wf_report_deffer;
select * from wf_report_deffer_1dd;
select * from wf_report_deffer_2dd;
select * from wf_report_deffer_3dd;
select * from wf_report_detail;
select * from wf_report_detail_1dd;
select * from wf_report_detail_2dd;
select * from wf_report_detail_3dd;

5. On the 10.74.132.107 server at 10:00 every day, push the above report to 11.71.253.66 through the Oracle Job task (send_data_to_66).

PL/SQL log in to the 11.71.253.66 server to check whether the table is the latest date, the date should be 9:30, execute the following SQL query:

select * from wf_report_deffer;
select * from wf_report_deffer_1dd;
select * from wf_report_deffer_2dd;
select * from wf_report_deffer_3dd;
select * from wf_report_detail;
select * from wf_report_detail_1dd;
select * from wf_report_detail_2dd;
select * from wf_report_detail_3dd;

6. On the 11.71.253.66 server at 10:30 every day, push the above report data to the 11.71.253.126 server through the Oracle Job task (send_data_to_126).

---- Remotely go to the 11.71.253.66 server, log in to the 11.71.253.126 server (Jzjgzhxt01) to check whether the table is the latest date, the date should be 9:30, execute the following SQL query:

select * from wf_report_deffer;
select * from wf_report_deffer_1dd;
select * from wf_report_deffer_2dd;
select * from wf_report_deffer_3dd;
select * from wf_report_detail;
select * from wf_report_detail_1dd;
select * from wf_report_detail_2dd;
select * from wf_report_detail_3dd;

7. At 11.71.253.126 server at 11:00 every day, HTML files are automatically generated through 8 Windows scheduled tasks.

Remotely go to the 11.71.253.126 server, and check whether the HTML file is generated under the directory E:\tzq\wf\report.


8. On the server 11.71.253.126 at 11:30 every day, through the Oracle Job task (sent_wf_to_mail_go), send the HTML file to the recipients of each brigade.

8.1. Email sender list

杨远:[email protected]
阮善强:[email protected]
李凌:[email protected]
尹松柏:[email protected]
樊浩:[email protected]
一大队叶伦:  [email protected]
二大队宋宁静:[email protected]
二大队韩艳:[email protected]
三大队张智洋:[email protected]

8.2. Tips for email body optimization.

8.2.1. At present, only one person can send emails

8.2.1.1, the current mailing list of the general table

sent_wf_to_mail_zl('总表','[email protected]');
sent_wf_to_mail_zl('总表','[email protected]');
sent_wf_to_mail_zl('总表','[email protected]');
sent_wf_to_mail_zl('总表','[email protected]');
sent_wf_to_mail_zl('总表','[email protected]');
sent_wf_to_mail_zl('总表','[email protected]');
sent_wf_to_mail_zl('总表','[email protected]');

8.2.1.2, a large group of mailing lists

sent_wf_to_mail_1dd('一大队','[email protected]');
sent_wf_to_mail_1dd('一大队','[email protected]');
sent_wf_to_mail_1dd('一大队','[email protected]');

8.2.1.3, the mailing list sent by the second brigade

sent_wf_to_mail_2dd('二大队','[email protected]');
sent_wf_to_mail_2dd('二大队','[email protected]');
sent_wf_to_mail_2dd('二大队','[email protected]');
sent_wf_to_mail_2dd('二大队','[email protected]');

8.2.1.4, the mailing list sent by the three brigades

sent_wf_to_mail_3dd('三大队','[email protected]');
sent_wf_to_mail_3dd('三大队','[email protected]');
sent_wf_to_mail_3dd('三大队','[email protected]');

Nine, create each save

9.1. Create and save P_SEND_MAIL()

Create and save the saved script of P_SEND_MAIL() , you can read my other blog post:
Oracle sends mail --> 1. Create and save sent mail

9.2. Create and save sent_wf_to_mail_zl()

CREATE OR REPLACE PROCEDURE sent_wf_to_mail_zl
(--文件名称含本地目录,2个附件发送,按大队发
v_dd in varchar2,    --大队:总量
v_mail in varchar2   --邮件接收人
)
AUTHID CURRENT_USER is
  v_today VARCHAR2(50);      --今天的日期文本
  v_yesterday VARCHAR2(50);  --昨天的日期文本
  v_file_all_name  VARCHAR2(1000);--文件汇总
  v_file_all_name1 VARCHAR2(500); --文件1全名称
  v_file_all_name2 VARCHAR2(500); --文件2全名称
  v_title          VARCHAR2(500);  --邮件标题
  v_content          VARCHAR2(4000);  --邮件正文
  v_hk_zl            VARCHAR2(50);    --海康总量
  v_fail_sl          VARCHAR2(50);    --海康上传失败
  v_sl               VARCHAR2(50);    --海康上传成功
  v_jc_zl            VARCHAR2(50);    --集成接收总量
  v_wf_ylr            VARCHAR2(50);   --集成已录入量
  v_wf_dsx            VARCHAR2(50);   --集成待核对量
  v_wf_cw            VARCHAR2(50);    --集成无效数量
  v_cys              VARCHAR2(50);    --集成海康违法数量差异数
begin
  select to_char(sysdate,'yyyymmdd') into v_today from dual;
  select to_char(sysdate-1,'yyyy-mm-dd') into v_yesterday from dual;
  select sum(hk_zl) into v_hk_zl from WF_REPORT_DEFFER;
  select sum(fail_sl) into v_fail_sl from WF_REPORT_DEFFER;
  select sum(sl) into v_sl from WF_REPORT_DEFFER;
  select sum(jc_zl) into v_jc_zl from WF_REPORT_DEFFER;
  select sum(wf_ylr) into v_wf_ylr from WF_REPORT_DEFFER;
  select sum(wf_dsx) into v_wf_dsx from WF_REPORT_DEFFER;
  select sum(wf_cw) into v_wf_cw from WF_REPORT_DEFFER;
  select sum(hk_zl)-sum(jc_zl) into v_cys from WF_REPORT_DEFFER;
  v_file_all_name1:='E:\tzq\wf\report\'||v_today||'-集成海康违法数据比对差异表(根据昨日数据)-'||v_dd||'.html';
  v_file_all_name2:='E:\tzq\wf\report\'||v_today||'-集成海康违法数据比对详情表(根据昨日数据)-'||v_dd||'.html';
  v_file_all_name:=v_file_all_name1||','||v_file_all_name2;
  v_title:='【荆州市公安交通管理局】-集成海康违法数据比对分析报告('||v_yesterday||'的数据)-'||v_dd;--邮件标题
  --邮件正文
  v_content:=v_title
  ||utl_tcp.CRLF||v_yesterday||'交管局违法数据统计如下:'
  ||utl_tcp.CRLF||'一、海康TIM平台违法量。'
  ||utl_tcp.CRLF||'  1.1、海康总量:'||v_hk_zl
  ||utl_tcp.CRLF||'  1.2、上传成功:'||v_sl
  ||utl_tcp.CRLF||'  1.3、上传失败:'||v_fail_sl
  ||utl_tcp.CRLF||'二、集成平台违法量。'
  ||utl_tcp.CRLF||'  2.1、接收总量:'||v_jc_zl
  ||utl_tcp.CRLF||'  2.2、已录入量:'||v_wf_ylr
  ||utl_tcp.CRLF||'  2.3、待核对量:'||v_wf_dsx
  ||utl_tcp.CRLF||'  2.4、无效数量:'||v_wf_cw
  ||utl_tcp.CRLF||'三、集成海康违法比对差异数。'
  ||utl_tcp.CRLF||'  差异总数为(海康总量减集成总量):'||v_cys
  ||utl_tcp.CRLF
  ||utl_tcp.CRLF||'(详情请看附件内容)'
  ;
  --dbms_output.put_line('v_file_all_name:'||v_file_all_name);
  --dbms_output.put_line('v_content:'|| v_content);
  P_SEND_MAIL(v_content,--邮件正文
              v_title,--邮件标题
              '[email protected]',--发送邮箱
              v_mail,--接收邮箱
              'smtp.163.com',
              25,
              1,
              '[email protected]',--发送邮箱的账号
              'xxxxxxx',--发送邮箱的密码
              v_file_all_name, --文件
              'base64');
end;

9.3. Create and save job_to_zl()

CREATE OR REPLACE PROCEDURE job_to_zl AUTHID CURRENT_USER IS
BEGIN
  sent_wf_to_mail_zl('总表','[email protected]');
  sent_wf_to_mail_zl('总表','[email protected]');
  sent_wf_to_mail_zl('总表','[email protected]');
  sent_wf_to_mail_zl('总表','[email protected]');
  sent_wf_to_mail_zl('总表','[email protected]');
  sent_wf_to_mail_zl('总表','[email protected]');
  sent_wf_to_mail_zl('总表','[email protected]');
END;

9.4. Create and save sent_wf_to_mail_1dd()

CREATE OR REPLACE PROCEDURE sent_wf_to_mail_1dd
(--文件名称含本地目录,2个附件发送,按大队发
v_dd in varchar2,    --大队:总量
v_mail in varchar2   --邮件接收人
)
AUTHID CURRENT_USER is
  v_today VARCHAR2(50);      --今天的日期文本
  v_yesterday VARCHAR2(50);  --昨天的日期文本
  v_file_all_name  VARCHAR2(1000);--文件汇总
  v_file_all_name1 VARCHAR2(500); --文件1全名称
  v_file_all_name2 VARCHAR2(500); --文件2全名称
  v_title          VARCHAR2(500);  --邮件标题
  v_content          VARCHAR2(4000);  --邮件正文
  v_hk_zl            VARCHAR2(50);    --海康总量
  v_fail_sl          VARCHAR2(50);    --海康上传失败
  v_sl               VARCHAR2(50);    --海康上传成功
  v_jc_zl            VARCHAR2(50);    --集成接收总量
  v_wf_ylr            VARCHAR2(50);   --集成已录入量
  v_wf_dsx            VARCHAR2(50);   --集成待核对量
  v_wf_cw            VARCHAR2(50);    --集成无效数量
  v_cys              VARCHAR2(50);    --集成海康违法数量差异数
begin
  select to_char(sysdate,'yyyymmdd') into v_today from dual;
  select to_char(sysdate-1,'yyyy-mm-dd') into v_yesterday from dual;
  select sum(hk_zl) into v_hk_zl from WF_REPORT_DEFFER_1DD;
  select sum(fail_sl) into v_fail_sl from WF_REPORT_DEFFER_1DD;
  select sum(sl) into v_sl from WF_REPORT_DEFFER_1DD;
  select sum(jc_zl) into v_jc_zl from WF_REPORT_DEFFER_1DD;
  select sum(wf_ylr) into v_wf_ylr from WF_REPORT_DEFFER_1DD;
  select sum(wf_dsx) into v_wf_dsx from WF_REPORT_DEFFER_1DD;
  select sum(wf_cw) into v_wf_cw from WF_REPORT_DEFFER_1DD;
  select sum(hk_zl)-sum(jc_zl) into v_cys from WF_REPORT_DEFFER_1DD;
  v_file_all_name1:='E:\tzq\wf\report\'||v_today||'-集成海康违法数据比对差异表(根据昨日数据)-'||v_dd||'.html';
  v_file_all_name2:='E:\tzq\wf\report\'||v_today||'-集成海康违法数据比对详情表(根据昨日数据)-'||v_dd||'.html';
  v_file_all_name:=v_file_all_name1||','||v_file_all_name2;
  v_title:='【荆州市公安交通管理局】-集成海康违法数据比对分析报告('||v_yesterday||'的数据)-'||v_dd;--邮件标题
  --邮件正文
  v_content:=v_title
  ||utl_tcp.CRLF||v_yesterday||'交管局违法数据统计如下:'
  ||utl_tcp.CRLF||'一、海康TIM平台违法量。'
  ||utl_tcp.CRLF||'  1.1、海康总量:'||v_hk_zl
  ||utl_tcp.CRLF||'  1.2、上传成功:'||v_sl
  ||utl_tcp.CRLF||'  1.3、上传失败:'||v_fail_sl
  ||utl_tcp.CRLF||'二、集成平台违法量。'
  ||utl_tcp.CRLF||'  2.1、接收总量:'||v_jc_zl
  ||utl_tcp.CRLF||'  2.2、已录入量:'||v_wf_ylr
  ||utl_tcp.CRLF||'  2.3、待核对量:'||v_wf_dsx
  ||utl_tcp.CRLF||'  2.4、无效数量:'||v_wf_cw
  ||utl_tcp.CRLF||'三、集成海康违法比对差异数。'
  ||utl_tcp.CRLF||'  差异总数为(海康总量减集成总量):'||v_cys
  ||utl_tcp.CRLF
  ||utl_tcp.CRLF||'(详情请看附件内容)'
  ;
  --dbms_output.put_line('v_file_all_name:'||v_file_all_name);
  --dbms_output.put_line('v_content:'|| v_content);
  P_SEND_MAIL(v_content,--邮件正文
              v_title,--邮件标题
              '[email protected]',--发送邮箱
              v_mail,--接收邮箱
              'smtp.163.com',
              25,
              1,
              '[email protected]',--发送邮箱的账号
              'xxxxxxx',--发送邮箱的密码
              v_file_all_name, --文件
              'base64');
end;

9.5. Create and save job_to_1dd()

CREATE OR REPLACE PROCEDURE job_to_1dd
AUTHID CURRENT_USER is
begin
	sent_wf_to_mail_1dd('一大队','[email protected]');
	sent_wf_to_mail_1dd('一大队','[email protected]');
	sent_wf_to_mail_1dd('一大队','[email protected]');
end;

10. Error handling

10.1, ORA-24247: network access is denied by access control list (ACL)

Workaround: Control List Processing

10.1.1. Use DBMS_NETWORK_ACL_ADMIN.CREATE_ACL to create an access control list (ACL)

Execute the following SQL:

BEGIN
  dbms_network_acl_admin.create_acl(acl => 'email_server_permissions.xml'
                                   ,description => 'Enables network permissions for the e-mail server'
                                   -- Oracle运行存储过程的用户
                                   ,principal => 'TZQ2018'
                                   ,is_grant => TRUE
                                   ,privilege => 'connect');
  COMMIT;
END;
/

10.1.2. Use DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL to associate this ACL with the mail server

Here is the 163 mailbox bound to send emails to customers.
Execute the following SQL:

BEGIN
  dbms_network_acl_admin.assign_acl(acl => 'email_server_permissions.xml'
                                   ,host => 'smtp.163.com'
                                   , ---SMTP服务器地址
                                    lower_port => 25
                                   , --端口
                                    upper_port => NULL);
  COMMIT;
END;
/

10.2. Email sending failed! ORA-01031: Insufficient authority

The error message log is as follows:

----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
000000028CF1E838       351  procedure TZQ.P_SEND_MAIL
00000002ADC4A128        61  procedure TZQ.SENT_WF_TO_MAIL_1DD
00000002AA982C10         6  procedure TZQ.JOB_TO_1DD
00000002ADC80718         1  anonymous block
00000002AC15BE80       648  package body SYS.DBMS_IJOB
00000002ADBD9F88       284  package body SYS.DBMS_JOB
000000028CDEECC8         2  anonymous block

Workaround: User Authorization

10.2.1. User authorization

Execute the following authorization SQL:

grant execute on SYS.JOB to TZQ;
grant execute on SYS.UTL_SMTP to TZQ;
grant execute on SYS.UTL_TCP to TZQ;
grant connect to TZQ;
grant dba to TZQ;
grant resource to TZQ;

grant administer any sql tuning set to TZQ;
grant administer database trigger to TZQ;
begin
  dbms_resource_manager_privs.grant_system_privilege(
    grantee_name   => 'TZQ',
    privilege_name => 'administer_resource_manager',
    admin_option   => false);
end;
/
grant administer sql management object to TZQ;
grant administer sql tuning set to TZQ;
grant advisor to TZQ;
grant alter any assembly to TZQ;
grant alter any cluster to TZQ;
grant alter any cube to TZQ;
grant alter any cube dimension to TZQ;
grant alter any dimension to TZQ;
grant alter any edition to TZQ;
grant alter any evaluation context to TZQ;
grant alter any index to TZQ;
grant alter any indextype to TZQ;
grant alter any library to TZQ;
grant alter any materialized view to TZQ;
grant alter any mining model to TZQ;
grant alter any operator to TZQ;
grant alter any outline to TZQ;
grant alter any procedure to TZQ;
grant alter any role to TZQ;
grant alter any rule to TZQ;
grant alter any rule set to TZQ;
grant alter any sequence to TZQ;
grant alter any sql profile to TZQ;
grant alter any table to TZQ;
grant alter any trigger to TZQ;
grant alter any type to TZQ;
grant alter database to TZQ;
grant alter profile to TZQ;
grant alter resource cost to TZQ;
grant alter rollback segment to TZQ;
grant alter session to TZQ;
grant alter system to TZQ;
grant alter tablespace to TZQ;
grant alter user to TZQ;
grant analyze any to TZQ;
grant audit any to TZQ;
grant audit system to TZQ;
grant backup any table to TZQ;
grant become user to TZQ;
grant change notification to TZQ;
grant comment any mining model to TZQ;
grant comment any table to TZQ;
grant create any assembly to TZQ;
grant create any cluster to TZQ;
grant create any context to TZQ;
grant create any cube to TZQ;
grant create any cube build process to TZQ;
grant create any cube dimension to TZQ;
grant create any dimension to TZQ;
grant create any directory to TZQ;
grant create any edition to TZQ;
grant create any evaluation context to TZQ;
grant create any index to TZQ;
grant create any indextype to TZQ;
grant create any job to TZQ;
grant create any library to TZQ;
grant create any materialized view to TZQ;
grant create any measure folder to TZQ;
grant create any mining model to TZQ;
grant create any operator to TZQ;
grant create any outline to TZQ;
grant create any procedure to TZQ;
grant create any rule to TZQ;
grant create any rule set to TZQ;
grant create any sequence to TZQ;
grant create any sql profile to TZQ;
grant create any synonTZQ to TZQ;
grant create any table to TZQ;
grant create any trigger to TZQ;
grant create any type to TZQ;
grant create any view to TZQ;
grant create assembly to TZQ;
grant create cluster to TZQ;
grant create cube to TZQ;
grant create cube build process to TZQ;
grant create cube dimension to TZQ;
grant create database link to TZQ;
grant create dimension to TZQ;
grant create evaluation context to TZQ;
grant create external job to TZQ;
grant create indextype to TZQ;
grant create job to TZQ;
grant create library to TZQ;
grant create materialized view to TZQ;
grant create measure folder to TZQ;
grant create mining model to TZQ;
grant create operator to TZQ;
grant create procedure to TZQ;
grant create profile to TZQ;
grant create public database link to TZQ;
grant create public synonTZQ to TZQ;
grant create role to TZQ;
grant create rollback segment to TZQ;
grant create rule to TZQ;
grant create rule set to TZQ;
grant create sequence to TZQ;
grant create session to TZQ;
grant create synonTZQ to TZQ;
grant create table to TZQ;
grant create tablespace to TZQ;
grant create trigger to TZQ;
grant create type to TZQ;
grant create user to TZQ;
grant create view to TZQ;
grant debug any procedure to TZQ;
grant debug connect session to TZQ;
grant delete any cube dimension to TZQ;
grant delete any measure folder to TZQ;
grant delete any table to TZQ;
grant dequeue any queue to TZQ;
grant drop any assembly to TZQ;
grant drop any cluster to TZQ;
grant drop any context to TZQ;
grant drop any cube to TZQ;
grant drop any cube build process to TZQ;
grant drop any cube dimension to TZQ;
grant drop any dimension to TZQ;
grant drop any directory to TZQ;
grant drop any edition to TZQ;
grant drop any evaluation context to TZQ;
grant drop any index to TZQ;
grant drop any indextype to TZQ;
grant drop any library to TZQ;
grant drop any materialized view to TZQ;
grant drop any measure folder to TZQ;
grant drop any mining model to TZQ;
grant drop any operator to TZQ;
grant drop any outline to TZQ;
grant drop any procedure to TZQ;
grant drop any role to TZQ;
grant drop any rule to TZQ;
grant drop any rule set to TZQ;
grant drop any sequence to TZQ;
grant drop any sql profile to TZQ;
grant drop any synonTZQ to TZQ;
grant drop any table to TZQ;
grant drop any trigger to TZQ;
grant drop any type to TZQ;
grant drop any view to TZQ;
grant drop profile to TZQ;
grant drop public database link to TZQ;
grant drop public synonTZQ to TZQ;
grant drop rollback segment to TZQ;
grant drop tablespace to TZQ;
grant drop user to TZQ;
grant enqueue any queue to TZQ;
grant execute any assembly to TZQ;
grant execute any class to TZQ;
grant execute any evaluation context to TZQ;
grant execute any indextype to TZQ;
grant execute any library to TZQ;
grant execute any operator to TZQ;
grant execute any procedure to TZQ;
grant execute any program to TZQ;
grant execute any rule to TZQ;
grant execute any rule set to TZQ;
grant execute any type to TZQ;
grant execute assembly to TZQ;
grant export full database to TZQ;
grant flashback any table to TZQ;
grant flashback archive administer to TZQ;
grant force any transaction to TZQ;
grant force transaction to TZQ;
grant global query rewrite to TZQ;
grant grant any object privilege to TZQ;
grant grant any privilege to TZQ;
grant grant any role to TZQ;
grant import full database to TZQ;
grant insert any cube dimension to TZQ;
grant insert any measure folder to TZQ;
grant insert any table to TZQ;
grant lock any table to TZQ;
grant manage any file group to TZQ;
grant manage any queue to TZQ;
grant manage file group to TZQ;
grant manage scheduler to TZQ;
grant manage tablespace to TZQ;
grant merge any view to TZQ;
grant on commit refresh to TZQ;
grant query rewrite to TZQ;
grant read any file group to TZQ;
grant restricted session to TZQ;
grant resumable to TZQ;
grant select any cube to TZQ;
grant select any cube dimension to TZQ;
grant select any mining model to TZQ;
grant select any sequence to TZQ;
grant select any table to TZQ;
grant select any transaction to TZQ;
grant under any table to TZQ;
grant under any type to TZQ;
grant under any view to TZQ;
grant unlimited tablespace to TZQ;
grant update any cube to TZQ;
grant update any cube build process to TZQ;
grant update any cube dimension to TZQ;
grant update any table to TZQ;

11. Create an Oracle Job task, execute it regularly and save it, realize automatic processing of data comparison results and automatically push them to the user's mailbox

11.1. Create an Oracle Job task and execute it at 10:00 every day

Execute the following code to create an Oracle Job task:

DECLARE
  job_num NUMBER;
BEGIN
  dbms_job.submit(job_num
                 ,'send_data_to_66;'
                 ,SYSDATE
                 ,'TRUNC(sysdate+1)+10/24'); --每天10:00执行
  COMMIT;
END;

11.2. Immediately execute an Oracle Job task

11.2.1. Find the job id created in the previous step

First search the user_jobs view to find the JOB field of the Oracle Job task just created in the previous step, which is the id of the job.
Execute the following command to find all Oracle Job tasks under the user:

SELECT * FROM user_jobs;

11.2.2. Immediately execute an Oracle Job task

Pass in the job id, for example, if the job id is 6, execute the following SQL script to execute the Oracle Job task immediately:

BEGIN
  dbms_job.run(6); -- 6 为 job id
  COMMIT;
END;

At this point, the explanation of Oracle's automatic data comparison and automatic push solution is over. If you have any questions, you can leave me a message, thank you!

Guess you like

Origin blog.csdn.net/tttzzzqqq2018/article/details/132247316