Hoe lang mag het downloaden van documenten met het incrementele script duren?

Als ik de documenten via het incrementele script (zie hieronder) loopt dan duurt het erg lang.

Mijn vraag is hoe ik kan controleren of er inderdaad wel documenten binnen komen.

Allereerst heb ik in de database INVANTIVE-EOL een extra tabel aangemaakt (SettingsAttachments) die het script gebruikt (zie screenshot 1)

Vervolgens draai ik m.b.v. Data Hub het daaronder staande script gedraaid (dit was een aangedragen script dat ik enigszins heb aangepast doordat de settings-tabel permanent nodig is en de stukken tussen // gaven foutmeldingen.)

Het 2e screenshot laat de huidige stand van zaken in het batchscript zien dat Data Hub in gebruik heeft.

Vervolgens wilde ik het trace-bestand bijvoegen als bijlage bij ter informatie van wat er gebeurt is tot op het moment van afbreken, daarvoor in de plaats voeg ik een deel toe van de eerste regels t/m een aantal van de in het eind vermelde regels.

image

use all@eol

declare
  l_timestamp          integer;
  l_timestamp_next_min integer;
  g_step_size          pls_integer := 10000;
begin
  select 
  --/*+ low_cost */ 
         timestampmax 
  into   l_timestamp
  from   SettingsAttachments@sqlserver
  ;
  l_timestamp_next_min := l_timestamp + g_step_size;
  for in
  ( select 
  --/*+ ods(false) http_disk_cache(false) http_memory_cache(false) */ 
           sdt.document
    ,      sdt.url
    ,      sdt.timestamp
    from   SyncDocumentAttachments@eol sdt
    join   AttachmentByUrl@eol(sdt.url) atl
    where  sdt.timestamp > l_timestamp
    and    sdt.timestamp < l_timestamp_next_min
  )
  loop
    if r.timestamp > l_timestamp
    then 
      l_timestamp := r.timestamp;
    end if;
    -- Schrijf weg naar disk.
  end loop;
  --
  if l_timestamp < l_timestamp_next_min
  then
    l_timestamp := l_timestamp_next_min;
  end if;
  --
  update SettingsAttachments@sqlserver
  set    timestampmax = l_timestamp
  ;
end;

Customer Service API Process: False
Process ID: 13836
Parent Process ID: 9420
Parent Process Executable: cmd
Working Directory: D:\INVANTIVE-EOL\batch
Command Line: "C:\Program Files (x86)\Invantive Software BV\Invantive Data Hub 20.2\Invantive.Producer.QueryEngine.exe"  /database:"Preadyz\exact-online-nl-sql-server" /file:"D:\INVANTIVE-EOL\queries\DataHub\IncrementeleDocumentenOphalen.sql" /logfile:"D:\INVANTIVE-EOL\logs\IncrementeleDocumentenOphalen.log" /logoverwrite:"" /interactive:False
Machine Full Name: PZ-SQL02
Operating system version: 10.0.17763.0
Operating system platform: Windows
Helper platform: Windows
- Is Windows: True
- Is Linux: False
- Is OSX: False
Operating system user: preadyz-admin
X64 Operating system: True
Process Executable: C:\Program Files (x86)\Invantive Software BV\Invantive Data Hub 20.2\Invantive.Producer.QueryEngine.exe
#License Checks: 1
First License Check: 12-4-2022 10:21:30 (UTC)
Last License Check: 12-4-2022 10:21:30 (UTC)
License Contract Code: L206
IIID: 96dd4b02-9a09-9e7c-5243-f24bcb08acb3
X64 Process: True
Within Power BI or Power Query: False
Product: Invantive Data Hub
Description: Invantive Data Hub is command-line driven software that is capable of executing Invantive Query Tool-compatible scripts across many database and cloud platforms. Ideal for high volume data loads and extractions of cloud applications such as Exact Online or Salesforce. It provides a headless mode which makes it ideal for use in server environments and scheduled uploads and downloads in lights-out operations.
Description Short: Invantive(R) Data Hub
Copyright: (C) Copyright 2004-2021 Invantive Software B.V., the Netherlands. All rights reserved.
Trademark: Invantive
Configuration: Release
File Location: C:\Program Files (x86)\Invantive Software BV\Invantive Data Hub 20.2\Invantive.Producer.QueryEngine.exe
File Version: 20.2.86.1889
File Version Label: 20.2.86-PROD+1889
Build Date (UTC): 3-11-2021 20:41:18
Environment variable INVANTIVE_TRACE_TO_FILE: true
Environment variable INVANTIVE_TRACE_ACTIVE: true
File Switch: 2
--- START OF TRACE MESSAGES ---
--- CURRENT TIME 12-04-2022 10:21:32 (UTC) ---
--- LOG FILE PART 1 ---
--- FLUSH OF TRACE CACHE ON SWITCH FILE WITH 2.216 UNFLUSHED CHARACTERS WHICH HAVE BEEN FLUSHED NOW DIRECTLY BEFORE THIS TEXT. ---
{"Message":"Parse data of group '' (UUID BR48DL2dWUuVrOWiOQGAZg==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":930,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"a135aeed-930a-4913-97ac-4fada17688b6"}
{"Message":"Parse data of group 'VNET-nl-data cache' (UUID GQmVvWuOIE+WUti5QQ1f1Q==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":931,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"7c265481-a3a4-4caa-991a-4e6a3eff350a"}
{"Message":"Parse data of group 'vnet' (UUID MHm8DsRf5UScH/6Xg0Q/0w==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":932,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"b50fc24d-1ba4-4ebb-a21e-bd8de1d14139"}
{"Message":"Parse data of group 'AFAS CVO NWF' (UUID bPNoORDHEUqUjaxGZQRzMA==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":933,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"96d4c5b3-6eb5-4db9-b8fa-8942fa12793c"}
{"Message":"Parse data of group '' (UUID +9HGbVx5uE6J5Mo2n+2Vuw==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":934,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"82bed1e4-5628-4e66-836b-4e7431a3fc75"}
{"Message":"Parse data of group 'data cache repository' (UUID yxIblxi36kSSvEWxnGIwuw==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":935,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"6b3c6dba-b352-4cc2-854a-ef0c7348d817"}
{"Message":"Parse data of group '' (UUID I5fy5mnzqUapNA+byG+ZTg==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":936,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"86eb2d7d-c16f-4001-9af8-b926b1933d69"}
{"Message":"Parse data of group 'exact-online-nl-sql-server' (UUID inLBRIw/mke/z4ZqWrKmwA==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":937,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"d68caae8-6d88-47a9-8a07-3f7343555e9d"}
{"Message":"Parse data of group 'eol' (UUID XsK334G9AEKvSO7z789BQA==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1279916Z","Id":938,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"3686b3ef-fb62-46b1-8949-cdf1241e6a43"}
{"Message":"Parse data of group 'sqlserver' (UUID u9S1NoUUSEmhZqhhsild1w==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":939,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"c9466fef-5d22-4921-a109-ac1055b404b1"}
{"Message":"Parse data of group 'bol' (UUID Vi1f83L0UUKhfWzMvoOOrw==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":940,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"6406432f-fb28-49cd-a367-897e3a5362e7"}
{"Message":"Parse data of group 'BOL-nl-data cache' (UUID 1PcG1j/pZ0iMIG8X0mmHLA==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":941,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"aef17863-20a0-491a-ad2b-c7b4eaf4df20"}
{"Message":"Parse data of group 'bol' (UUID PddFVcTzVk2Ba/a2sPDT6A==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":942,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"410e0db2-223d-4a3b-a84b-660ab8f95062"}
{"Message":"Parse data of group 'Business Apps' (UUID 0TqF6SBYfUuLufOElu4tPQ==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":943,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"d8c8ef3a-fe2b-49fe-a663-b50453449aa1"}
{"Message":"Parse data of group 'AFAS Online' (UUID lWv2agjdXUKqXakkiJaRBw==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":944,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"85d73591-fe11-482c-8b14-73c8dc9984c1"}
{"Message":"Parse data of group '' (UUID 0hcnDROp6kWq0o12mkxwbg==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":945,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"a6d88b49-b575-415a-81e9-282711bbfe37"}
{"Message":"Parse data of group 'Open (Public) Data' (UUID 6w2plzM+QE6YNvdwoxk9Mg==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":946,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"d3e5024b-dc58-44e6-adc7-8d454816c5e9"}
{"Message":"Parse data of group 'Kadaster' (UUID q8AFYcZwKEyIRoleqYI7uA==).","MessageCode":null,"OccurredUtc":"2022-04-12T10:21:32.1329868Z","Id":947,"ManagedThreadId":1,"SessionId":"PROP-LastUsedDatabase-f77dd786-17da-46ee-99b8-4654e0fd2f14","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"fc028de4-8b80-4388-9d5b-3e2e483023de"}
..........
t/m
..........
{"Message":"Execution log file: C:\\Users\\preadyz-admin\\Invantive\\executionlog.ndjson","MessageCode":null,"OccurredUtc":"2022-04-12T14:13:38.67397Z","Id":3005,"ManagedThreadId":1,"SessionId":"AUTO-ExecutionLogFileNamePath-db998f5a-da8a-4c5a-830a-16afd6c14aa7","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"b519b354-6820-4094-858e-3b7db5872ced"}
{"Message":"Appending 1.022 characters in 97 ms to file 'C:\\Users\\preadyz-admin\\Invantive\\executionlog.ndjson'.","MessageCode":"itgenfby002","OccurredUtc":"2022-04-12T14:13:38.7713239Z","Id":3006,"ManagedThreadId":1,"SessionId":"MTD-RegisterExecutableExit-6f28669b-a8dc-4ba7-a077-42f5dd3a09a1","PoolIdentityId":null,"CallingProviderAlias":null,"GuiAction":null,"GuiExternalIpAddress":null,"GuiLanguage":null,"GuiModuleName":null,"GuiModuleVersion":null,"GuiOsUser":null,"GuiUser":null,"MachineNameFull":"PZ-SQL02","UserLogonCodeWithDomain":"pz-sql02\\preadyz-admin","ProcessId":13836,"Uid":"bd39a8b4-f11f-4083-923b-112cfaba0b61"}
--- END OF TRACE LOGGING TO FILE ---
--- CURRENT TIME 12-04-2022 14:13:38 (UTC) ---
--- CLOSING DOWN PROCESS ---
Clock run time (ms): 13.936.336
User processor time (ms): 10.594
Privileged processor time (ms): 1.172
Total processor time (ms): 11.766
Peak physical memory size (bytes): 421.179.392
Peak virtual memory size (bytes): 5.614.112.768
--- TRACE CACHE HAD 209.762 UNFLUSHED CHARACTERS WHICH HAVE BEEN FLUSHED NOW DIRECTLY BEFORE THIS TEXT. ---

helaas ik kan het trace-bestand niet bijvoegen, graag aangeven hoe je dit wilt ontvangen.

Er valt geen reële tijd te geven gezien het grote aantal documenten en de omvang en de hardware-afhankelijkheden.

Advies is om indien het sneller moet een consult in te plannen.

Maak eerst een tabel waar de BLOB’s in moeten komen:

create table blobs
( timestamp_ bigint           not null
, division   int              not null
, id         uniqueidentifier not null
, documentid uniqueidentifier not null
, attachment varbinary(max)   not null
)

alter table Blobs add constraint blb_pk primary key(id)

create table AttachmentSettings
( division     int    not null
, timestampmax bigint not null
)

alter table AttachmentSettings add constraint asg_pk primary key(division)

Het laden gaat met bijvoorbeeld:

declare
  l_timestamp_start   int64;
  l_timestamp_start_incl int64;
  l_timestamp_next_min int64;
  l_cnt_dct_loaded     int64;
  l_cnt_dct_ptn_loaded int64;
  --
  -- Maximum number of documents to load per run across all companies.
  --
  g_max_dct_load       pls_integer := 5000;
  --
  -- Some maximum step size for timestamp of Exact Online.
  --
  g_step_size          pls_integer := 1000000;
begin
  l_cnt_dct_loaded := 0;
  --
  use [INVANTIVE-EOL]@sqlserver;
  use all@eol;
  --
  for r_ptn in
  ( select to_number(spn.code) divisioncode
    from   SYSTEMPARTITIONS@DataDictionary spn
    where  spn.is_selected = true
    and    spn.provider_name = 'ExactOnlineAll'
    order
    by     spn.code
  )
  loop
    if l_cnt_dct_loaded < g_max_dct_load
    then
      begin
        --
        -- Retrieve timestamp number of the last document.
        --
        select /*+ ods(false) */        
               timestampmax
        into   l_timestamp_start
        from   AttachmentSettings@sqlserver
        where  division = r_ptn.divisioncode
       ;
      exception
        when no_data_found
        then
          insert into AttachmentSettings@sqlserver
          ( division
          , timestampmax
          )
          values 
          ( r_ptn.divisioncode
          , 0
          )
          ;
          l_timestamp_start := 0;
      end;
      --
      use select r_ptn.divisioncode, 'eol';
      --
      -- Find first document along increasing value of timestamp.
      --
      dbms_output.put_line('Select document attachment for division ' || to_char(r_ptn.divisioncode) || ' from beyond timestamp ' || to_char(l_timestamp_start) || '.');
      select min(timestamp)
      into   l_timestamp_start_incl
      from   ( select timestamp
               from   syncdocumentattachments@eol
               where  division = r_ptn.divisioncode
               and    timestamp > l_timestamp_start
               limit 1
             )
      ;
      --
      -- Load when there are any documents.
      --
      if l_timestamp_start_incl is not null
      then
        l_timestamp_next_min := l_timestamp_start_incl + g_step_size;
        l_cnt_dct_ptn_loaded := 0;
        --
        dbms_output.put_line('Select document attachment for division ' || to_char(r_ptn.divisioncode) || ' to at most ' || to_char(l_timestamp_next_min) || '.');
        for r_dct in
        ( select /*+ ods(false) http_disk_cache(false) http_memory_cache(false) */ 
                 sdt.document documentid
          ,      sdt.url
          ,      sdt.timestamp
          ,      atl.DocumentContents
          ,      sdt.ID attachmentid
          from   SyncDocumentAttachments@eol sdt
          join   AttachmentByUrl@eol(sdt.url) atl
          where  sdt.division = r_ptn.divisioncode
          and    sdt.timestamp >= l_timestamp_start_incl
          and    sdt.timestamp <= l_timestamp_next_min
        )
        loop
          if r_dct.timestamp > l_timestamp_start_incl
          then 
            l_timestamp_start_incl := r_dct.timestamp;
          end if;
          --
          -- Save to table.
          --
          begin
            insert into Blobs@sqlserver
            ( timestamp_
            , division
            , id
            , documentid
            , attachment
            )
            values
            ( r_dct.timestamp
            , r_ptn.divisioncode
            , r_dct.attachmentID
            , r_dct.Documentid
            , r_dct.DocumentContents      
            );
          exception
            when others
            then
              dbms_output.put_line('Error loading #' || to_char(l_cnt_dct_ptn_loaded+1) || ' with ID ' || r_dct.attachmentid || ' for document ID ' || r_dct.documentid || ': ' || sqlerrm);
              null;
          end;
          --
          l_cnt_dct_loaded := l_cnt_dct_loaded + 1;
          l_cnt_dct_ptn_loaded := l_cnt_dct_ptn_loaded + 1;
          dbms_output.put_line('Register attachment #' || to_char(l_cnt_dct_ptn_loaded) || ' with ID ' || r_dct.attachmentid || ' for document ID ' || r_dct.documentid || '.');
          --
          if l_cnt_dct_loaded > g_max_dct_load
          then
            dbms_output.put_line('Loaded ' || to_char(l_cnt_dct_loaded) || ' documents exceeds limit of ' || to_char(g_max_dct_load) || '.');
            exit;
          end if;
        end loop;
        --
        -- Move forward to end of range when no documents were found.
        --
        if l_cnt_dct_ptn_loaded = 0 and l_timestamp_start_incl < l_timestamp_next_min
        then
          l_timestamp_start_incl := l_timestamp_next_min;
        end if;
        --
        update AttachmentSettings@sqlserver
        set    timestampmax = l_timestamp_start_incl
        where  division = r_ptn.divisioncode
        ;
        dbms_output.put_line('Finished company ' || r_ptn.divisioncode || ' at timestamp ' || l_timestamp_start_incl || ' (including).');
      else
        dbms_output.put_line('Skip company ' || r_ptn.divisioncode || ', no new documents beyond timestamp ' || to_char(l_timestamp_start) || '.');
      end if;
    else
      dbms_output.put_line('Skip company ' || r_ptn.divisioncode || ', maximum document load exceeded.');
    end if;
  end loop;
end;

Bij het uitvoeren van het script op Hoe lang mag het downloaden van documenten met het incrementele script duren? ontstaat onderstaande foutmelding, hoe op te lossen?

image

itgendid022
The value ‘3839728304’ is not a valid integer.
Value was either too large or too small for an Int32.
Use comma ‘,’ as a thousands separator.

De foutmelding treedt op omdat het getal ‘3839728304’ geen integer is, want een integer heeft een waardenbereik van -2,147,483,648 tot/met 2,147,483,647.

Dit is reproduceerbaar met:

declare
  l_x integer;
begin
  l_x := 3839728304;
end;

Het getal kan wel toegekend worden aan een 64-bit integer (ook wel bekend als “bigint” of “long”):

declare
  l_x int64;
begin
  l_x := 3839728304;
end;

Advies is om alle integer te vervangen door int64 omdat timestamp uit het int64-waardendomein komt. In het bovenstaande codevoorbeeld is deze vervanging reeds doorgevoerd.

In de logfile van het script worden de log-regels bij het draaien van van het script via DataHub dubbel weergegeven (zie hieronder)
Hoe is dit te voorkomen?

2022-04-22 09:58:58.099 Information itgendhb216: 22-04-2022 09:58:58.09502 Select document attachment for division 1234567 from beyond timestamp 1293612644.
2022-04-22 09:58:58.099 Information itgendhb216: 22-04-2022 09:58:58.09502 Select document attachment for division 1234567 from beyond timestamp 1293612644.
2022-04-22 09:58:59.194 Information itgendhb216: 22-04-2022 09:58:59.19317 Select document attachment for division 1234567 to at most 1296950837.
2022-04-22 09:58:59.194 Information itgendhb216: 22-04-2022 09:58:59.19317 Select document attachment for division 1234567 to at most 1296950837.
2022-04-22 09:58:59.740 Information itgendhb216: 22-04-2022 09:58:59.73912 Register attachment #1 with ID 9ed4f0c5-7f70-4c62-90df-2333d9153a9e for document ID e46c6b55-a7c6-4383-a9fa-d9e7e2b1b03a.
2022-04-22 09:58:59.740 Information itgendhb216: 22-04-2022 09:58:59.73912 Register attachment #1 with ID 9ed4f0c5-7f70-4c62-90df-2333d9153a9e for document ID e46c6b55-a7c6-4383-a9fa-d9e7e2b1b03a.
2022-04-22 09:59:00.022 Information itgendhb216: 22-04-2022 09:59:00.02213 Register attachment #2 with ID 18ae7793-9683-4df5-a3db-613f440b4f26 for document ID 0907a1a5-a1ab-4646-9a44-1f7c722566a2.
2022-04-22 09:59:00.022 Information itgendhb216: 22-04-2022 09:59:00.02213 Register attachment #2 with ID 18ae7793-9683-4df5-a3db-613f440b4f26 for document ID 0907a1a5-a1ab-4646-9a44-1f7c722566a2.
2022-04-22 09:59:00.248 Information itgendhb216: 22-04-2022 09:59:00.24713 Register attachment #3 with ID a5e73d45-b3b3-49d1-8b40-d5ec30d6d0b9 for document ID 69a1fced-03e9-4a41-8b8a-d7b52d7463f4.
2022-04-22 09:59:00.248 Information itgendhb216: 22-04-2022 09:59:00.24713 Register attachment #3 with ID a5e73d45-b3b3-49d1-8b40-d5ec30d6d0b9 for document ID 69a1fced-03e9-4a41-8b8a-d7b52d7463f4.
2022-04-22 09:59:00.441 Information itgendhb216: 22-04-2022 09:59:00.44115 Register attachment #4 with ID 59ef9d4e-b9c5-4d12-84fb-239045dc41f0 for document ID 567d99da-b390-4ea0-b369-535a09c2fa6b.
2022-04-22 09:59:00.441 Information itgendhb216: 22-04-2022 09:59:00.44115 Register attachment #4 with ID 59ef9d4e-b9c5-4d12-84fb-239045dc41f0 for document ID 567d99da-b390-4ea0-b369-535a09c2fa6b.