如何使用 SQL Server Compact Edition 数据库升级工具

使用 Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) 数据库升级工具可以升级 SQL Server Compact Edition 1.0 或 2.0 数据库,以便用于 SQL Server 2005 Compact Edition。该命令行工具必须运行在智能设备上,而且源数据库和目标数据库也必须位于该设备上。

SQL Server Compact Edition 数据库升级工具的下载和安装

  1. 该数据库升级工具作为 SqlMobile30DevTools[lang].msi 文件的一部分与 Visual Studio 2005 一起安装。该文件的默认位置是 <drive>:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0\[platform]\[processor]rade.exe。

  2. 使用 ActiveSync 将 upgrade.exe 文件复制到智能设备上“我的设备”文件夹中。

在该智能设备上打开命令行

  1. 若要在 Pocket PC 设备上打开“命令提示符”窗口,请按住该设备上的 Action 或 Enter 按钮。

  2. 在按住 Action 或 Enter 按钮的同时,点击并按住顶部菜单栏上的时钟图标。

  3. 释放 Action 或 Enter 按钮。此时会显示一个带两个选项(“运行”和“时钟”)的菜单。

  4. 单击“运行”。即显示“命令提示符”窗口。

    非常值得注意的是:这种打开命令行的命令可能并不适用于所有智能设备。对于 Pocket PC 2003 设备,可以安装 Windows Mobile Developer Power Toys,其中包括 PPC 命令外壳程序。

运行该升级工具

  1. 在“命令提示符”窗口的“打开”文本框中,键入升级数据库的命令。该升级工具使用下列语法:

    upgrade.exe /s "\dir1\source.sdf" /sp "password1" /d    "\dir2\destination.sdf" /dp “password2" /e /q
    

    有关 upgrade.exe 使用的参数的详细信息,请参阅本主题后面的表。

  2. 升级完成后,会显示一个消息框,告知升级成功或失败。

示例

此示例显示了如何将名为 MyDb1.sdf 的数据库转换为名为 MyUpgradesDB.sdf 的 SQL Server Compact Edition 数据库。升级后的数据库被加密并使用密码保护。

upgrade.exe /s "\DB\MyDb1.sdf" /sp "P@ssw0rd" /d 
   "\DB\MyUpgradedDB.sdf" /dp “P@ssw0rd2" /e
 

The following table lists the parameters that you can use with the Database Upgrade tool.

Parameter Description

/s

The path of the source database file (required).

/sp

The password for the source database file (optional).

/d

The path of the destination database file. If you specify an existing file, the file will be overwritten (required).

/dp

The password for the destination database file (optional).

/e

If specified, the destination database will be encrypted. If you specify the /e parameter, you must also specify /sp and provide a password (optional).

/q

Perform the upgrade silently without any UI (optional).

/?

Displays this list of parameters (optional).

请参阅

参考

SQL Server Compact Edition 数据库升级工具

概念

升级 SQL Server Mobile 和 SQL Server CE

帮助和信息

获取 SQL Server Compact Edition 帮助