如何在SQL Server数据库之间移动图表?

时间:2021-08-28 09:08:23

I'm trying to move a database from a hosted server to my own SQLExpress instance. I used the Database Publishing Wizard to create the script... but the diagrams were not transferred.

我正在尝试将数据库从托管服务器移动到我自己的SQLExpress实例。我使用数据库发布向导来创建脚本......但图表未被传输。

Then, I found and followed the advice of another answer on this site that had me import/export the data to the sysdiagrams table.

然后,我发现并遵循了这个网站上另一个答案的建议,我将数据导入/导出到sysdiagrams表。

When I do that, I see all of the diagrams in the Diagrams folder. However, when I try to open one, I see an outline of each table, then get a popup error message that says:

当我这样做时,我会看到Diagrams文件夹中的所有图表。但是,当我尝试打开一个时,我会看到每个表的大纲,然后得到一条弹出错误消息,上面写着:

"Table(s) were removed from the diagram because privileges were removed to these table(s) or the table(s) were dropped."

“表格已从图表中删除,因为删除了这些表格的权限或删除了表格。”

When I exit from the popup, all of the tables are removed from the diagram (except for a couple of aspnet_xyz membership tables that were part of one diagram).

当我从弹出窗口退出时,所有表都从图中删除(除了一个aspnet_xyz成员资格表,它们是一个图表的一部分)。

Do you know how I can transfer the diagrams without receiving this message?

您知道如何在不接收此消息的情况下传输图表吗?

4 个解决方案

#1


You need to delete the diagram and in the right click menu with the "New Database diagram" create a new one and add the tables you need, and save it finally.

您需要删除图表,并在右键菜单中使用“新数据库图表”创建一个新图表并添加所需的表格,并最终保存。

#2


The simplest way is to create a backup of the whole database and restore it to your Express database. You are getting the error because the diagrams are no simple drawings - they are just some metadata and they rely on the tables they show - you need the tables shown by the diagram. If you don't want to modify the diagram, just export it as an image.

最简单的方法是创建整个数据库的备份并将其还原到Express数据库。您收到错误是因为图表不是简单的图纸 - 它们只是一些元数据,它们依赖于它们显示的表格 - 您需要图表所示的表格。如果您不想修改图表,只需将其导出为图像即可。

#3


I have seen something similar to this before, it wasn't quite the same but perhaps it's close enough to apply to you.

我以前见过类似的东西,它不太相同,但它可能足以适用于你。

It is likely that the trouble that you were having initially was to do with user privileges being tied to the old server in some way.

您最初遇到的麻烦可能是以某种方式将用户权限绑定到旧服务器上。

Refer to http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120849&SiteID=1 and this: http://msdn2.microsoft.com/en-us/library/ms143684.aspx.

请参阅http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120849&SiteID=1和此:http://msdn2.microsoft.com/en-us/library/ms143684.aspx。

  • You will need to stop your "SQL Server (SQLEXPRESS)" service.

    您需要停止“SQL Server(SQLEXPRESS)”服务。

  • Then delete the "\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS" folder.

    然后删除“\ Documents and Settings \ Username \ Local Settings \ Application Data \ Microsoft \ Microsoft SQL Server Data \ SQLEXPRESS”文件夹。

  • Restart SQL Server.

    重新启动SQL Server。

  • Restart Visual Studio.

    重新启动Visual Studio。

I hope that helps.

我希望有所帮助。

#4


This problem stopped when I re-scripted the entire database using the Database Publishing Wizard... This time I specified "Schema Only" instead of "Schema and Data." After I did this, I was able to successfully import and open the diagrams using the Import/Export wizard.

当我使用数据库发布向导重新编写整个数据库脚本时,此问题停止了......这次我指定了“仅模式”而不是“模式和数据”。在我这样做之后,我能够使用导入/导出向导成功导入和打开图表。

#1


You need to delete the diagram and in the right click menu with the "New Database diagram" create a new one and add the tables you need, and save it finally.

您需要删除图表,并在右键菜单中使用“新数据库图表”创建一个新图表并添加所需的表格,并最终保存。

#2


The simplest way is to create a backup of the whole database and restore it to your Express database. You are getting the error because the diagrams are no simple drawings - they are just some metadata and they rely on the tables they show - you need the tables shown by the diagram. If you don't want to modify the diagram, just export it as an image.

最简单的方法是创建整个数据库的备份并将其还原到Express数据库。您收到错误是因为图表不是简单的图纸 - 它们只是一些元数据,它们依赖于它们显示的表格 - 您需要图表所示的表格。如果您不想修改图表,只需将其导出为图像即可。

#3


I have seen something similar to this before, it wasn't quite the same but perhaps it's close enough to apply to you.

我以前见过类似的东西,它不太相同,但它可能足以适用于你。

It is likely that the trouble that you were having initially was to do with user privileges being tied to the old server in some way.

您最初遇到的麻烦可能是以某种方式将用户权限绑定到旧服务器上。

Refer to http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120849&SiteID=1 and this: http://msdn2.microsoft.com/en-us/library/ms143684.aspx.

请参阅http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120849&SiteID=1和此:http://msdn2.microsoft.com/en-us/library/ms143684.aspx。

  • You will need to stop your "SQL Server (SQLEXPRESS)" service.

    您需要停止“SQL Server(SQLEXPRESS)”服务。

  • Then delete the "\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS" folder.

    然后删除“\ Documents and Settings \ Username \ Local Settings \ Application Data \ Microsoft \ Microsoft SQL Server Data \ SQLEXPRESS”文件夹。

  • Restart SQL Server.

    重新启动SQL Server。

  • Restart Visual Studio.

    重新启动Visual Studio。

I hope that helps.

我希望有所帮助。

#4


This problem stopped when I re-scripted the entire database using the Database Publishing Wizard... This time I specified "Schema Only" instead of "Schema and Data." After I did this, I was able to successfully import and open the diagrams using the Import/Export wizard.

当我使用数据库发布向导重新编写整个数据库脚本时,此问题停止了......这次我指定了“仅模式”而不是“模式和数据”。在我这样做之后,我能够使用导入/导出向导成功导入和打开图表。