Skip To Content

Change schema in map services

A dataset's schema is the fields and their definitions that are contained within that dataset. When these are changed, the dataset's schema is changed. A map service (map image layer) uses schema locking by default to prevent modifications to the referenced dataset's schema while the service is running. Locking the schema prevents the users of the map service from experiencing unexpected behaviors, such as missing layers and fields, failing queries, or the service being unavailable.

There are some instances in which you will want to alter the schema of a dataset that has been published as a map service. For instance, you may need to add a new field to a feature class, alter the subtypes applied to a field in a feature class, add or delete a field, modify domains, or alter the symbology of a layer in the map from which you published. In these instances, it is important to carefully plan the schema change before implementing it.

Perform schema changes

It is recommended that you prepare for and perform schema changes with planned service downtime in your organization.

Follow the steps below to change a schema.

  1. Identify the services that access the datasets that need schema changes.

    To identify the datasets used by a service, either open the service workspace for individual services in ArcGIS Server Manager or, as the ArcGIS Server site administrator, run the service manifest operation in the ArcGIS Server Administrator REST API.

  2. Sign in to ArcGIS Server Manager.
  3. Stop each affected service.
  4. Perform the schema change or changes to the source data.
  5. Start the service in ArcGIS Server Manager.

When the service is started, it will pick up the schema changes that altered existing field definitions, such as changes to the field's datatype in the geodatabase or database, fields enabled for subtypes, subtypes applied to a field, domains added to a field, existing domains that were altered, or attribute rules that were altered.

Note:

If you added or deleted a field from the source table, you must overwrite the map service.

Map level changes and map services

To have map or map layer changes reflected in a map service, you must overwrite the map service.

Map level changes are changes to the map or the layer settings within the map. These types of changes include, but are not limited to, the following:

  • Adding or removing a layer, including topology layers or relationship classes
  • Modifying a field alias in the map layer or modifying the map layer alias
  • Modifying a layer's symbology, transparency, or labeling properties
  • Applying scale-dependent rendering
  • Defining or changing the editing template (applies to map services with feature access enabled)
  • Altering the query layer definition, if the source is a query layer

Modify the map service schema lock setting

For some organizations that operate under strict service level agreements (SLAs), schema changes must be made while still allowing the map service to remain accessible. To minimize the amount of time that a map service is not running, you can disable schema locking for the map service, which will allow you to modify the referenced dataset's schema without stopping the map service.

Consider the following before disabling schema locking:

  • When schema locking is disabled, it is recommended that you only update a schema when a service is idle. If you update a schema when a service is under load, users of the map service can experience unexpected behavior, such as missing layers and fields, failing queries, and unavailable services.
  • Changing the schema locking setting requires you to restart the service. Additionally, for changes to be reflected if you disable schema locking for the service, you must either restart the map service after schema changes that alter the definition of existing fields are completed or overwrite the map service if you added or deleted a field.
  • You cannot disable schema locking on map services configured to use the shared instance pool.

Complete the following steps to allow schema edits while a map service is running:

  1. Identify the services that access the datasets that need schema changes.

    To identify the datasets used by a service, either open the service workspace for individual services in ArcGIS Server Manager or, as the ArcGIS Server site administrator, run the service manifest operation in the ArcGIS Server Administrator REST API.

  2. Sign in to ArcGIS Server Manager.
  3. Confirm that the map service is not in use.

    To determine whether a service is idle, locate the map service of interest in ArcGIS Server Manager and verify that the Instances in use value is zero.

  4. Click Services > Manage Services.
  5. Locate the map service and click Edit.

    Note:
    If you don't see the map service in the list, it may be in a subfolder under the Site (root) folder.

  6. Click Parameters.
  7. Uncheck Lock Database Schema.
  8. Click Save and Restart.

    The map service will not hold schema locks on the datasets that it references.

    Schema changes can now be made while the map service is running.

  9. For the map service to reflect the changes, do one of the following:
    1. Stop and start the service.
    2. If you add or deleted fields or made map-level changes, overwrite the service.
Note:

Disabling schema locking for the map service only prevents schema locks from that service. Other ArcGIS applications and services and third-party applications can still obtain exclusive locks on the schema. If you are unable to update the schema on the dataset after disabling schema locking for the map service, see the Enterprise geodatabase locks topic.

Re-enable schema locking

To prevent schema changes from being made while a service is running, follow the steps below:

  1. Click Services > Manage Services.
  2. Locate the map service and click Edit.

    Note:
    If you don't see the map service in the list, it may be in a subfolder under the Site (root) folder.

  3. Click Parameters.
  4. Check Lock Database Schema.
  5. Click Save and Restart.

The map service will no longer allow modifications to be made to the referenced dataset's schema while the service is running.