Removing Lock on Feature Dataset within FGDB

3370
6
Jump to solution
04-21-2021 07:37 AM
Labels (1)
ZacharyUhlmann1
Frequent Contributor

Hi.  Finally fed up with turning on and off again.  It's ArcMap, but I imagine the same issues arise in ArcPro.  Simply starting an edit session to edit some feature classes within a file geodatabase and every feature class in my Table of Contents within a particular FGDB is 'Not Editable'.  In this instance, I had just performed a Union using arcpy (arcpy.Union_analysis(...)) on feature classes within the now locked feature dataset and the output also was sent there.  I realize this is a basic question, but I cannot find decent information on StackExchange or elsewhere.  The classic ESRI monopolization of Google searches where every Google search result is a general ESRI information page on schema locks but no solutions.  So yes, how do I remove unnecessary locks that ArcMap failed to remove after geoprocessing?  Thanks.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

Where are you running the code?  In a separate IDE? it may be persisting the lock if it is still open.

ArcGIS Pro's python window and or their Jupyter Notebooks or a separate IDE (Spyder in my case) doesn't seem to have these issues.

That leave ArcMap's handling of locks.  Trying the same process in Pro would resolve whether that is the case.

Sorry... Tech Support probably has more insight.


... sort of retired...

View solution in original post

0 Kudos
6 Replies
DanPatterson
MVP Esteemed Contributor

If there is a lock, then there is a reason (being used by something else for instance).

Try copying the featureclass to a new file geodatabase and see if the result has a lock


... sort of retired...
ZacharyUhlmann1
Frequent Contributor

Hi Dan.  I'm the only one accessing the FGDB - it's definitely occurring RIGHT after performing some geoprocessing task.  I call 

 

arcpy.Union_analysis(['feature_1', 'feature_2'], 'path/to/gdb/soon_to_be_locked_dataset/feat1_feat2_union')

 

The tool runs, out comes feat1_feat2_union.  At which point I want to inspect and delete one or two of the features.  So I drop down Editor --> Start Editing --> feat1_feat2_union and ALL feature classes within the soon_to_be_locked_dataset present in my Table of Contents are locked ("This data is not editable"), but NOT feature classes within the gdb residing outside of the soon_to_be_locked_dataset.  So I "turn off and turn on again".  Actually just open a new blank map to remove lock, then reopen the map I was working on.  Lock disappears.  I've tried refreshing the gdb (F5) to no avail.     ArcMap 10.6.1.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Where are you running the code?  In a separate IDE? it may be persisting the lock if it is still open.

ArcGIS Pro's python window and or their Jupyter Notebooks or a separate IDE (Spyder in my case) doesn't seem to have these issues.

That leave ArcMap's handling of locks.  Trying the same process in Pro would resolve whether that is the case.

Sorry... Tech Support probably has more insight.


... sort of retired...
0 Kudos
ZacharyUhlmann1
Frequent Contributor

Running the code in the Python (aaaaahhh, about to butcher the terminology!) Console (Window?) directly in ArcMap.  After this mxd project I'm moving to Pro.  I think turning on and off is honestly my quickest solution.  Other solutions I've found are more time-consuming than on/off.  File Geotabase Compacting seems to be an option - which I really need to do anyways.  Seems going into File Explorer and deleting locks within the gdb folder is more risk than it's worth.  For shapefiles I don't care.  Well, thanks Dan.

0 Kudos
WilliamRice
Frequent Contributor

As Dan said above, some other application could be causing the lock.  ArcCatalog often has to be closed to remove a lock on the fgdb.  If the fgdb is  on a network drive,  then backup software can put locks on the fgdb if your IT group are running backups during the day.  A new problem we have started encountering this past year is from orphan ArcMap.exe processes left running after exiting ArcMap.  To remove locks on the fgdb or other databases, we are often having to go into the Windows Task Manager to end these orphan ArcMap processes.

0 Kudos
ZacharyUhlmann1
Frequent Contributor

Hi William.  Thanks for the response.  I'm slowly transitioning to Pro, and Dan indicated that ArcMap (as opposed to Pro and separate IDEs) is notorious for nefarious locks.  Once I'm working on a less consequential dataset I will attempt the File Explorer --> delete lock file route, but for now that scares me.  So I'll continue to open new map and reopen prior map without closing the program.  That DOES work, just seems silly.  Didn't realize the orphan ArcMap Processes situation - thanks for that tidbit!  I'll keep my eyes out for that...

0 Kudos