Unregister Replica (Data Management)

Summary

Unregisters a replica from an enterprise geodatabase.

Usage

  • This tool must be run 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.

  • Ensure that you no longer need to use the replica before running this tool. Once the replica is unregistered, it can not 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 service's 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.

Parameters

LabelExplanationData Type
Input Geodatabase

The enterprise geodatabase that contains the replica to unregister.

Workspace
Replica ID or Name

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

LabelExplanationData Type
Updated Geodatabase

The updated geodatabase with the unregistered replica.

Workspace

arcpy.management.UnregisterReplica(in_geodatabase, in_replica)
NameExplanationData 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 unregistered replica.

Workspace

Code sample

UnregisterReplica example 1 (Python window)

Unregister a replica by ID.

import arcpy
arcpy.management.UnregisterReplica("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.management.UnregisterReplica(sdeConnection, replica.name)

Environments

This tool does not use any geoprocessing environments.

Related topics