[GIS] ArcPy Changing Spatial Database Connection

arcmaparcpyenterprise-geodatabase

We have moved some servers which had ArcGIS application and SDE on it to another server and the IP has changed. Now when I want to open my .mxd file it tries to connect to remote SDE with old connection settings and opening old works but really takes long time, consequently I want to change my database connection in .mxd file.

Is there any fast way to change SDE settings programmatically with not opening the .mxd file in ArcMap?

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Users\arc\Desktop\election2011.mxd")
brklist = arcpy.mapping.ListBrokenDataSources(mxd)
print brklist

Above code really takes along time. without this code i can open my .mxd file with same time above code and can change manually…

Best Answer

We had this same problem with really sucks. The MXD tries for 15 minutes to find the old server before giving up. We got around this problem by giving a new server the old SDE server's IP address. The new server has nothing to do with GIS or databases. However, the MXD tries to connect then gives up right away once it sees that the SDE data source is no longer there. The MXD opens quickly with the broken layer icons so you can fix the data source on your own.

Related Question