When is it safe to disconnect an active session from an enterprise geodatabase?

3085
6
Jump to solution
05-25-2016 07:26 AM
LinkElmore
New Contributor III

I need to disconnect users periodically to conduct geodatabase maintenance and programmatically update feature classes, but do not want to risk losing data when it is being actively edited or when a user may have edits in an open version that has not yet been posted.

Esri advises against disconnecting active sessions: Manage geodatabase locks—Help | ArcGIS for Desktop

Use caution when disconnecting users. Esri recommends that you avoid disconnecting active sessions, especially if the connected user is in the process of editing. You should only disconnect users to drop locks if a session was left open even when not being used (for example, over the weekend), if a session is orphaned and locking an object, or if a deadlock situation occurs.

It's pretty clear that being in an edit session is "in the process of editing".  However, what is less clear how this prohibition applies to open versions not in an active edit session but with edits that have not yet posted to their parent version (dbo).  If I disconnect a user with their unposted version open and then run maintenance actions like Compress, Analyze Datasets, and Rebuild Index, do I risk losing the data in their version?

It's easy to see what users are currently connected to an enterprise geodatabase.  The following article details the process of using either ArcCatalog or ArcPy to list users.

Manage connections in SQL Server—Help | ArcGIS for Desktop

How to identify the nature of the connection?  It's all in the lock type.  The following article details the three types of locks: schema, state, and version.

Geodatabase locks—Help | ArcGIS for Desktop

The above article states that version locks indicate an active edit session.  State locks are when a version is simply open.  Clearly, disconnecting a session with a version lock risks data loss.  However, is the same true for State locks?

0 Kudos
1 Solution

Accepted Solutions
AsrujitSengupta
Regular Contributor III
If I disconnect a user with their unposted version open and then run maintenance actions like Compress, Analyze Datasets, and Rebuild Index, do I risk losing the data in their version?

From what I understand, you would like to know if the edits in a Version will be lost if a Reconcile\Post with it's Parent Version has not been done. ---- Yes, if the editor has not yet saved the edits that he had done in that Editing session, they will loose only those edits.

No - As soon as the editor saves their edits....even if you disconnect them..the edits will still not be lost.

View solution in original post

6 Replies
AsrujitSengupta
Regular Contributor III
If I disconnect a user with their unposted version open and then run maintenance actions like Compress, Analyze Datasets, and Rebuild Index, do I risk losing the data in their version?

From what I understand, you would like to know if the edits in a Version will be lost if a Reconcile\Post with it's Parent Version has not been done. ---- Yes, if the editor has not yet saved the edits that he had done in that Editing session, they will loose only those edits.

No - As soon as the editor saves their edits....even if you disconnect them..the edits will still not be lost.

LinkElmore
New Contributor III

So, to sum up, I can safely disconnect sessions with State locks but not with Version locks, without fear of data loss.  Of course, I realize they will have to reconnect to continue working after database connections are re-allowed.  I can bear the inevitable griping about that as long as I've not caused any data loss.  Thanks for your answer, Asrujit.

0 Kudos
JoeBorgione
MVP Emeritus

I've had the same problem over the years.  Strategies I've used; 

Create a block of time for maintenance and ask users to stay off during that time.

Email them and ask them to get off.

Bounce them without emailing.

Each has it's own advantages and disadvantages, as well as varying levels of cooperation.  If we (they) lose edits because they ignore the nice guy emails, it's on them and I just move on...

That should just about do it....
LinkElmore
New Contributor III

I've done all those as well, Joe.  A fourth, more common strategy, is to end up working from home at night when there are no users connected.  This is, of course, not preferable, but often seems to be unavoidable.

0 Kudos
WesMiller
Regular Contributor III
0 Kudos
BirajaNayak
Esri Contributor

Hi Link,

How and what you are updating programmatically. If the feature class are not registered with version, you are good to go by  just removing user and locks. If the feature class is registered as version, then you need to consider version view or compress geodatabase to state_id 0 before updating. 

Thanks,

Biraja

0 Kudos