Connection information provided was for a non-administrative user

Last Published: April 25, 2020

Error Message

Using the ArcPy.DisconnectUser function in a python script as a scheduled task to disconnect users from an enterprise database fails and returns the following error message:

RuntimeError:Connection information provided was for a non-administrative user

The error occurs even though the user has certain administrative privileges to access the database or for database authentication, and the connection file has credentials stored.


Possible causes include:

  • The user is not an administrator or does not have the proper privileges to disconnect other users. This is a known limitation as described in ArcMap: DisconnectUser.
  • The database is actively accepting connections, in which case the error is returned even though an administrator accesses the database.

Solution or Workaround

Use an admin user account to disconnect users. If the right privileges are granted and the issue reoccurs, resolve by denying new connections to the database and implementing the time module to ensure active attempts to connect fail. Complete the steps provided to accomplish this.

  1. Import the necessary modules.
import arcpy
import time
  1. Specify the desired workspace.
admin_workspace = '[SDECONNECTIONFILE]'
arcpy.env.workspace = admin_workspace
  1. Block new connections to the database.
arcpy.AcceptConnections(admin_workspace, False)
  1. Implement the time module to wait until all active connections fail.
  1. Disconnect all users from the database.
arcpy.DisconnectUser(admin_workspace, "ALL")

The following shows the full code:

import arcpy
import time

admin_workspace = 'Database Connections\sample_connection.sde'
arcpy.env.workspace = admin_workspace

arcpy.AcceptConnections(admin_workspace, False)

arcpy.DisconnectUser(admin_workspace, "ALL")

Article ID:000018531

  • ArcMap
  • ArcGIS Pro 2 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options