Best approach for bulk deleting unreferenced Software Models with no entitlements?

pavan Punna
Tera Contributor

Hi Team,

We have a requirement to bulk delete around 65k Software Models that appear to be safe cleanup candidates.

The deletion criteria is:

  • Software Model has no entitlements
  • Software Model has no references in any related/reference table
  • Only models created by approved system/service accounts are in scope

Since Software Models can be referenced across multiple tables, we want to avoid direct bulk deletion and use a controlled, auditable approach.

The strategy we are considering is:

  1. Identify safe delete candidates once
    Run a read-only script to find Software Models with no entitlements and no references.

  2. Store candidates in a staging/control table
    Store Software Model sys_id, display name, created by, created date, validation status, and backup data.

  3. Delete from the staging table in controlled batches
    Process only records marked as safe/pending, using a configurable batch size.

  4. Track status per record
    Mark each record as Pending, Deleted, Skipped, or Failed.

  5. Produce summary reporting
    Report total scanned, safe candidates, deleted count, skipped count, failed count, and reference reasons.

This would make the cleanup resumable and auditable instead of manually running many individual batches.

Has anyone implemented a similar bulk Software Model cleanup?
Is this staging/control-table approach recommended, or is there a better/simple pattern for safely deleting a large volume of unreferenced Software Models?