kdunlop

Archive Restore Tool

Discussion created by kdunlop on May 8, 2017
Latest reply on Sep 5, 2017 by kdunlop

So, you been using geodatabase archiving to keep a history of your data's changes.  But you need to make a change to the feature class that requires archiving/versioning to be turned off or worst, you need to change a different feature class in the same data set.  You turn off, archive, make the change, and go to turn it back on.  Well poopy, your old archive history can't be reconnected and it is in a separate feature class.  And there is no tool to restore it.

 

That was the issue I was facing with several of my feature classes.  In addition, with a near future database vendor switch, I was looking at losing all my archive history.  So I wrote a this tool, the Archive Restore, to put the records in the old archive history back into the current archive history.  

 

Both the old archive feature class and parent feature class must resided in the same SDE database under the same data owner. Versioning and archiving on the parent feature class must be enabled for this tool to work. Old archive records with no end (current features at the time archiving was turned off), will receive the end date of when the archive was turned back on.

 

This tool allows for the addition and removal of fields. In the case of where a field is removed from the parent feature class, the field data from the old archive will not be copied over. In the case of an addition, the new field will be left null.

 

The old archive feature class and records inside it are not deleted during this process.  It must be manually deleted after the tool has finished.  This way you can keep it if you want.

 

This tool was written in python using Arcpy for ArcGIS 10.4.1.  I turned it into a ArcToolbox script so people who have limited python experience can still use it.  It has been tested against Oracle and Postgres.  I hope to test it against SQL Server in the near future.  If you use any other databases, feel free to provide any changes you need to make them work.

 

I strongly suggest testing this on some test data before running on your live production database.  While I have tested in our environment, I can't guarantee that it will work in every environment.  Once the old archive records are added to the new archive, they can't be removed without using SQL on the back end.  Use at your own risk.

 

Please let me know how it worked for you and your data.  I hope it helps.

Outcomes