How do I help users adjust map projects to a new ArcServer?

2730
5
02-20-2014 01:51 PM
PaulHuffman
Occasional Contributor III
I'm planning to get a new server soon and move my ArcServer functions to the new hardware. Some of my power Arc Desktop users are wondering how this is going to effect all the map projects they have that use connections that are pointed at the old server.  They are dreading going into all their map projects and finding a bunch of red ! in their TOCs and having to correct the source on each one.

I'm wondering if there is a trick to making this transition more seamless. Is it possible to name the new server, AS instance, and databases exactly the same so that the Desktop users don't have to change a thing?  Can I get away with it? 

Or are there any tricks to automate the change of source in the map projects of the client machines?  Seems like I remember long ago, so long that it might have been written in Avenue, an Arc user script that was able to hack the project files, find each instance of a source string and replace it with the new path.  Is there anything like that in user scripts for Desktop 10.x that could update source paths for any project in a directory or in a PC?
0 Kudos
5 Replies
MichaelVolz
Esteemed Contributor
You can use python to update SDE connection properties that would change with a new server.

There are various methods you could use.  If you are going from 1 database to another 1 on a different server, FindandReplaceWorkspacePath might work for you.
0 Kudos
PaulHuffman
Occasional Contributor III
Why am I having trouble getting your attachment today? All I get is "You don't have permission to access /attachments/ on this server." even though I'm logged in.  Is it because the extension is .py?
0 Kudos
MichaelVolz
Esteemed Contributor
I received the same error when trying to open that file.

Here is a sample script to use replacedatasource of an SDE connection

import arcpy
import os
arcpy.env.overwriteOutput=True

###test create connection file and replace data source####
SDE_file_path = r"C:\incidents\xx"
Directory_Search = r"C:\incidents\xx\mxd"
#SDE_file_path = r"\\miaoer\newMXD"

arcpy.CreateArcSDEConnectionFile_management(SDE_file_path, "testsde.sde", "user", "sde:oracle11g:orcl", "", \
                                           "DATABASE_AUTH", "sde", "sde", "SAVE_USERNAME", "SDE.DEFAULT",  "SAVE_VERSION")
print "done creating ArcSDE connection file!"


for root, dirs, files in os.walk(Directory_Search):
    fListLength = len(files)
 
    for f in files:
        print "\n\n"
        print fListLength
        fListLength = fListLength-1
        if (f.endswith(".mxd")):           
            #problem_File = check_File(f)
            full_path = root + "\\" + str(f)
            print full_path
            mxd = arcpy.mapping.MapDocument(full_path)
   dfs = arcpy.mapping.ListDataFrames(mxd)
   for df in dfs:
    for lyr in arcpy.mapping.ListLayers(df):
     lyr.replaceDataSource(SDE_file_path +r"\testsde.sde", "SDE_WORKSPACE")
     print lyr.name
            #mxd.saveACopy(SDE_file_path +r"\testNew.mxd")
            mxd.save()
               
print "finish replace data source"
0 Kudos
NidhinKarthikeyan
Regular Contributor II
Why am I having trouble getting your attachment today? All I get is "You don't have permission to access /attachments/ on this server." even though I'm logged in.  Is it because the extension is .py?


You can try this.
0 Kudos
PaulHuffman
Occasional Contributor III
nidhinkn -  why is that command line step to copy connection file from toolbox to Catalog needed?
0 Kudos