Skip to main content

Enable Data Archiving

  • By default, data archiving is disabled.
    To use the archiving feature, you must first enable it.

  • When configuring the feature,
    you can also set the frequency at which RavenDB scans the database for documents scheduled for archiving.

  • Once enabled, the archiving task runs periodically at the configured frequency,
    scanning the database for documents that have been scheduled for archival.
    Learn how to schedule documents for archival in Schedule document archiving.

  • In this article:

Enable archiving - from the Client API

Use ConfigureDataArchivalOperation to enable archiving for the database and configure the archiving task. Example:

// Define the archival configuration object
var configuration = new DataArchivalConfiguration
{
// Enable archiving
Disabled = false,

// Optional: override the default archiving frequency
// Scan for documents scheduled for archiving every 180 seconds
ArchiveFrequencyInSec = 180,

// Optional: limit the number of documents processed in each archival run
MaxItemsToProcess = 100
};

// Define the archival operation, pass the configuration
var configureArchivalOp = new ConfigureDataArchivalOperation(configuration);

// Execute the operation by passing it to Maintenance.Send
store.Maintenance.Send(configureArchivalOp);

Syntax:

public ConfigureDataArchivalOperation(DataArchivalConfiguration configuration)
public class DataArchivalConfiguration
{
public bool Disabled { get; set; }
public long? ArchiveFrequencyInSec { get; set; }
public long? MaxItemsToProcess { get; set; }
}
ParameterTypeDescription
Disabledbooltrue - archiving is disabled for the entire database (default).
false - archiving is enabled for the database.
ArchiveFrequencyInSeclong?Frequency (in seconds) at which the server scans for documents scheduled for archiving. Default: 60
MaxItemsToProcesslong?The maximum number of documents the archiving task will process in a single run (i.e., each time it is triggered by the configured frequency). Default: int.MaxValue

Enable archiving - from the Studio

Enable archiving

  1. Go to Settings > Data Archival.
  2. Toggle on to enable data archival.
  3. Toggle on to customize the frequency at which the server scans for documents scheduled for archiving.
    Default is 60 seconds.
  4. Toggle on to customize the maximum number of documents the archiving task will process in a single run.
  5. Click Save to apply your settings.