Answers.Body: <p>I ran into a similar problem today.  My solution requires some tech chops, but was very effective:</p>
  
  <ul>
  <li>Install <a href="https://github.com/civicrm/cv" rel="noreferrer">cv</a> on the server if you haven't already.</li>
  <li>Create a text file named <code>forcemerge.php</code> on the server anywhere in your webroot with the following contents:</li>
  </ul>
  
  <p><code>&lt;?php
  eval(`cv php:boot`);
  // Set the dedupe rule
  $rgid = 13; 
  $return = CRM_Dedupe_Merger::batchMerge($rgid, NULL, 'aggressive', 1, 2, array(), FALSE);
  </code></p>
  
  <ul>
  <li>Change the <code>13</code> above to the dedupe rule ID you want to use for deduping.  You can also change the <code>NULL</code> to a group ID if you only want to dedupe a particular group.</li>
  <li>Set that file as executable and run it!</li>
  </ul>
  
  <p>You should be able to see your progress a number of ways, by periodically doing one of the following:</p>
  
  <ul>
  <li><code>select count(*) from civicrm_contact WHERE is_deleted = 0;</code> in a SQL client;</li>
  <li>Finding duplicates through the CiviCRM UI and then pressing "Refresh Duplicates" to see the number decrease.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-05T19:48:58.900Z
Answers.LastActivityDate: 2018-06-05T19:48:58.900Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Using the &quot;process_batch_merge&quot; Scheduled Job is an easy option. Plus, you can schedule the job to run at an interval or use it as a one-time solution.</p>
  <p><a href="https://docs.civicrm.org/user/ca/latest/initial-set-up/scheduled-jobs/#job_process_batch_merge" rel="nofollow noreferrer">https://docs.civicrm.org/user/ca/latest/initial-set-up/scheduled-jobs/#job_process_batch_merge</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-11T17:35:23.837Z
Answers.LastActivityDate: 2022-03-11T17:35:23.837Z
Answers.UserDisplayName: dsmith63
Body: <p>I have around 900 pairs of contacts I want to force merge. From my attempts to do this, if you click "merge all duplicates", it will simply display "900 pairs skipped" and not give you the "force batch merge" option that you do get when manually selecting contacts to merge.</p>
  
  <p>I am matching on external id's that I've already rigged to ensure consistency, I am sure I want these merged. </p>
  
  <p>Right now my only option is to select 100 contacts at a time and go through "batch merge", then "force batch merge" for each page. </p>
  
  <p>How can I do this most easily? </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-18T06:01:47.860Z
Comments.Text: If you can replicate this problem on the demo server, then it's a bug and worth filing on https://issues.civicrm.org.
Comments.UserDisplayName: Jon G - Megaphone Tech
Tags: <contacts><duplicate-contacts>
Title: Force Batch Merge All Duplicates
ThreadText: # Force Batch Merge All Duplicates
  
  (Asked by: username_0 on 2017-10-17)
  
  I have around 900 pairs of contacts I want to force merge. From my attempts to do this, if you click "merge all duplicates", it will simply display "900 pairs skipped" and not give you the "force batch merge" option that you do get when manually selecting contacts to merge.
  
  I am matching on external id's that I've already rigged to ensure consistency, I am sure I want these merged.
  
  Right now my only option is to select 100 contacts at a time and go through "batch merge", then "force batch merge" for each page.
  
  How can I do this most easily?
  
  **Tags:** contacts, duplicate-contacts
  
  > **Comments:**
  > **username_1**: If you can replicate this problem on the demo server, then it's a bug and worth filing on https://issues.civicrm.org.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-06-05. Score: 5
  
  I ran into a similar problem today. My solution requires some username_1 chops, but was very effective:
  
  * Install [cv](https://github.com/civicrm/cv) on the server if you haven't already.
  * Create a text file named `forcemerge.php` on the server anywhere in your webroot with the following contents:
  
  `<?php
  eval(`cv php:boot`);
  // Set the dedupe rule
  $rgid = 13;
  $return = CRM_Dedupe_Merger::batchMerge($rgid, NULL, 'aggressive', 1, 2, array(), FALSE);`
  
  * Change the `13` above to the dedupe rule ID you want to use for deduping. You can also change the `NULL` to a group ID if you only want to dedupe a particular group.
  * Set that file as executable and run it!
  
  You should be able to see your progress a number of ways, by periodically doing one of the following:
  
  * `select count(*) from civicrm_contact WHERE is_deleted = 0;` in a SQL client;
  * Finding duplicates through the CiviCRM UI and then pressing "Refresh Duplicates" to see the number decrease.
  
  
  ---
  
  ### Answer by username_2 on 2022-03-11. Score: 2
  
  Using the "process\_batch\_merge" Scheduled Job is an easy option. Plus, you can schedule the job to run at an interval or use it as a one-time solution.
  
  <https://docs.civicrm.org/user/ca/latest/initial-set-up/scheduled-jobs/#job_process_batch_merge>
  
  
  ---
  
  