I have created a script and tool for the following to share with the community. However I get the following error when I run it from a python IDE Traceback (most recent call last):
File "C:\Python27\ArcGIS10.6\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "Z:\replicationscript\replicationScript.py", line 31, in <module>
arcpy.SynchronizeChanges_management(sdeConnection, in_replica, replicaGDB1, sync_direction)
File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\management.py", line 1466, in SynchronizeChanges
raise e
ExecuteError: ERROR 000582: Error occurred during execution.
When I run the script in in a python window in ArcGIS, it works. Thinking that, I created a tool where I can add in the different SDE connections in but get the same result. However like the usual ESRI documentation, there is not much on it and what I noticed in ArcGIS that it had to do with the Global ID setup and copying the replica to the server which I don't think it is the case because there would probably be issues when I ran it in the python window in ArcGIS Please let me know what I am doing wrong, I have copied in my script that is not associated with the tool
import arcpy, os
sdeConnection = "Database Connections\\GTI_PUB_UTM_editor_dbst01.sde"
replicaGDB1 = "\\\\executive\\dfs\\DOT DOH D1 Shared\\GIS Database\\GTI_PUB_UTM.gdb"
replicaGDB2 = "\\\\executive\\dfs\\DOT DOH D9 Shared\\GIS Database\\GTI_PUB_UTM.gdb"
replicaGDB3 = "\\\\executive\\dfs\\DOT DOH D10 Shared\\GIS Database\\GTI_PUB_UTM.gdb"
replicaGDB4 = "C:\\Users\\e087607\\Desktop\\d2\\GTI_PUB_UTM.gdb"
sync_direction = "FROM_GEODATABASE1_TO_2"
#Block all connections
arcpy.AcceptConnections(sdeConnection, False)
# Find Replica names
for repName in arcpy.da.ListReplicas(sdeConnection):
ListFC = repName.name
# Synchronize Changes with district 1
if ListFC == "DBO.D1_Replica":
in_replica = ListFC
arcpy.SynchronizeChanges_management(sdeConnection, in_replica, replicaGDB1, sync_direction)
print "Data has been replicated to District 1 GTI_PUB_UTM"
# Synchronize Changes to District 9
elif ListFC == "DBO.d9replica":
in_replica = ListFC
arcpy.SynchronizeChanges_management(sdeConnection, in_replica, replicaGDB2, sync_direction)
print "Data has been replicated to District 9 GTI_PUB_UTM"
# Synchronize Changes to District 10
elif ListFC == "DBO.D10_Replica":
in_replica = ListFC
arcpy.SynchronizeChanges_management(sdeConnection, in_replica, replicaGDB3, sync_direction)
print "Data has been replicated to District 10 GTI_PUB_UTM"
# Synchronize Changes to District test geodatabase
elif ListFC == "DBO.test_replica1":
in_replica = ListFC
arcpy.SynchronizeChanges_management(sdeConnection, in_replica, replicaGDB4, sync_direction)
print "Data has been replicated to D2"
# Reconnect Users
arcpy.AcceptConnections(sdeConnection, True)
Thanks,
Andrew