<?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 sde commands using the xp_cmdshell utility in sql server 2008 in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670016#M37962</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OS: Windows Server 2008&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;License: EDN Developer &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SDE Version: 9.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SQL Server Version: 2008 SP 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am interested in getting a test environment set up for our GIS database. I want to be able to test new SQL queries, jobs, code, etc. on the GIS data without having to kick everyone off of the system to do it (in production). I have been able to set things up in the Database identically to our production database. The problem is issuing sde commands from the xp_cmdshell utility in SQL Server. I can execute commands successfully from the production server, however when trying the same on the development server I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;USE GIS
GO

DECLARE @SDECom varchar(50)
SET @SDECom = 'sdemon -o info -I users'

EXEC xp_cmdshell @SDECom&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 'sdemon' is not recognized as an internal or external command, operable program or batch file.&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've ruled out the SDEHOME environment variable path because I can execute commands successfully from the DOS command line. I have also ruled out permissions with xp_cmdshell itself because I can execute xp_cmdshell commands not related to sde wouthout any problem. It is the combination of sde commands using the xp_cmdshell utility in sql server. What could possibly be wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:45:28 GMT</pubDate>
    <dc:creator>JohnFell</dc:creator>
    <dc:date>2021-12-12T16:45:28Z</dc:date>
    <item>
      <title>sde commands using the xp_cmdshell utility in sql server 2008</title>
      <link>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670016#M37962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OS: Windows Server 2008&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;License: EDN Developer &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SDE Version: 9.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SQL Server Version: 2008 SP 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am interested in getting a test environment set up for our GIS database. I want to be able to test new SQL queries, jobs, code, etc. on the GIS data without having to kick everyone off of the system to do it (in production). I have been able to set things up in the Database identically to our production database. The problem is issuing sde commands from the xp_cmdshell utility in SQL Server. I can execute commands successfully from the production server, however when trying the same on the development server I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;USE GIS
GO

DECLARE @SDECom varchar(50)
SET @SDECom = 'sdemon -o info -I users'

EXEC xp_cmdshell @SDECom&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 'sdemon' is not recognized as an internal or external command, operable program or batch file.&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've ruled out the SDEHOME environment variable path because I can execute commands successfully from the DOS command line. I have also ruled out permissions with xp_cmdshell itself because I can execute xp_cmdshell commands not related to sde wouthout any problem. It is the combination of sde commands using the xp_cmdshell utility in sql server. What could possibly be wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:45:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670016#M37962</guid>
      <dc:creator>JohnFell</dc:creator>
      <dc:date>2021-12-12T16:45:28Z</dc:date>
    </item>
    <item>
      <title>sde commands using the xp_cmdshell utility in sql server 2008</title>
      <link>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670017#M37963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried executing a "Set" command, to see what the PATH contains?&amp;nbsp; It's possible&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;that the process is stripped of non-essential environment for security reasosns.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried running a batch script from 'xp_cmdshell' with the ArcSDE command inside&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the .BAT file? Might as well tuck a "Set" in there too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Apr 2010 13:27:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670017#M37963</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2010-04-15T13:27:40Z</dc:date>
    </item>
    <item>
      <title>sde commands using the xp_cmdshell utility in sql server 2008</title>
      <link>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670018#M37964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, that information really helped. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I issued the "Set" command using the extended stored procedure xp_cmdshell and it returned environment variables for the machine. The SDEHOME environment variable was not in the returned result. I had recently installed SDE but the server had not been rebooted since them. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Why did the SDEHOME variable work from the DOS shell but not from the xp_cmdshell? Do I need to restart the SQL Server services for it to pick up the environment variable change using xp_cmdshell? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After rebooting the server and issuing the "Set" command from the xp_cmdshell the SDEHOME environment variable was listed among the results and I was able to issue the sde commands that I had wanted. Thanks for your help again!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Apr 2010 19:08:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670018#M37964</guid>
      <dc:creator>JohnFell</dc:creator>
      <dc:date>2010-04-15T19:08:11Z</dc:date>
    </item>
    <item>
      <title>sde commands using the xp_cmdshell utility in sql server 2008</title>
      <link>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670019#M37965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Windows passes environment variables when a process is started.&amp;nbsp; The parent process for&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;xp_cmdshell is the SQL-Server instance, which didn't have the SDEHOME and PATH set&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at the time it started, hence your problem. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, restarting the service should have accomplished the same as a reboot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;nbsp; V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Apr 2010 19:27:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sde-commands-using-the-xp-cmdshell-utility-in-sql/m-p/670019#M37965</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2010-04-15T19:27:18Z</dc:date>
    </item>
  </channel>
</rss>

