ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

Detach Database

  • 摘要
  • 用法
  • 语法
  • 代码示例
  • 环境
  • 许可信息

摘要

Detaches a SQL Server Express geodatabase (.mdf).

Removes all references to the geodatabase from the database server. It does not delete the data file (.mdf). Once detached, you can attach the data file to another SQL Server Express instance.

用法

  • The .mdf file and the full-text catalog for the database are in the directory in which you initially created the geodatabase.

  • When copying a detached geodatabase to another server, you do not need to copy the .ldf file. The Attach Database tool creates a new .ldf. You must copy the full-text catalog with the database (.mdf). For SQL Server 2008 Express, the full-text catalog is in the .mdf file. For the full-text catalog to transfer properly, the database server to which you move the geodatabase must also be set up to use SQL Server Full-Text Search.

  • The geodatabase must not be in use by another process during detach.

  • You must have Server Administrator privileges to detach a geodatabase.

语法

DetachDatabase(workspace)
参数说明数据类型
workspace

The geodatabase to detach from an instance of SQL Server Express.

Workspace

代码示例

DetachDatabase example (stand-alone script)

The following stand-alone script demonstrates how to use the DetachDatabase tool.

# Name: DetachDatabase_Example.py
# Description: Detaches a geodatabase (.mdf file) from an instance of SQL Server Express
# Requirements: Production Mapping extension

# import arcpy and checkout a Production Mapping license
import arcpy
arcpy.CheckOutExtension("foundation")

# local variable for the workspace parameter
gds_workspace = "Database Servers\\YOURSERVER_SQLEXPRESS.gds\\ProductLibrary (VERSION:DBO.DEFAULT)"

# detach the geodatabase from the SQL Server Express instance
arcpy.DetachDatabase_production(gds_workspace)

print "Script completed successfully."

# Check in the extension
arcpy.CheckInExtension("foundation")

环境

  • 当前工作空间

许可信息

  • ArcGIS Desktop Basic: 否
  • ArcGIS Desktop Standard: 需要 Production Mapping
  • ArcGIS Desktop Advanced: 需要 Production Mapping

相关主题

  • An overview of the Product Library toolset

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2019 Esri. | 隐私政策 | 法律声明