- Local time
- Yesterday, 18:36
- Joined
- Feb 28, 2001
- Messages
- 29,015
If client stop with any error non recoverable, there is not a 'close' for that client
I found that it was impossible to prevent the "ugly" close but I solved that by considering that (a) no session could last more than 12 hours (by employment rules and government regulations) and (b) the nature of the DB in question was not something that a person would open twice from the same workstation at the same time.
For the big Navy DB, when a user launched the session, I took the domain and workstation IDs from some API calls and appended to a "Who's Logged In" table. If you later exited normally, ALL of your open sessions were closed. If you launched and had some open session entries still hanging around, they were closed with a special code. And as the DB Admin, I had a routine I could run to terminate session records greater than some time limit which I could choose from 12 or 24 hours old, again with a special code. When we had a bollixed-up (bad) exit case, I also had limited extra rights to terminate user sessions on the server in question, which I could identify because I knew the user's domain login name and the ID of the computer. That way I could usually get away without having to warn users of an imminent emergency shutdown because I could kill the offending session.
I didn't erase the records of usage. I had session logs (which the Navy was very insistent on having) showing user, computer, enter and leave time logs, and termination code - all of which got archived on a regular basis. If an abnormal close was used to close a session, codes showed how the session ended - normal exit, multi-session overlap exit, or time-limit exit. That let the Navy have all sorts of useless but pretty usage charts that correlated with when things were done most often. And the username/computer ID combo gave me what I needed to terminate sessions selectively.