<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Replace data sources from one sde to another in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705609#M2343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jbarrette&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the name of the dataset changes, you must use layer.replaceDataSource (or table.replaceDataSource).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Updating_and_fixing_data_sources_with_arcpy_mapping/00s30000004p000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Updating_and_fixing_data_sources_with_arcpy_mapping/00s30000004p000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a sample from the second link under the section called "A feature class is renamed".&amp;nbsp; In your example, "Highways" would be replaced by "BBB.Roads" or just "BBB".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for lyr in arcpy.mapping.ListBrokenDataSources(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("DATASOURCE"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.dataSource == r"C:\Project\Data\Transportation.gdb\MajorRoads":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource(r"C:\Project\Data\Transportation.gdb", "FILEGDB_WORKSPACE", "Highways")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.name = "Highways"
mxd.saveACopy(r"C:\Project\Project2.mxd")
del mxd
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:39:04 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-12T05:39:04Z</dc:date>
    <item>
      <title>Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705604#M2338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: keoe&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have moved som data from one ArcSDE-geodatabase to another. In the new geodatabase the feature classes has new owner. With the code I have change to a new connection file but how to change the owner? The feature classes has the same name as before&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;path = u'C:/temp/Test/'

for dir, subdirs, files in os.walk(path):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if f.endswith('.mxd'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = os.path.join(dir, f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print filename
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(filename)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.findAndReplaceWorkspacePaths(r"C:\CONNECTIONS\OLD_CONNECTION.SDE", r"C:\CONNECTIONS\NEW_CONNECTION.sde", False)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:38:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705604#M2338</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T05:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705605#M2339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jbarrette&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume you are not trying to change the owner of the data, you are simply changing the user/password info associated with the connections file.&amp;nbsp; Your new connection file should have that new info.&amp;nbsp; Is it not working?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At 10.04 SP4 we fixed and issue (NIM075806) where arcpy.mapping mxd.replaceWorkspaces fails when moving from one workspace to a different workspace when the "to" workspace is not the owner user account.&amp;nbsp; A work around is to do the repair in a two step process: 1) go from owner on workspace1 to owner on workspace2 and then 2) go from owner on workspace2 to user on workspace2.&amp;nbsp; In other words, make one change at a time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure this is your issue if you are trying to set the user to be the owner.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is some code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
connection1 = SQLasOwner
connection2 = OracleAsOwner
connection3 = OracleAsuser
mxd = arcpy.mapping.MapDocument(relPath + r"\SQLServer.mxd")
mxd.replaceWorkspaces(connection1, "SDE_WORKSPACE", connection2, "SDE_WORKSPACE")
mxd.replaceWorkspaces(connection2, "SDE_WORKSPACE", connection3, "SDE_WORKSPACE")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:38:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705605#M2339</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T05:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705606#M2340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does ESRI have a tentative date of when service pack will be available to all users?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this push back the date of release of ArcGIS v10.1?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your feedback is greatly appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 13:50:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705606#M2340</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-01-12T13:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705607#M2341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jbarrette&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;10.0 SP4 and the 10.1 release are really independent of one another.&amp;nbsp; Esri will often produce SPs for releases older than the current release.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SP4 and 10.1 PreRelease will coincidently both be available later in Q1.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 13:38:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705607#M2341</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-01-13T13:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705608#M2342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I assume you are not trying to change the owner of the data, you are simply changing the user/password info associated with the connections file.&amp;nbsp; Your new connection file should have that new info.&amp;nbsp; Is it not working?&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;At 10.04 SP4 we fixed and issue (NIM075806) where arcpy.mapping mxd.replaceWorkspaces fails when moving from one workspace to a different workspace when the "to" workspace is not the owner user account.&amp;nbsp; A work around is to do the repair in a two step process: 1) go from owner on workspace1 to owner on workspace2 and then 2) go from owner on workspace2 to user on workspace2.&amp;nbsp; In other words, make one change at a time.&lt;BR /&gt;&lt;BR /&gt;I'm not sure this is your issue if you are trying to set the user to be the owner.&lt;BR /&gt;&lt;BR /&gt;Here is some code:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
connection1 = SQLasOwner
connection2 = OracleAsOwner
connection3 = OracleAsuser
mxd = arcpy.mapping.MapDocument(relPath + r"\SQLServer.mxd")
mxd.replaceWorkspaces(connection1, "SDE_WORKSPACE", connection2, "SDE_WORKSPACE")
mxd.replaceWorkspaces(connection2, "SDE_WORKSPACE", connection3, "SDE_WORKSPACE")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Jeff&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I clarify with an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In database1 the name of the featureclass is AAA.roads&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In database2 the name of the same featureclas is BBB.roads&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I handle this woth python?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:39:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705608#M2342</guid>
      <dc:creator>KlasÖstergren</dc:creator>
      <dc:date>2021-12-12T05:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705609#M2343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jbarrette&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the name of the dataset changes, you must use layer.replaceDataSource (or table.replaceDataSource).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Updating_and_fixing_data_sources_with_arcpy_mapping/00s30000004p000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Updating_and_fixing_data_sources_with_arcpy_mapping/00s30000004p000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a sample from the second link under the section called "A feature class is renamed".&amp;nbsp; In your example, "Highways" would be replaced by "BBB.Roads" or just "BBB".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for lyr in arcpy.mapping.ListBrokenDataSources(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("DATASOURCE"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.dataSource == r"C:\Project\Data\Transportation.gdb\MajorRoads":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource(r"C:\Project\Data\Transportation.gdb", "FILEGDB_WORKSPACE", "Highways")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.name = "Highways"
mxd.saveACopy(r"C:\Project\Project2.mxd")
del mxd
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:39:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705609#M2343</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T05:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705610#M2344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have to use mxd.saveACopy(r"C:\Project\Project2.mxd") in order for this script to replace the datasource?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to create a similar python script, but I do not want to create an additional copy of the file as users could have short-cuts on their desktops to the mxd which would now be broken.&amp;nbsp; Can I just overwrite the existing mxd instead of creating a new mxd?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your feedback is greatly appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 18:27:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705610#M2344</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-01-17T18:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data sources from one sde to another</title>
      <link>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705611#M2345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jbarrette&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Use mxd.save() instead.&amp;nbsp; Saving is not necessary for repair to work.&amp;nbsp; It is possible to repair on the fly, print, export, etc and then not save changes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 19:40:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/replace-data-sources-from-one-sde-to-another/m-p/705611#M2345</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-01-17T19:40:17Z</dc:date>
    </item>
  </channel>
</rss>

