ArcMap – Updating Links to ArcSDE Geodatabase Feature Classes

arcgis-desktoparcpyconnectionenterprise-geodatabasemxd

I've seen questions about attemting to repair a .mxd file with broken links. What I would like to do is get ahead of this issue and "fix" it before it becomes a problem.

I have my data in an ArcSDE geodatabase. The SDE is being navigated to a new machine in the near future so the database connection properties will change. Is there anything I can do ahead of time to avoid broken links and slow loading maps?

Here is a similar but different question:
How do you deal with (repair/avoid) broken MXD\LYR paths?

Best Answer

If you are on ArcGIS 10, you can use ArcPy to replace connections: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000004p000000.htm (which is one of the answers to question you referenced).

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project_default.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\Project\Connection to Default.sde", 
                                 r"C:\Project\Connection to Version1.sde")
mxd.saveACopy(r"C:\Project\Project_V1.mxd")

At my last job, the network guys created an alias (I think a DNS Alias Record) for the server. From then on, the actual machines could be swapped out and the alias record updated without having to touch the MXD or LYR files. Easy enough as long as the databases were the same (we were all direct-connections) and the connection parameters were the same. If they changed (such as user name or geodb version), I'd need to replace the paths (either manually or with findAndReplaceWorkspacePaths).

Related Question