Is there any "Geodatabase in use" checking software out there?

1967
6
07-30-2015 09:46 AM
Highlighted
MVP Frequent Contributor

I was wondering if there are any ESRI or third-party software/solutions out there that would could be used to automatically track whether a (non-enterprise) File or Personal Geodatabase was in use, with the idea of avoiding file corruption and lock issues when two or more people accidentally try to use the geodatabase at the same time.  While we do have an Enterprise Geodatabase (SDE) here, we still rely on many file and personal geodatabases outside SDE on the server for various tasks and multiple people need to access them.

What would be optimal is a checking process that activates when a second person tries to access a geodatabase that is in use that would warn them that it is in use and who the current user was.  Something smoother than manually having to go to the geodatabase in Windows Explorer and looking for lock files (and then trying to match the computer name listed as part of the lock file name with a user).

srlock file.jpg

Is there any software/solution out there like this?

Thanks,

Chris Donohue, GISP

Reply
0 Kudos
6 Replies
Highlighted
MVP Frequent Contributor

OK, you Developers - I have a challenge for you.  Here's a product that many GIS people could use.

To quote Monty Python:

"Bring us a shrubbery!, er, I mean, a 'Geodatabase-Checking Program'!"

Chris Donohue, GISP

Highlighted
Regular Contributor

Sure! How about:

def gdbInUse(input_file_geodatabase):

    """

    Determine whether any lock files exist in a file geodatabase

    Returns boolean output - True or False

    """

    arcpy.env.workspace = input_file_geodatabase

    lockList = arcpy.ListFiles("*lock*")

    if lockList:

        return True

    else:

        return False

? I'm thinking this could then be implemented in a script tool or extension using ArcObjects.

Update: for an individual dataset, arcpy has a handy tool called Test Schema Lock that will return True if a schema lock can be acquired for a feature class, feature dataset, or table.

Disclaimer: I'm not sure how this would work with personal geodatabase but I believe a similar method could be used to identify the record locking file that appears in the same folder as the .mdb when it is in use. I forget the extension for that type of file but have noticed it before when looking at a personal geodatabase in Windows explorer.

Micah

PS You had me at shrubbery.

Highlighted
MVP Regular Contributor
I'm not sure how this would work with personal geodatabase

The solution is to stop using Personal Geodatabases!

Highlighted
Regular Contributor

Zing!!! Love it. We just moved a whole Bureau off of them.

Reply
0 Kudos
Highlighted
MVP Frequent Contributor

Thanks for posting that Micah.  It has possibilities.

It looks like this could be handy not just as a standalone script tool but as a check process to build into modelbuilder (or a python equivalent) prior to it trying to process datasets so as to head off any conflicts.

Chris Donohue, GISP

Reply
0 Kudos
Highlighted
MVP Regular Contributor

If it doesn't have to be on the entire geodatabase, you could try using TestSchemaLock() on the feature class or table before attempting to do something with it.