How to unlock SDE layers?

2634
8
09-28-2020 05:56 AM
VincentLaunstorfer
Occasional Contributor III

Hi,

I have an Enterprise GDB on ArcGIS Server 10.6.1 containing feature classes I own which I published on Portal for ArcGIS. Because layers are published, a lock is on these layers, in ArcGIS Pro 2.6.1, I cannot edit anything, neither rename and/or delete. I suspect the lock is caused by the Feature Service on ArcGIS Server... I am not Admiistrator.

I read some documentation about this issue:

Disable schema locking on a map service—ArcGIS Server | Documentation for ArcGIS Enterprise 

Start and stop services—ArcGIS Server | Documentation for ArcGIS Enterprise 

And a similar problem:

https://community.esri.com/thread/250719-sde-locks 

In ArcGIS Pro, how can I list the locks on my SDE layers? If the lock is due to ArcGIS Server, how can I stop the Feature Service in order to perform some edits in name and/or schema?

In my workflow, I would like to simply replace a feature layer with a new version of that feature layer and hopefully the Feature Service will point to the new feature layer...

Thanks

0 Kudos
8 Replies
Robert_LeClair
Esri Notable Contributor

Vincent - to see where the locks are, you can view them via the workflow listed here.  Once you have that info, it should help you in determining where to release the lock.

VincentLaunstorfer
Occasional Contributor III

Thanks. It is a good start...

If I right-click a layer, unfortunately, options to View User or Disconnect are greyed out. Once you know there are existing locks, if you suspect a Feature Service locking a layer after publishing, apart from an Administrator, as I layer owner, can I stop the service to remove temporarely the lock? Otherwise, publishing layers can cause problems for database administration...

Another idea, is there a better workflow to refresh a layer on which a Feature Service is based? I mean replacing the data source by a brand new layer with same schema and name...

0 Kudos
Robert_LeClair
Esri Notable Contributor

You're welcome!  So dataset and version owners can view locks for what they own.  Geodatabase administrators can view all locks and disconnect locks.  Your GDB Admin can release the locks (or stop the service) so one can publish/edit/etc...

Since the underlying data is an Enterprise geodatabase you have the option to reference registered data (the eGDB feature class) OR copy the data to the server.  If you copy the data to the server then you have your eGDB production feature class is not connected to the feature service (it's standalone as it were.)  That may be the way you want to go perhaps?

From the Help -  "Sharing to ArcGIS Enterprise with the Reference registered data option requires the privilege to publish server-based layers. Sharing to ArcGIS Enterprise with the Copy all data option or sharing to ArcGIS Online requires the privilege to publish hosted feature layers."

VincentLaunstorfer
Occasional Contributor III

Thanks again. It is all really helpful and confirm what I thought... Registering data to portal layers creates locks which are not convenient whereas copy data to a hosted feature layer do not create locks but data are not in sync. If I was automating hosted layer refresh in ModelBuilder and/or Python, is there a geoprocessing tool to perform the right-click -> Sharing -> Overwrite Web Layer? I need a workflow to regularly refresh a hosted feature layer...

0 Kudos
Robert_LeClair
Esri Notable Contributor

You're welcome!  Yes, there is a workflow to overwrite web layers.  You can that workflow here.  I don't see this as a GP tool but you could create a Task to do this workflow if you like.

0 Kudos
VincentLaunstorfer
Occasional Contributor III

It looks like I need to investigate Task...

In the Toolbox, I can only find Server Tools -> Publishing -> Replace Web Layer but it is not quite the same as Overwrite Web Layer and do not apply to feature layer apparently.

Would Task run in a scheduler?

Need to find a compromise in my workflow...

0 Kudos
Robert_LeClair
Esri Notable Contributor

It appears that one cannot schedule a task like you can with ModelBuilder models exported out to a Python script.  I searched to see if there's a way to export a Task to a Python script but don't see anything.  From the internals, it's stated that the intent of a Task is to be interacted with the user directly.  So it does not appear that one can automate a task.  I wonder if one could write a Python script to do this?

0 Kudos
ShitalDhakal
New Contributor II

Hi just wondering if you found a solution to this? I have a csv that I geocode every morning. Since the layer has been published in federate portal, there is always a lock. Next morning, my python script cannot work properly because of the lock. 
I would appreciate a solution to this.