We have a database maintenance Python script (very similar to this one Esri recommends) and it kills all users with arcpy.DisconnectUser() before performing maintenance operations. This script is executed by Task Scheduler on Windows Server 2012 r2. Our ArcSDE 10.0 run on Oracle 11g on a Linux server. Here is an older, similar discussion that ended in a suggestion to enable TCPKEEPALIVE.
What we've found is that when the script kills all users, all connections in the SDE.Process_Information table go away (as expected) but the associated database/os process for each connection (gsrvr) remains. This is a problem because they build up and eventually hit the limit set in the Oracle initialization parameters. With further testing, we found that running the kill all users SDEMON command locally on the Linux server would kill the connections and clean up all associated gsrvr processes and sessions.
We are currently testing two possible solutions:
- Enable the TCPKEEPALIVE setting to hopefully find and kill the orphaned processes.
- Instead of using arcpy.DisconnectUser(), run the SDEMON command through Plink in Python using subprocess.Popen()
My questions are:
- Is this possibly a bug with SDE/Python?
- Is TCPKEEPALIVE a sensible option to solve this problem?
- With SDEMON depreciation, will the Python Plink command option be a good long-term solution?