Problem: After resourcing SDE map layers, MXDs are slow to open


After resourcing MXD layers to change the location ArcMap is pointing to, some MXDs openly very slowly. This is most often seen after setting the data source to a new server.


This is due to a known issue within the software where, instead of replacing the existing reference to the data source, a new reference to the data source is created in addition to the previous reference. This causes ArcMap to store both the old connection information and the new connection information, and ArcMap attempts to make a connection to the old server and then to the new server. If the old server is down or not accessible, ArcMap still tries to make a connection to it, which could slow down performance in the MXD considerably. This process is made even longer if there are a large number of layers that have references to the old server.

Solution or Workaround

To work around this issue, the layers that have been resourced must be copied to a blank MXD. There are two options for moving the layers: Copying layers using a Python script or using the MXD Doctor.

Copying the data using a Python script

If there are large number of MXDs that have been resourced, it may be best to create a Python script to copy the layers over to a blank MXD. To do this, a script similar to the below sample can be used.

import arcpy, os, string, re

def RefreshMxd(folderPath, mxd_temp, mxd_new):
for filename in os.listdir(folderPath):
fullpath = os.path.join(folderPath, filename)
if os.path.isfile(fullpath):
basename, extension = os.path.splitext(fullpath)
if extension.lower() == ".mxd":

mxd_start = arcpy.mapping.MapDocument(fullpath)
newlyrs = arcpy.mapping.ListLayers(mxd_start)
mxd_tmp = arcpy.mapping.MapDocument(mxd_temp)
print fullpath
for df in arcpy.mapping.ListDataFrames(mxd_tmp):
for lyr in newlyrs:
print "\t"+ lyr.name, lyr.dataSource
arcpy.mapping.AddLayer(df, lyr, "BOTTOM")
print "Added layer {0}".format(lyr)
mxd_tmp.saveACopy(mxd_new + os.sep + filename)

print "Saved mxd at {0}".format(mxd_new)
del df, lyr, newlyrs, mxd_tmp, mxd_start

if __name__== "__main__":
folderPath = r"C:\Existing_MXDs"
mxd_temp = r"C:\Users\chri6962\Desktop\Blank.mxd"
mxd_new = r"C:\MXD_Fixed"
if not os.path.exists(mxd_new):
RefreshMxd(folderPath, mxd_temp, mxd_new)

Fixing the data using the MXD Doctor

1. To fix the old references using the MXD Doctor, launch the program from Start > All Programs > ArcGIS > Desktop Tools > MXD Doctor.

2. When the program launches, click the browse button under the Diagnosis tab.
3. After specifying the MXD, click the Treatment tab. Under the Treatment tab, click Fix Document. This creates a new MXD.