After upgrading SQL Server you will need to perform a series of tasks to verify that database is ready to be handed over to the end users for further testing. This post will provide you a checklist of items to review after the upgrade is complete.
1. TAKE BACKUPS
Right now. Before you do anything else. You’re a DBA. Backups should be in your DNA. You should have taken one prior to the start of upgrading to SQL Server 2016, and you had better take one right now and again before you turn that database over to your end users.
One of your post-migration or upgrade tasks should be to run the following statement:
| DBCC checkdb WITH data_purity; |
This statement will check your data for values that are no longer valid for the column datatype. For databases created prior to SQL 2005 (and you *know* they are still out there), this step is important. For databases created in SQL 2005 and later, the DATA_PURITY check is done automatically with a regular CHECKDB.
But what about a database that was created in SQL 2000, migrated (poorly) to a SQL 2008 instance, and left in the SQL 2000 (80) backward compatibility mode? What about that little feller? Do you want to assume that the DATA_PURITY check has been getting done? Here’s a thought: just go run it yourself anyway. That way you know it is getting done.Also worth noting here that column integrity checks are not performed when the PHYSICAL_ONLY option is used.
While not as critical as the DATA_PURITY command noted previously, this one still has a place in any migration or upgrade process:
| DBCC updateusage(db_name); |
This command will help fix any page count inaccuracies that are resulting in the sp_spaceused stored procedure returning wrong results. Be aware that it can take some time to run depending upon table or database size. Ideally, you would run this on a regular basis for one of the following reasons:
• You suspect that you are seeing incorrect values returned for sp_spaceused.
• Your database has a high volume of DDL statements (CREATE, ALTER, or DROP).
This one is not to be skipped and is simply a MUST for any migration or upgrade checklist:
| USE db_name; go EXEC Sp_updatestats; |
This command will update the statistics for all the tables in your database. It issues the UPDATE STATISTICS command, which warrants mentioning because you *may* want to use that command with the FULLSCAN option. Example:
| USE db_name; go EXEC Sp_msforeachtable @command1='UPDATE STATISTICS ? WITH FULLSCAN'; |
Bottom line: don’t forget to update the statistics after upgrading to SQL Server 2016. Failure to do so could result in your queries running longer as you start your testing. The end result is a waste of time while you troubleshoot all possible bottlenecks. With SQL Server 2016 there is also a new Cardinality Estimator (CE). Since the query optimizer relies on accurate statistics for plan estimation purposes, you will want your statistics are as accurate as possible before you begin any testing.Take care of the stats now and you won’t have to worry about them later.
Believe it or not, every now and then someone will build a view that spans into another database on the same instance. And, in what may be a complete surprise to many, sometimes these views will go across a linked server as well. The point here is that your view may not be of data that is contained in just the database on that single instance. In what could be the most dramatic twist of all, sometimes these views are created using a SELECT * syntax.
It happens when you have bad code on top of views that go to other databases (or views of views of views of whatever else some person built) you are going to want to use sp_refreshview to refresh those views.
If you are migrating a database to a new server then it is a good idea to refresh your views using sp_refreshview. Most of the time it won’t do anything for you, just like a burger topped with veggie bacon. But there is that one chance where it will dramatically improve performance and your customer will be happy as a result. Using sp_refreshview is a lot like flossing: it doesn’t take much effort, and the end result is usually worth it.
If you have been upgrading to SQL Server for the past ten years then you are likely to have noticed that the compatibility level does not get set to the newest version after the migration is complete. You must set the compatibility level yourself. With SQL Server 2016 this becomes more important than in previous versions due to the new Cardinality Estimator (CE).
I’d recommend you update every database on the SQL Server 2016 instance to compatibility mode 130 and test, test, test. [This assumes that you have baselined performance for your critical queries before the migration so you can verify if the new CE is working for or against you.]
Remember the counts of objects such as tables and stored procedures that you took before? Now is when you want to review those counts. Make sure you have the same number of objects that you started with prior to the upgrade and migration. Remember the SQL Server upgrade motto: No table left behind!
As part of the pre-upgrade tasks, we collected details on the in-house and third party vendor applications using the database server. We also collected information about the specific configurations applied to the server O/S, database instance, and the database itself. Now is the time for you to review those details and make sure the configurations have been applied to the new server.
At this point, I will tell you that the use of a POC test system saves you a lot of time with the ‘after’ phase, because you work through any issues early on in test and incorporate them into your upgrade plans. Also worth mentioning again is how easy Azure makes this for you.This is also a good time to mention that sometimes it is worth running “production parallelâ€, where you have two systems running at the same time, both are considered production. How the data is kept in sync is up to you, but the idea is that the business users get a chance to verify that the new system is working as expected.
SUMMARY
Upgrades are a necessary part of any development lifecycle. The chances of having a successful upgrade increase with the amount of planning and preparation you invest in building a proper upgrade process. If you haven’t started building up your SQL 2016 migration or upgrade checklist yet, now is the time, and get these items included. They will save you pain, I promise.
Years of Experience
Gratified Students
Training Batches
Training Hours
Please subscribe our technical blog to get recent updates.