操作方法
在 Python 脚本中使用 ArcPy.DisconnectUser 函数作为计划任务,断开用户与企业级数据库的连接将失败,并返回以下错误消息:
Error: RuntimeError:Connection information provided was for a non-administrative user
即使该用户拥有访问数据库或进行数据库身份验证的某些管理权限,并且连接文件已存储凭据,该错误仍然发生。
Note: ArcGIS Enterprise supports several different databases. Each vendor has a different definition and permission set for the administrator role. For more information about the geodatabase administrator, and on the privileges needed based on a person's role in the organization, see the help page specific to the database management system you use. See also: ArcGIS Pro: Geodatabase management
可能的原因包括:
使用 admin 用户账户断开用户连接。 如果已授予正确的权限但问题仍然存在,请通过拒绝新的数据库连接并实施时间模块来解决此问题,从而确保正在进行的连接尝试失败。 按照提供的步骤完成此操作。
import arcpy import time
admin_workspace = '[SDECONNECTIONFILE]' arcpy.env.workspace = admin_workspace
arcpy.AcceptConnections(admin_workspace, False)
time.sleep(120)
arcpy.DisconnectUser(admin_workspace, "ALL")
以下为完整代码:
import arcpy import time admin_workspace = 'Database Connections\sample_connection.sde' arcpy.env.workspace = admin_workspace arcpy.AcceptConnections(admin_workspace, False) time.sleep(120) arcpy.DisconnectUser(admin_workspace, "ALL")
文章 ID: 000018531
获取来自 ArcGIS 专家的帮助
下载 Esri 支持应用程序