views:

501

answers:

3

I'm tasked with doing a SQL Server 2000 to 2005 migration. I will be doing a side-by-side migration.

After restoring from a backup I plan to do the following:

ALTER DATABASE <database_name> SET COMPATIBILITY_LEVEL = 90;

DBCC CHECKDB(<database_name>) WITH NO_INFOMSGS

DBCC UPDATEUSAGE(<database_name>) WITH NO_INFOMSGS

exec sp_updatestats ‘resample’

Should I rebuild table indexes before using DBCC UPDATEUSAGE and sp_updatestats?

Have I missed anything obvious that should be executed after a migration?

All help would be warmly up-voted.

Thanks

A: 

"Have I missed anything obvious that should be executed after a migration?"

  • Make sure you're running the latest SP of SS 2005.
  • I'm surprised that you make no mention of having tested all your SPs and UDFs in SS 2005 to prove that they succeed in the same ways and fail predictably throughout. This may take some time to do, but gives you a great chance to dramatically upgrade your system's robustness.
dcpking
Although the OP's focus seems to be with _data_ integrity and index maintenance, these are very important points to consider. We should never take for granted the fact that UDFs, SPs, Custom functions and other procedural elements of the system will work flawlessly after the upgrade. This said, for most vanilla cases, there is not need to individually assert each element; For example reviewing one or two, say SPs, that follow a particular pattern should qualify the whole class of such SPs.
mjv
@dcpking thanks for your answer, I agree applying the latest patches is called for before my migration work begins. All SPs will be checked and for the scope of my work thankfully no UDFs or custom functions exist in the databases to be migrated.
Joe T
+5  A: 

There isn't much authoritative online material providing specifics on migration (beyond procedures aimed at merely ensuring the database structural integrity in the new/upgraded host). For this reason, and because this migration seems to be scheduled/planned event for you, I'd take the opportunity to rebuild all indexes, including clustered indexes.

To some, this may seem "overkill", but what better opportunity of re-balancing and re-packing indexes/tables, providing a fresh fill-factor that is commensurate with the expected CRUD usage, and to generally assert the database's health in its new host.

In practical terms, I would...

ALTER DATABASE <database_name> SET COMPATIBILITY_LEVEL = 90;

DBCC CHECKDB(<database_name>)
   -- WITH NO_INFOMSGS  (I'd take the messages, I'm curious by nature ;-)

Like you suggest, but then I'd rebuild all indexes on all/most tables even (maybe in particular...) on very big tables. To be sure, one should evaluate the time and relative risk involved with such an operation, but for most cases, even with databases in the 100+ million rows, the overall time overhead is in the order of a few hours, time well invested, for it may defer future index rebuilds. As to the risk factor, you seem to have a backup...

What goes without saying... When the underlying table has a clustered index, and if it desirable to rebuild it as well, do drop all other indexes before, lest a lot of time is wasted in updating the non-clustered index (without they being rebuilt in earnest), then of course recreate these non-clustered indexes.

Depending on the number of tables and indexes in question, it may be profitable to write a few small Stored Procedures to automate the index dropping (and re-creating, although it may also be important to individually review the fill-factors, recompute and other parameter).

mjv
@mjv thanks for your answer, it has convinced me that a rebuild of all indexes for this vanilla database would be a good idea. It is very difficult to find authoritative information on any SQL Server topic.
Joe T
A: 

Addition to your list CheckDB before the database leaves SQL 2000 - you want to be as sure as possible no corruption from 2000 is brought over, if anyone started deallocating stuff in the system tables instead of using the proper commands will give you a mare once migrated.

If you rebuild the indexes then exec sp_updatestats ‘resample’ will give you worse statistics for your indexes since they would of already been updated by the rebuilds. Additional stats added might well need to be updated, but do them individually, don't kill the index stats for them.

Andrew
@Andrew thanks for your answer. I will consider running CHECKDB before taking my db backup. It is hard to know the balance between mitigating risk and reducing downtime for users.
Joe T