Esquema push automático de comparação de dados de processamento Oracle

Esquema push automático de comparação de dados de processamento Oracle


Os cenários a seguir são usados ​​apenas como um exercício para demonstrar todo o processo, e os indivíduos devem fazê-lo de acordo com sua situação real.

Situação do servidor de perfuração:

Lista de servidores:

11.71.253.66

10.74.132.107

10.74.132.85

11.71.253.126


1. No servidor 11.71.253.66 às 8h20 todos os dias, use a ferramenta de migração de dados Kettle para enviar as informações do banco de dados PostgreSQL do Hikvision TIM para o banco de dados Oracle no servidor 11.71.253.66.

A tabela da tabela inclui: cruzamento, faixa, região, tim_wf, vvt_cross_lane.


2. No servidor 10.74.132.107 às 9:00 todos os dias, extraia os dados do servidor 11.71.253.66 por meio da tarefa Oracle Job (handle_config).

etapas de execução detalhadas

2.1 Primeiro, faça backup dos dados da tabela na tabela bak.

2.2 Insira os dados da tabela do servidor 11.71.253.66. Incluindo: cruzamento, pista, região, tim_wf, vvt_cross_lane.

2.3. Veja as informações na tabela bak.

Para verificar se é a data mais recente todos os dias, verifique o 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. No servidor 10.74.132.107 às 9:00 todos os dias, os dados ilegais diários integrados são extraídos do servidor 10.74.132.85 por meio da tarefa Oracle Job (do_your_job_123).

Tabela envolvida: RM_WF
verifique diariamente se é a data mais recente, execute o seguinte SQL para verificar:

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

4. Gere um relatório por meio da tarefa Oracle Job (rm_report) no servidor 10.74.132.107 às 9h30 todos os dias.

Mesas envolvidas:

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. No servidor 10.74.132.107 às 10:00 todos os dias, envie o relatório acima para 11.71.253.66 por meio da tarefa Oracle Job (send_data_to_66).

PL/SQL faça login no servidor 11.71.253.66 para verificar se a tabela é a data mais recente, a data deve ser 9:30, execute a seguinte consulta SQL:

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. No servidor 11.71.253.66 às 10h30 todos os dias, envie os dados do relatório acima para o servidor 11.71.253.126 por meio da tarefa Oracle Job (send_data_to_126).

---- Vá remotamente para o servidor 11.71.253.66, faça login no servidor 11.71.253.126 (Jzjgzhxt01) para verificar se a tabela é a última data, a data deve ser 9:30, execute a seguinte consulta SQL:

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. No servidor 11.71.253.126 às 11:00 todos os dias, os arquivos HTML são gerados automaticamente por meio de 8 tarefas agendadas do Windows.

Acesse remotamente o servidor 11.71.253.126 e verifique se o arquivo HTML foi gerado no diretório E:\tzq\wf\report.


8. No servidor 11.71.253.126 às 11h30 todos os dias, através da tarefa Oracle Job (sent_wf_to_mail_go), envie o arquivo HTML para os destinatários de cada brigada.

8.1. Lista de remetentes de e-mail

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

8.2 Dicas para otimização do corpo do e-mail.

8.2.1. No momento, apenas uma pessoa pode enviar e-mails

8.2.1.1, a lista de discussão atual da tabela geral

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, um grande grupo de listas de discussão

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, o mailing list enviado pela segunda brigada

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, o mailing list enviado pelas três brigadas

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

Nove, crie cada save

9.1. Crie e salve P_SEND_MAIL()

Crie e salve o script salvo de P_SEND_MAIL() , você pode ler minha outra postagem no blog:
Oracle sends mail --> 1. Criar e salvar emails enviados

9.2. Crie e salve 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. Crie e salve 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. Crie e salve 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. Crie e salve 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. Tratamento de erros

10.1, ORA-24247: o acesso à rede é negado pela lista de controle de acesso (ACL)

Solução alternativa: Processamento da lista de controle

10.1.1. Use DBMS_NETWORK_ACL_ADMIN.CREATE_ACL para criar uma lista de controle de acesso (ACL)

Execute o seguinte 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 para associar esta ACL ao servidor de correio

Aqui está a caixa de correio 163 destinada a enviar e-mails aos clientes.
Execute o seguinte 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. Envio de e-mail falhou! ORA-01031: Autoridade insuficiente

O log de mensagens de erro é o seguinte:

----- 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

Solução alternativa: autorização do usuário

10.2.1. Autorização do usuário

Execute o seguinte SQL de autorização:

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. Crie uma tarefa Oracle Job, execute-a regularmente e salve-a, realize o processamento automático dos resultados da comparação de dados e envie-os automaticamente para a caixa de correio do usuário

11.1. Crie uma tarefa Oracle Job e execute-a às 10:00 todos os dias

Execute o seguinte código para criar uma tarefa Oracle Job:

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. Executar imediatamente uma tarefa do Oracle Job

11.2.1. Encontre o ID do trabalho criado na etapa anterior

Primeiro, pesquise a visualização user_jobs para localizar o campo JOB da tarefa Oracle Job recém-criada na etapa anterior, que é o id da tarefa.
Execute o seguinte comando para localizar todas as tarefas do Oracle Job sob o usuário:

SELECT * FROM user_jobs;

11.2.2. Executar imediatamente uma tarefa Oracle Job

Passe o id do job, por exemplo, se o id do job for 6, execute o seguinte script SQL para executar a tarefa Oracle Job imediatamente:

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

Neste ponto, a explicação da comparação automática de dados da Oracle e da solução push automática acabou.Se você tiver alguma dúvida, pode me deixar uma mensagem, obrigado!

Acho que você gosta

Origin blog.csdn.net/tttzzzqqq2018/article/details/132247316
Recomendado
Clasificación