Query ArcGIS Services where "Lock Database Schema" is True

4616
6
Jump to solution
02-17-2015 01:06 PM
JoshLehn
New Contributor II

Does anyone know how we can search our services for this parameter, or set the default to false?? These are really hard to find without clicking into each individual service!

 

UPDATE:  Jake showed us how to find them with python, but we are now finding that the Services do not seem to be respecting/modifying the information in the configuration store (even after stop/starting). Has anyone experienced this or know how we might resolve this?

Lock.jpg

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Josh,

One way you could search this is by using Python.  Ex:

import os, json

for root, dirs, files in os.walk(r"C:\arcgisserver\directories\arcgissystem\arcgisinput"):
    for name in files:
        if 'serviceconfiguration.json' in name:
            json_data = open(os.path.join(root, name))
            data = json.load(json_data)
            values = data['service']
            try:
                properties = values['properties']                
                if properties['schemaLockingEnabled'] == 'false':
                    print values['serviceName']
            except:
                pass

View solution in original post

6 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Josh,

One way you could search this is by using Python.  Ex:

import os, json

for root, dirs, files in os.walk(r"C:\arcgisserver\directories\arcgissystem\arcgisinput"):
    for name in files:
        if 'serviceconfiguration.json' in name:
            json_data = open(os.path.join(root, name))
            data = json.load(json_data)
            values = data['service']
            try:
                properties = values['properties']                
                if properties['schemaLockingEnabled'] == 'false':
                    print values['serviceName']
            except:
                pass
JoshLehn
New Contributor II

Awesome code, thank you!

Here is the next puzzler, we're finding that the configuration store does not seem to be updating the "schemaLockingEnabled" property when we toggle it in server manager, even after restarting the service. Have you experienced this before??

0 Kudos
XanderBakker
Esri Esteemed Contributor

I have used the Catalog window for that purpose and that seems to work.

In the Catalog window (or using ArcCatalog) Connect to your ArcGIS Server with admin rights, go to the parameters tab and click on the button Advanced. At the bottom, you will see the property and you can change the value to "false" (just write it).

0 Kudos
JoshLehn
New Contributor II

I've got another question for you. How can i actually modify the property to set the flags to false if they are enabled? I tried several different ways of setting the json property in the "if properties['schemaLockingEnabled'] == 'false':" section, but couldn't get one to stick so I thought I'd ask for your approach.

0 Kudos
JamesVogl
New Contributor II

I think that the "serviceconfiguration.json" files located in /arcgisinput are static and written to only once upon creation of the service. The configuration files that are updated whenever changes are made are the ones located in the configuration store directory. (C:\arcgisserver\config-store\services\<servicename>.MapServer.json).

0 Kudos
BeccaBlackman1
New Contributor II

My DBA helped me alter the above code so it would work on the non-static json files for the services:

import os, json

for root, dirs, files in os.walk(r"C:\arcgisserver\config-store\services"):
    for name in files:
        if name.endswith('.json') and name != 'FolderInfo.json':
            filename = os.path.join(root, name)
            json_data = open(os.path.join(root, name))
            data = json.load(json_data)

            try:
                properties = data['properties']              
                if properties['schemaLockingEnabled'] == 'true':
                    print data['serviceName']
            except:
                pass

This helped me check that I had fixed all the 'false' to 'true'