Hi all,
I have a map service which I am publishing through FlexViewer onto the web.
The service reads data which is updated daily, reading an Enterprise Geodatabase on our ArcServer.
The data is easily updated, and works well. UNTIL someone is reading the data from the web. I keep getting a Schema Lock error (000601).
If I stop the service and remove the user connection from the database "LOCKS" property, it the data is updated with 0 error. So my question is:
How can I stop the map service, whilst the data is being updated?
I plan to do this at 2am, when every one should be offline. I just want to have this as a fail-safe should someone have left their PC on overnight and logged into the web-map.
I can do it manually, however would prefer to do it in an Add-In, which is currently operational.
If this is not possible, then is it possible to remove the Schema Lock?
Again I can remove the DB User manually, however would prefer that all connections to the DB being accessed are cut for the short period data is being fed into the DB.
I am using VS Express 2010, ArcGIS 10.2.2 and ArcServer 10.2.
I am also quite new working with ArcServer and Enterprise DB's, so please bear with me.
Thank you!
K
Rather than looking for a way to remove that lock or stopping and restarting the Map Services, I would suggest that you disable Schema Locking for that Service itself.....no locks will be generated therefore.
Disabling schema locking on a map service:
ArcGIS Help (10.2, 10.2.1, and 10.2.2)
Setting map service properties:
Hi Keagan,
Have you looked at this help document on ArcGIS Server?
---one can utilize ArcGIS server admin rest api to administer server - including stopping and starting services.
Thanks,
Shriram B
Hi K
Why not using python?
A full example here: http://resources.arcgis.com/en/help/main/10.2/0154/0154000005qv000000.htm
You can put python script to run automatically
Have fun
Mody
Hi all,
Thank you.
I will try each of the options and let you know.
regards,
K
you can use also this sdk ArcGIS-Server-Admin-SDK/AdminService.cs at master · skendrot/ArcGIS-Server-Admin-SDK · GitHub
You do not need to stop and restart the service if you perform a truncate and append of the datasource, if that is viable for your scenario. You can create a model to perform the truncate and append and export it out to a python script that you can call from a Windows Scheduled Task at 2am in the morning.
If you need to you can stop or start a service with python ArcGIS admin scripts. Below is a quick example both in 10.2.x and 10.3.x where the parameters are slightly different
10.3.x
C:\Python27\ArcGIS10.3\python.exe C:\Program Files\ArcGIS\Server\tools\admin\manageservice.py -u "username" -p "Password" -s http://"arcgis_server_name" -n "Virtual_Directory_Name"/"Geocode_name".GeocodeServer -o stop
10.2.x
C:\Python27\ArcGIS10.2\python.exe C:\Program Files\ArcGIS\Server\tools\admin\manageservice.py -u "username" -p "Password" -s http://"arcgis_server_name" -t -n "Virtual_Directory_Name"/"Geocode_name".GeocodeServer -o stop
"Username" -your username for AGS admin
"Password" -your password for AGS admin
"Virtual_Directory_Name" - folder where AGS service resides
"Geocode_name" - name of service in this case geocode so GeocodeServer is at end of line
These lines of code can be called from a bat file that can also be called from a Windows Scheduled Task.
Start would be the same except for -o start