Unregister Replica (Data Management)

Summary

Unregisters a replica from an enterprise geodatabase.

Usage

  • This tool must be executed as the replica owner or the geodatabase administrator. For service-based replicas, the replica owner is the database user on which the service processes were run.

  • If the replica has a version associated with it, this tool does not delete the version.

  • Make sure you no longer need to use the replica before running this tool. Once the replica is unregistered, it can no longer be used to synchronize changes.

  • This tool supports replicas created through ArcGIS Desktop or ArcGIS Pro using geodatabase replication or created through a feature service.

  • Replica names and IDs can be obtained using the Manage Replicas pane or from the feature services replicas REST resource.

  • If the feature service from which a replica was created is not accessible or no longer exists, you can use the arcpy.da.ListReplicas Python function to get a list of all types of replicas created in the geodatabase.

Syntax

UnregisterReplica(in_geodatabase, in_replica)
ParameterExplanationData Type
in_geodatabase

The enterprise geodatabase that contains the replica to unregister.

Workspace
in_replica

The name or id of the replica that will be unregistered. If providing the replica name, it must be fully qualified, for example, myuser.myreplica.

String

Derived Output

NameExplanationData Type
updated_geodatabase

The updated geodatabase with the replica unregistered.

Workspace

Code sample

UnregisterReplica example 1 (Python window)

Unregister a replica by id.

import arcpy
arcpy.UnregisterReplica_management("C:\\MyProject\\myConnection.sde", 
                                   "B6F7CAB6-B9E1-4B97-A67C-1499FF59CB7D")
UnregisterReplica example 2 (stand-alone script)

Unregister all replicas in a geodatabase.

# Import modules
import arcpy

# Set local variables
sdeConnection = "C:\\MyProject\\myConnection.sde"

# Loop through all replicas and unregister each one
replicas = arcpy.da.ListReplicas(sdeConnection, True)
for replica in replicas:
    arcpy.UnregisterReplica_management(sdeConnection, replica.name)

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics