Trim Archive History (Data Management)

Summary

Deletes retired archive records from nonversioned archive-enabled datasets.

Over time, the archive history of a table can grow exponentially as the edit history is maintained. This can affect storage and backup management decisions and may affect performance if the data outgrows the system in place. Some organizations may use nonversioned archiving because it is required for certain functionality and have no need for historical records, or they may want to trim older data that is no longer relevant. This tool allows you to delete all retired rows or the retired rows older than a specified date.

Learn more about trimming the archive history

Usage

  • This tool only supports datasets that are stored in an enterprise geodatabase. The following databases are supported:

    • IBM Db2
    • Microsoft SQL Server
    • Oracle
    • PostgreSQL
    • SAP HANA

  • The input table must be archive enabled.

  • The input table must be nonversioned. Versioned tables are not supported.

  • You must be connected to the geodatabase as the data owner to run this tool.

  • You can access the last trimmed date of a dataset from the feature class or table properties dialog box.

  • If the Input Table parameter value has been published as a feature service and is enabled for offline use, and the Trim Before Date parameter value is unspecified, and if any of the rows are referenced by a replica that has not synced those rows, the tool will fail. If the Trim Before Date parameter value is specified and if the retired rows are referenced by a replica that has not synced those rows, you must provide an earlier Trim Before Date value or unregister the replica.

Parameters

LabelExplanationData Type
Input Table

The nonversioned archive-enabled table with the archive history to be trimmed.

Table View
Trim Mode

Specifies the trim mode that will be used to trim the archive history.

  • DeleteThe archive records will be deleted.
Note:

At the current version of ArcGIS Pro, only the delete trim mode is available.

String
Trim Before Date
(Optional)

Archive records older than this date and time will be deleted. The date and time must be in UTC. If no date is provided, all archive records will be deleted.

Date

Derived Output

LabelExplanationData Type
Output Table

The updated input table with the trimmed archive history.

Table

arcpy.management.TrimArchiveHistory(in_table, trim_mode, {trim_before_date})
NameExplanationData Type
in_table

The nonversioned archive-enabled table with the archive history to be trimmed.

Table View
trim_mode

Specifies the trim mode that will be used to trim the archive history.

Note:

At the current version of ArcGIS Pro, only the delete trim mode is available.

  • DELETEThe archive records will be deleted.
String
trim_before_date
(Optional)

Archive records older than this date and time will be deleted. The date and time must be in UTC. If no date is provided, all archive records will be deleted.

Date

Derived Output

NameExplanationData Type
out_table

The updated input table with the trimmed archive history.

Table

Code sample

TrimArchiveHistory example (Python window)

Trim the archive records of a table older than a specific date and time.

import arcpy
arcpy.management.TrimArchiveHistory("C:\\MyProject\\myGdb.sde\\mydatabase.user1.Parcels", 
                                    "DELETE", "2020/03/10 10:28:56 AM")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics