操作方法

操作方法:自动启用地理数据库

Last Published: October 26, 2021

摘要

GIS 经理、DBA 和管理员有时需要自动化工作流,例如启用地理数据库。 提供的说明将介绍如何使用 Python 脚本来执行此操作。

过程

以下 Python 脚本演示了如何创建连接文件并启用地理数据库。

注: 要运行启用企业级地理数据库地理处理工具,您必须在计算机(通过其连接到数据库并启用地理数据库功能)上安装 ArcGIS Desktop(Desktop Standard 或 Desktop Advanced)、ArcGIS Engine Geodatabase Update 或 ArcGIS Server。

根据环境修改以下参数:

temp = r"C:/temp" auth_file = "C:/Authorizationfile/aut101/Server_Ent_Adv.ecp" Connection_File_Name = "Nidhi_oracle2.sde" database_platform = "ORACLE" instance = "lclinton2/testoracle" database = "" account_authentication = "DATABASE_AUTH" username = "sde" password = "sde" save_user_pass="TRUE" dba_username = "sys" dba_password = "manager"

Python 脚本:

import arcpy, os, sys, string def CreateGeoDB(temp,auth_file, Connection_File_Name,database_platform,instance,database,account_authentication,username,password,save_user_pass,dba_username,dba_password): #Create connection file arcpy.CreateDatabaseConnection_management(temp,Connection_File_Name,database_platform,instance,account_authentication,username,password,"SAVE_USERNAME","","","TRANSACTIONAL","","") print "Created sdeconnection" arcpy.EnableEnterpriseGeodatabase_management(temp + os.sep + Connection_File_Name, auth_file) print "Enabled database" if __name__ == "__main__": temp = r"C:/temp" auth_file = "C:/Authorizationfile/aut101/Server_Ent_Adv.ecp" Connection_File_Name = "Nidhi_oracle2.sde" database_platform = "ORACLE" instance = "lclinton2/testoracle" database = "" account_authentication = "DATABASE_AUTH" username = "sde" password = "sde" save_user_pass="TRUE" dba_username = "sys" dba_password = "manager" CreateGeoDB(temp,auth_file, Connection_File_Name,database_platform,instance,database,account_authentication,username,password,save_user_pass,dba_username,dba_password)

文章 ID:000011776

从 ArcGIS 专家处获得帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项

相关信息

发现关于本主题的更多内容