【问题标题】:Importing views from microsoft sql server 2003 fail从 microsoft sql server 2003 导入视图失败
【发布时间】:2017-06-08 10:02:50
【问题描述】:

我正在尝试从 microsoft sql server 2003 迁移到 sql server 2016。 使用 Microsoft SQL Management Studion 2016 导入数据进展顺利,但未导入视图。这是我的要求,如何导入视图?

此时我尝试了:

  • 从旧数据库生成创建脚本,但好像回到 2003 年,这个选项还不存在
  • 在旧 SQL 服务器中进行查询以列出所有视图、复制它们并在新服务器中手动重新创建它们,但没有任何查询可以检索所有视图
  • 从旧服务器复制 .MDF 和 .LDF 文件,并将它们附加到新服务器,但出现以下错误:

=

==================================

Fail to join database for serber « DESKTOP-53C6I45\SQLEXPRESS ».  (Microsoft.SqlServer.Smo)

------------------------------
To get help, click on : http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=13.0.16106.4+((SSMS_Rel_16_5).170125-2137)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attacher+la+base+de+données+Server&LinkId=20476

------------------------------
Software location :

   at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
   at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabaseData.PrimaryFile.Attach()
   at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.SendDataToServer()

===================================

An exception was produced during the execution of batch Transact-SQL. (Microsoft.SqlServer.ConnectionInfo)

------------------------------
Location of the software :

   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)
   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType, Boolean retry)
   at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries, Boolean retry)
   at Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
   at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)

===================================

The database 'Labeint' can't be upgraded, because its non final version (539) isn't managed by this version of SQL Server. You can't open a database which is incompatible with this version of sqlservr.exe. You must rereate the database.
Impossible to open the new database 'Labeint'. Abandon of CREATE DATABASE. (.Net SqlClient Data Provider)

------------------------------
To get help, click on : http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=950&LinkId=20476

------------------------------
Server name : DESKTOP-53C6I45\SQLEXPRESS
Error number : 950
Gravity : 20
State: 1
Line number : 1


------------------------------
Location of the software :

   at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)

问题是旧项目中的视图很复杂,获取数据我不知道在哪里获取对我来说是黑匣子的项目,否则我会手动重新创建它们,试图弄清楚它们是如何制作的.

【问题讨论】:

  • 有一个 Sql Server 2003?哇,我错过了那个。一定是 Kook Kids Sku
  • 请在下面查看我的更新答案

标签: sql-server views windows-server-2003 mdf ldf


【解决方案1】:

您不能以这种方式批发迁移数据库文件。您正在尝试将 Sql Server 2000 DB (v539) 升级到 Sql Server 2016,但没有升级路径。如果这是您选择的(唯一)路径,您可能需要从 2000 年到 2008R2,然后从 2008R2 到 2016 年。

另一种方法是下载旧版本的 Red-Gate Sql Compare(v11 或更早版本)并在试用模式下针对空的 2016 DB 运行它。

https://www.red-gate.com/products/old-versions

【讨论】:

  • 所以没有直接的方法可以从 Sql Server 2000 DB 中提取视图?我会试试 Red-Gate 并让你更新。
  • 我在永远之前都没有使用过 Sql Server 2000,所以我已经忘记了它有很多繁重的限制(与今天相比)。
  • 我试过你的解决方案,它奏效了。我从 Microsoft Server 2003 中检索了 .ldf 和 .mdf,将其附加到运行 Windows XP SP2 的虚拟机上的 Microsoft SQL Server 2005 中,备份了数据库,并能够在 Microsoft SQL Server 2016 上恢复 .bak。谢谢你!
猜你喜欢
  • 1970-01-01
  • 2013-06-04
  • 1970-01-01
  • 2020-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-12
  • 2016-11-29
相关资源
最近更新 更多