Unregister Replication via Arcpy and ArcToolbox Tool

5935
14
06-01-2013 10:47 AM
Status: Already Offered
Labels (1)
KirkHayer
Occasional Contributor

From time-to-time, one needs to re-create Replication.  I use ModelBuild when creating Replications to document what is being replicated, etc.  Then when it comes to needing to re-create a Replica, I have a model (or script, if exported to Python) to readly run... the only problem is that at 10.1, there are not tools (ArcToolbox or Arcpy) that allow one to "unregister" the exiting Replicas in the Source and Target GDBs.

Please consider creating tools to "Unregister" Replicas so one can automate the process of re-creating Replicas and not have to "Unregister" then manually!

14 Comments
stevecater1

The functionality to delete multiple replicas needs to be implemented asap in the database tool set. In cases where you have 100 or more replicas having to manually delete them one by one is extremely tedious.

pfoppe
by MVP

Vote Up!  We are having challenges managing this as well and are looking for automation options.  Not having access in arcpy is troublesome...  

It is further challenging just making an API call to the REST endpoint as the account that makes that call has to be the user that owns the replica OR a full site-wide ArcGIS Server administratorUnregister Replica (Feature Service)—ArcGIS REST API: Services Directory | ArcGIS for Developers (I tested this today at least at v10.4.1)

I have not tested it, but I assume the Python API for ArcGIS will also execute the same REST API call and subjected to the same limitation; Either has to be the user that owns the replica OR a full ArcGIS Server admin - arcgis.features.managers module — arcgis 1.5.0 documentation 

I do agree with the behavior of the REST API call as any user should not be able to administer other users replicas.  However, I do not want to setup our scheduled task/windows service (that will monitor and correct this situation) with an account that is a full on ArcGIS Server administrator.  This is a hard situation correcting the situation through the REST API call...

If I had an arcpy command, I could use the back end .sde connection file to a built in SQL "editing" account that ultimately owns the database replica (the editing account in our situation is the account we used to publish the feature service with sync capability). This would support the principal of least privileges and ensure I dont have to be a full administrator to correct this situation (just the true owner of the replica which is the database identity).  

So please provide an arcpy (or Python API call) that we can use to administer the replicas in an automated fashion.  Thanks for the consideration.

DougBrowning

You can use a * and unregister all of them at once.

My question is getting a list of info about them.  arcpy.da.ListReplicas only takes sde and not a URL which is a bummer.

All I can see is the REST interface that was designed in 1995.  My guess is I have to go through REST in a script then parse the results.  That is hard or us since we have a SSL scanner the code gets funky.

A lot of issues are caused by the bug in Field Maps - if you remove a offline area while offline, it does not unregister the replica ever.

thanks a lot

SSWoodward
Status changed to: Already Offered

Thanks for the Idea and comments.

ArcGIS Pro now offers an Unregister Replica GP tool.  I've linked to the documentation below.

Link - Unregister Replica GP Tool

Another user linked to documentation for the ArcGIS API for python, but I noticed the link was dead so I've included a link to the page on the Sync Manager.  This may allow you to more easily list and manage your replicas. 

Link - ArcGIS API for Python - Sync Manager