In addition to mechanisms such as:
- the Data Hub log files,
- Log for automated analysis of historical executions of Invantive SQL-products
- Use Amazon CloudWatch for logging Invantive SQL events
- Invantive Trace voortaan in NDJSON-formaat
- API-calls loggen in NDJSON formaat voor bijvoorbeeld Elasticsearch
- Generate output from Invantive PSQL using Oracle-style dbms_output
- New dbms_audit package to facilitate high-level logging on custom apps
it is also possible to log progress to a database table.
The following code can serve as a starting point:
--
-- Copy source data to SQL Server.
--
-- create or replace table SyncLogs@sql
-- ( id guid not null
-- , occurrence_date datetime not null -- UTC
-- , action_type char not null -- 'I', 'D' or 'U' for Insert, Delete or Update, or 'C' for copy, 'S' and 'E' for start and end.
-- , table_name varchar2 null
-- , nk1 varchar2 null -- First element of business key.
-- , nk2 varchar2 null
-- , nk3 varchar2 null
-- , nk4 varchar2 null
-- , nk5 varchar2 null
-- , label varchar2 null -- Textual background.
-- , actions varchar2 null -- Changed values.
-- --
-- , ip_address varchar2 not null -- Audit fields.
-- , iuid varchar2 not null
-- , date_created datetime not null
-- , created_by varchar2 not null
-- , created_at varchar2 not null
-- , session_created varchar2 not null
-- )
begin
--
-- Start process.
--
insert into SYNCLOGS@sql
( id
, occurrence_date
, action_type
, table_name
, label
, actions
--
, ip_address
, iuid
, date_created
, created_by
, created_at
, session_created
)
values
( newid()
, sysdateutc
, 'S'
, null
, 'Start'
, null
--
, sys_context('USERENV', 'CLIENT_IP_ADDRESS_EXTERNAL', 'mc')
, sys_context('USERENV', 'IUID', 'mc')
, sysdateutc
, sys_context('USERENV', 'CURRENT_USER', 'mc')
, sys_context('USERENV', 'APPLICATION_FULL', 'mc')
, sys_context('USERENV', 'SESSIONID', 'mc')
);
--
create or replace table mc_dpersoneel@sql
as
select *
from dpersoneel@mc
;
--
-- Register copy action.
--
insert into SYNCLOGS@mss
( id
, occurrence_date
, action_type
, table_name
, label
, actions
--
, ip_address
, iuid
, date_created
, created_by
, created_at
, session_created
)
values
( newid()
, sysdateutc
, 'C'
, 'mc_dpersoneel@sql'
, 'Created'
, to_char(sqlrowcount) || ' rows'
--
, sys_context('USERENV', 'CLIENT_IP_ADDRESS_EXTERNAL', 'mc')
, sys_context('USERENV', 'IUID', 'mc')
, sysdateutc
, sys_context('USERENV', 'CURRENT_USER', 'mc')
, sys_context('USERENV', 'APPLICATION_FULL', 'mc')
, sys_context('USERENV', 'SESSIONID', 'mc')
);
--
-- End process.
--
insert into SYNCLOGS@mss
( id
, occurrence_date
, action_type
, table_name
, label
, actions
--
, ip_address
, iuid
, date_created
, created_by
, created_at
, session_created
)
values
( newid()
, sysdateutc
, 'E'
, null
, 'Finished'
, null
--
, sys_context('USERENV', 'CLIENT_IP_ADDRESS_EXTERNAL', 'mc')
, sys_context('USERENV', 'IUID', 'mc')
, sysdateutc
, sys_context('USERENV', 'CURRENT_USER', 'mc')
, sys_context('USERENV', 'APPLICATION_FULL', 'mc')
, sys_context('USERENV', 'SESSIONID', 'mc')
);
end;