Kill direct connect from ArcGIS Desktop 10 clients to ArcSDE 9.3.1

951
2
10-25-2011 03:24 PM
MinaKim
New Contributor
Hi, all.

System info:
ArcSDE 9.3.1 SP1, SQL Server Enterprise 2005 on Windows 2003 Server Enterprise with SP2
ArcGIS Desktop 10 clients with SP1 on Windows XP Professional Edition SP3

Does anyone have trouble killing direct connects from ArcGIS 10 clients to ArcSDE 9.3.1?  I have a stored procedure from John Karagiannis from ESRI that kills direct connects and it had been working fine until we started using ArcGIS Desktop 10 clients.  This stored procedure doesn't work with direct connects from the ArcGIS Desktop 10 clients.  Anyone have any idea? Any feedback would be much appreciated.
Thanks!

Here is the stored procedure that I use to kill direct connect.

USE [GISTEST]
GO
/****** Object:  StoredProcedure [sde].[KILLT]    Script Date: 10/25/2011 18:18:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [sde].[KILLT] -- **Change to match your database settings**

--*************************************************
-- John Karagiannis (ESRI Charlotte) - 2007
-- Procedure kills all sessions listed in the sde_process_information table
--*************************************************

AS
BEGIN

      SET NOCOUNT ON;
   DECLARE @SPID INT
      DECLARE @SID NCHAR(10)
      DECLARE SID_CURSOR CURSOR FOR
      SELECT SERVER_ID
      FROM SDE.SDE_PROCESS_INFORMATION ; -- **Change to match your database settings**
      OPEN SID_CURSOR
      FETCH NEXT FROM SID_CURSOR INTO @SID
      WHILE @@FETCH_STATUS = 0
      BEGIN

            DECLARE @APPID NCHAR(128)
   DECLARE @PID SMALLINT
   SET @APPID = 'SDE:' + @SID
   DECLARE PID_CURSOR CURSOR FOR
   SELECT SPID FROM MASTER.DBO.SYSPROCESSES WHERE PROGRAM_NAME = @APPID
   OPEN PID_CURSOR
   FETCH NEXT FROM PID_CURSOR INTO @PID
   WHILE @@FETCH_STATUS = 0
   BEGIN

    EXEC ('KILL ' + @PID)
    FETCH NEXT FROM PID_CURSOR INTO @PID

   END
   CLOSE PID_CURSOR
   DEALLOCATE PID_CURSOR
            FETCH NEXT FROM SID_CURSOR INTO @SID

      END
      CLOSE SID_CURSOR
      DEALLOCATE SID_CURSOR
      EXECUTE SDE.SDE_PURGE_PROCESSES -- **Change to match your database settings**
END
0 Kudos
2 Replies
MinaKim
New Contributor
After several tries, I've got it to work.  For those having the same issue, here are the steps.

1. Install ARCSDE 10 on your client machine.
2. In SSMS, go to the Security - Logins and give the SDE user on the server to have processadmin.
3. For ARCSDE 10, the sdemon -o kill command now has more parameters to take direct connect.  Use the old parameters to kill SDE connects and use the new parameters (-D for database name, -u for user, -i for direct connect definition) to kill direct connects.

For more information, please refer to the following site.

http://help.arcgis.com/en/geodatabase/10.0/admin_cmds/support_files/serveradmin/sdemon.htm#kill_ex
0 Kudos
MinaKim
New Contributor
Another solution:

run or create a batch file with the following sde command.

sdetable -o truncate -t sde_process_information -u -p -i -s -D
0 Kudos