delete from sde.SDE_process_information where start_time < (select getdate() - 1)
It may be best to delete the entries from the 'sde.sde_process_information' table. What database are using (Oracle, SQL Server, PostgreSQL,...)?
Thanks for the tip, Jake. I've been familiar with this table but didn't know if it was safe/acceptable to just delete rows for old connections or if I needed to go the sdemon -o kill route.
You can execute the following cleanup procedure to purge those rows if it is a concern (but the software will do it when it needs to anyhow) so you do NOT need to shutdown your ArcSDE instance -
set SERVEROUTPUT ON
DECLARE
CURSOR process_list IS
SELECT sde_id, owner, nodename FROM sde.process_information;
lock_name VARCHAR2(30);
lock_handle VARCHAR2(128);
lock_status INTEGER;
cnt INTEGER DEFAULT 0;
BEGIN
FOR check_locks IN process_list LOOP
lock_name := 'SDE_Connection_ID#' || TO_CHAR (check_locks.sde_id);
DBMS_LOCK.ALLOCATE_UNIQUE (lock_name,lock_handle);
lock_status := DBMS_LOCK.REQUEST (lock_handle,DBMS_LOCK.X_MODE,0,TRUE);
IF lock_status = 0 THEN
DELETE FROM sde.process_information WHERE sde_id = check_locks.sde_id;
DELETE FROM sde.state_locks WHERE sde_id = check_locks.sde_id;
DELETE FROM sde.table_locks WHERE sde_id = check_locks.sde_id;
DELETE FROM sde.object_locks WHERE sde_id = check_locks.sde_id;
DELETE FROM sde.layer_locks WHERE sde_id = check_locks.sde_id;
cnt := cnt + 1;
dbms_output.put_line('Removed entry ('||check_locks.sde_id||'): '||check_locks.owner||'/'||check_locks.nodename||'');
END IF;
END LOOP;
DELETE FROM sde.process_information WHERE sde_id NOT IN (SELECT sde_id FROM sde.process_information);
DELETE FROM sde.state_locks WHERE sde_id NOT IN (SELECT sde_id FROM sde.process_information);
DELETE FROM sde.table_locks WHERE sde_id NOT IN (SELECT sde_id FROM sde.process_information);
DELETE FROM sde.object_locks WHERE sde_id NOT IN (SELECT sde_id FROM sde.process_information);
DELETE FROM sde.layer_locks WHERE sde_id NOT IN (SELECT sde_id FROM sde.process_information);
COMMIT;
dbms_output.put_line('Removed '||cnt||' entries.');
END;
/
This script is also beneficial for cleaning out the process_inforamation table.
Unfortunately I had to remove the "answered". While you can remove the database reference to the user and remove him from the list of "Sdemon -o info -I users". Deleting the line from the database does NOT remove the GSRVR.EXE that the user is using. Eventually you get enough of them and SDE refuses any more connections -- Even if it says you only have 12 users on the instance.
Sorry Jake, but your solution doesn't work.
Brent