Restoring Archived records in bulk

Daniel Grande
Tera Expert

Hello, 

 

I am wanting to archive some historic data. In order to archive the org is asking for a backout plan for the archive. When I run an archive in test and then try to restore the archive it is only allowing me to restore one record at a time. It gives me the option to restore record and related but it still only restores the one record. I archived 189,000 records in test on complete table. Is there a restore the entire archive job that ran and not just individual records? 

 

Thanks

2 REPLIES 2

Moritz5
Tera Contributor

Hi Daniel,
I have just used the following fix script to restore more than 200000 archived e-mail records.

// Define the query to retrieve records from sys_archive_log
var query = "from_tableSTARTSWITHsys_email^to_tableSTARTSWITHar_sys_email^restoredISEMPTY";

// Get a GlideRecord for sys_archive_log based on the query
var archiveLogGr = new GlideRecord('sys_archive_log');
archiveLogGr.addEncodedQuery(query);
archiveLogGr.query();

// Loop through the records and restore each one
while (archiveLogGr.next()) {
    // Use GlideArchiveRestore to restore the record
    var und = new GlideArchiveRestore().restore(archiveLogGr.sys_id);

    // Log the result of the restoration only if it fails
    if (!und) {
        gs.error("Failed to restore record: " + archiveLogGr.getDisplayValue());
    }
}

 

How much time is required to restore 200000 data