[GIS] utomated way of releasing all ArcSDE layers locks

arcgis-9.3arcgis-desktopenterprise-geodatabase

We have an issue where users do not close ArcGIS and layers get locked, and sometimes this affects our nightly updates for some of the layers. I know you can individually remove a lock using the ArcSDE command (which we do), but does anyone know of a way I can create a script that can be run every night to get rid of the locks?

We are running ArcSDE 9.2 and ArcGIS Desktop 9.3.1.

Best Answer

For this scenario I run the sdemon command from a python script using the following:

import subprocess
#Kill all ArcSDE connections
subprocess.call('sdemon -o kill -t all -u <sdeadminusername> -p <password> -N', shell=True)


#Kill all Direct Connections, (ArcGIS 10.0 only)
subprocess.call('sdemon -o kill -t all -i sde:sqlserver:SERVERNAME-u <sdeadminusername> -p <password> -D sde -N', shell=True)