将SQL CE 4.0数据库迁移到Sql Azure的最佳方法 [英] Best way to migrate a SQL CE 4.0 database to Sql Azure

查看:97
本文介绍了将SQL CE 4.0数据库迁移到Sql Azure的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个较旧的数据库,该数据库是在VS2010中开发的,我想移至SQL Azure.

I've got an older database, developed in VS2010, which I would like to move to SQL Azure.

我希望可以将.sdf文件上传到SQL Azure,但是找不到使它工作的方法.

I was hoping I could just upload the .sdf file to SQL Azure, but couldn't find a way to get that to work.

我似乎无法在Management Studio 2008中打开.sdf文件(获得不兼容的数据库版本"),因此生成脚本的简单选项不可用.

I can't seem to open the .sdf file in Management Studio 2008 (I get "Incompatible Database Version"), so the easy option of generating a script is not available.

是否有任何快速简便的方法来完成此迁移?

Any quick and easy way to get this migration done?

推荐答案

您最好的选择是使用SQL Server Compact& SQLite工具箱,它是Visual Studio加载项

Your best bet is using SQL Server Compact & SQLite Toolbox, it's a Visual Studio Add-in

  • 在Visual Studio(我正在使用2012)中,转到工具">扩展和更新"
  • 在线搜索"SQL Server Compact& SQLite工具箱",然后 安装它.
  • In Visual Studio (I'm using 2012) go to Tools > Extensions and Updates
  • Search online for "SQL Server Compact & SQLite Toolbox" and install it.

安装后,您必须重新启动Visual Studio.

You will have to restart Visual Studio after install.

  • 打开包含.sdf文件的解决方案
  • 连接到您的SQL CE数据库(您的SQL CE数据库可能已经在数据连接"下)
  • 选择它
  • 单击SQL Server Compact& amp;的(新)图标. SQLite工具箱
  • 在SQL Server Compact/SQLite工具箱中,右键单击要导出的数据库
  • 脚本数据库> SQL Azure的脚本数据库架构和数据
  • 选择所有表
  • 将脚本另存为.sql文件.

针对您的SQL Azure数据库运行脚本 如果数据脚本大于50MB(这可能是通常的情况,则可以使用sqlcmd运行它们):

Run the script against your SQL Azure database If the data script is more than 50MB (which might be the usual case, you can run them with sqlcmd):

sqlcmd -U user_dbo -P密码-S cloudserver -d数据库-i c:\ dataScript.sql -o c:\ azuremigration.txt

sqlcmd -U user_dbo -P password -S cloudserver -d Database -i c:\dataScript.sql -o c:\azuremigration.txt

这篇关于将SQL CE 4.0数据库迁移到Sql Azure的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆