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 history of all edits are maintained. This can affect decisions about storage and backup management 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 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 supported databases include the following:

    • IBM Db2
    • Microsoft SQL Server
    • Oracle
    • PostgreSQL

  • The input table must be archive enabled.

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

  • To run this tool, you must be connected to the geodatabase as the data owner.

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

Syntax

TrimArchiveHistory(in_table, trim_mode, {trim_before_date})
ParameterExplanationData Type
in_table

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

Table View
trim_mode

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

Note:

At ArcGIS Pro 2.6, 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.TrimArchiveHistory_management("C:\\MyProject\\myGdb.sde\\mydatabase.user1.Parcels", 
                                    "DELETE", "3/10/2020 10:28:56 AM")

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics