且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从sql server 2005迁移到2008对应用程序的影响

更新时间:2023-02-06 22:47:34

这当然是一个非常广泛的问题,但是我将尝试提出一些有关如何处理它的建议:

This is a very broad question of course, but I'll try to give some suggestions as to how I would approach it:

  1. 第一个目标是编写一些脚本(存储过程)来测试2005数据库.运行所有现有的sproc,对表中的记录进行计数,列出索引等.执行此操作,以便可以在完成迁移后分别在2005年和2008/2012年运行它们.这将帮助您证明架构成功完成数据.

备份2005数据库并在2008/2012中将其还原.如果需要,可以与步骤1并行进行.只需开始使用它.一切顺利吗?它通过了眼睛测试吗?您需要解决任何错误吗?

Make a backup of the 2005 database and restore it in 2008/2012. You can do this in parallel to step 1 if you'd like. Simply start using it. Did everything import ok? Does it pass the eye test? Any errors you need to address?

在第2步之后,继续制作当前.NET 2.0代码的副本,并将其指向第2步中的新实例.该应用程序正常工作吗?再次,它通过了眼睛测试吗?

After step 2, go ahead and make a copy of your current .NET 2.0 code and point it at the new instance from step 2. Does the application work? Again, does it pass the eye test?

遍历应用程序副本和新数据库,直到您放心为止.如果您有用于代码库的测试套件,显然可以帮助您证明一切正常,而不是凭直觉.

Iterate with the application copy and the new database until you feel confident. If you have a test suite for your codebase obviously that will help you prove things are ok rather than using your intuition.

从.NET 2.0到.NET 4.0/4.5 ...

As far as going from .NET 2.0 to .NET 4.0/4.5 ...

  1. 代码库应向后兼容.我能看到的唯一问题是其他系统是否依赖于您的代码库.如果您有一个核心库并想将其升级到4.0,而另一个仍在2.0上的系统则需要该库,那么您就麻烦了.

  1. The codebase should be backwards compatible. The only problem I could see is if other systems depend on your codebase. If you have a core library and want to upgrade it to 4.0 - and another system that is still on 2.0 needs that library, then you're in trouble.

我肯定会等到 完成数据库迁移后再升级.NET版本.如果在迁移时出现问题,您想知道它不是.NET.它将帮助您缩小错误和问题的范围.

I would definitely wait to upgrade the .NET version until after you finish the database migration. If things go wrong while migrating you want to know it isn't .NET. It will help you narrow down bugs and issues.

完成了许多这样的迁移后,一些一般建议:

After having done many migrations like this some general advice:

  1. 随时创建新的实例/系统并进行测试,测试和测试.不要尝试直接使用源代码管理中的现有代码或使用现有的部署/服务器.只需复制并测试即可.

  1. Feel free to make new instances/systems and test, test, test. Don't try to work directly with existing code in source control or work with existing deployments/servers. Just copy it and test.

编写可帮助您自动化系统测试的工具和脚本.您希望能够知道是的,据我所知,模式完全相同."

Write tools and scripts that help you automate system tests. You want to be able to know "Yes, as far as I know, the schema came over exactly the same."

不要让您的迭代时间太长.以较小的方式进行迭代,然后证明其有效,然后继续进行.

Don't make your iterations too long. Iterate in small ways and then prove it worked and then move on.

希望有帮助.