Change sde layers path

If you have an .mxd document that has a large number of layers and you have to use another sde database as a source of data, which includes the same feature classes and tables (for instance, when moving from a development to a production server), you might need to change source paths for those layers. In the case of using shapefiles/file-based geodatabases you could just right-click an .mxd document in the ArcCatalog and choose Set Data Source option. Thereafter, you replace the old data source string with the new one. With ArcSDE geodatabases, however, you cannot do that. Below are the instructions on how one can update data source for the layers in an .mxd map document without calling ArcObjects functions.

If you use an application server connection to an sde database (i.e., sde service is running):

1. Create a copy of the .mxd file you have.

2. Go to the Services dialog box (run cmd and type services.msc) and then stop the sde service that is being used for the connection to the .mxd document layers source data.

2. Open the copy of the .mxd file in ArcMap. You will see that links to the source data will be broken. Now you can repair these broken data sources while choosing an sde service and an sde database you want to use for this new .mxd document.

3. Right-click any of the layers in the table of contents > Repair data source. Choose the sde connection that uses the sde database you need.

4. Save the .mxd document.

5. Start the sde service you have stopped before.

If you use direct connection to an SQL Server database (i.e., no sde service is running):

You have several alternatives, two of which are detailed below:

1. You can stop SQL Server process from the Services menu (run cmd and type services.msc).

2. You can prohibit a user to access a certain sde database. Open SQL Server Management Studio > Connect to the instance you use > Security > Logins > choose the login that is being used to establish a connection to the data in an sde database (for example, user “sde”) > right click the login > Properties > Status tab. Deny the permission to connect to the database engine and optionally disable the login.

A quick update: you can specify the server machine where your ArcSDE database resides in the Windows hosts file, so the .mxd document(s) will not be able to connect to the machine and thus the paths will be broken, so you could restore the layer paths without stopping any services.

One thought on “Change sde layers path

  1. problem with this approach is that any field visibility settings you’ve set on layers in that mxd are reset to visible. Imagine now these layers are getting used in a map service and have a number of fields purposely hidden. We have to go on each layer and manually switch them off based on the field visibility settings we had previously set on the original mxd.. a pain. Also tried with arcpy.mapping and replace data sources – same result. Only thing that seems to work in terms of updating data sources and retaining field visibility settings is to right click mxd > set data source(s) > click on the ellipsis (…) for each layer under the new data source tab and manually point to the new data source.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s