Skip to main content

Enable person merge

In this article, we look at how to enable a person merge, schedule a person merge, and person merge and delete a job.

Y
Written by Yusef Abulaynain
Updated over 4 months ago

⚠️ Important: We strongly recommend that merging person records is only scheduled to a suitable slot in overnight processing. The merge checks for locks but there is almost certainly some risk that merges could fail due to locks. The merge process also runs a chronology job to rebuild the chronology events on the target person after merging, so a lot of transactions happen, which may have an impact on system performance while the merge is running. Merge could block workers if it's run while they are using Mosaic.

The following merge call for your database must be run from a database logon that is linked to a worker. For example fw, otherwise the process ends with an error.

For security reasons, database logons that are not linked to a worker cannot obtain locks, and so on. Schedule the call to run overnight.

Merge call for Oracle

-- Overnight Merge process
declare
v_session_id mo_sessions.session_id%type;
begin
audit_session.logon_db(v_session_id);
commit;
--
-- Process SCHEDULED Merges
-- NB. Controls its own transactions internally
mosaic_merge_person.main;
--
audit_session.logoff;
commit;
end;


Merge Call for SQL Server

execute as user='fw'
go
begin
begin try
declare @v_session_id numeric(16);
--
begin transaction
execute audit_session.logon_db @v_session_id output;
commit transaction;
--
-- Process SCHEDULED Merges
-- NB. Controls its own transactions internally
execute mosaic_merge_person.main;
--
begin transaction
execute audit_session.logoff;
commit transaction;
end try
begin catch
-- Preserve error details
declare @v_error_number int,
@v_error_message nvarchar(4000),
-- Required for pseudo-reraise
@v_error_severity int,
@v_error_state int;
select
@v_error_number = error_number(),
@v_error_message = error_message(),
@v_error_severity = error_severity(),
@v_error_state = error_state();
--
print @v_error_message;
--
-- Re-raise the exception
-- NB. SQLServer doesn't currently have a re-raise facilty, but this is close
raiserror(@v_error_message, @v_error_severity, @v_error_state);
end catch;
end;
REVERT;
go



Monitoring progress

You can monitor progress by querying mo_person_merges, which is updated for each phase within each scheduled merge. For example:

select *
from
mo_person_merges
order by
1, 2, 3
go

Did this answer your question?