Friday, 14 August 2015

Checklist for upgrading to a new version of SQL Server



Here is the basic process for a full version upgrade (such as 2000 to 2008) of the SQL Server engine. The steps will be different for RS or AS. I did not include all the details of variations such as replication, mirroring, log shipping, full-text search, or clustering. They are covered in the white paper in the first reference at the bottom.

Look for potential problems:
·         Run Upgrade Advisor from your new version of SQL Server and address any issues.
·         Run SQL Server 2008 Upgrade Assistant (I don’t have any details on this – it’s a 3rd party tool).
·         If upgrading to SQL Server 2008: Run the System Configuration Checker
·         Verify you are not using any discontinued features.
·         Read up on the “breaking changes” section of BOL.
·         Test not only the application but also all maintenance activities including disaster recovery.
·         Look for any hints/options or plan guides used in the system and test removing them.
·         On a development or test system – uncover and address issues caused by the upgrade and/or change in hardware
o   Install the new version and load copies of the databases.
o   Look for potential errors, changes in functionality, and performance changes.
o   Make sure you cover typical, peak, and periodic (such as month end) activity. Consider tracing high visibility activity as well, such as the functionality used by an executive or vocal user.
o   The more your test system looks like your production box (hardware, OS, configuration, SQL data) the more accurate your testing will be.
o   Do a profiler/readtrace replay: Capture at least one profiler trace using the replay template on production. Then use the replay functionality of either the RML tools or Profiler itself to replay the same traces on test. Consider that data modifications may fail depending on the state of the backups compared to the state of the database at the time the traces were taken.
o   Have testers hit the test system under load: typical and peak.
o   Put a full application load on the system and test all functionality. Tools like Profiler replay, Visual Studio Database Edition, RML, sample code such as what you might find on codeplex, and 3rd party products can all help with this process.
o   Consider using a tool such as Visual Studio Database Edition to add more test data to the system to simulate future usage.
o   If your IO setup will changed and the test system will be similar to production, consider running SQLIO (performance) and/or SQLIOSim and its new parser (correctness).
·         Test the upgrade process itself on a test system.
·         If doing an upgrade in place make sure the old system is at a minimum supported version level and edition for the upgrade (including the service pack). You cannot upgrade in-place from 32bit to 64bit. Check that your combination of old and new versions, editions, and platforms is supported.

Planning:
·         Start a document/checklist with all the steps you plan to follow, who is responsible for each, and the expected time for the process.
·         Will you change the OS, hardware, firmware, disk configuration, and SQL Server version all at the same time? If so, you can reduce your overall downtime but you also make it harder to isolate problems that occur after the changes.
·         Decide on a physical implementation vs. a virtual machine. If you will use a virtual machine make sure it is fully supported by Microsoft and it is setup per virtualization best practices.
·         If you are moving to a new box:
    • Follow best practices for configuration – if your memory, number of CPUs, or number of instances on the box/cluster changed some configuration options will need to be adjusted.
    • Run SQLIO (performance) and SQLIOSim (IO integrity) and verify the system is “fast enough”
    • Usually you will want the drives laid out the same, if not plan for the steps to change the location: 314546 HOW TO: Move Databases Between Computers That Are Running SQL Server http://support.microsoft.com/?id=314546  
·         Do you have special functionality such as replication, mirroring, or clustering? If so, consider whether that changes any of the steps.
·         Will your upgrade be in-place, side-by-side on the same server, or side-by-side on a different server?
·         Will the new instance have exactly the same server name and instance name (i.e. Server1 or VirtualServer1\InstanceA)? If not, how will you accommodate components such as replication and mirroring that assume the server name never changes?
·         Note that all instance-aware components within a given instance are upgraded together. Common components such as SSIS and the client tools are upgraded the first time a newer version is installed on a box.
·         Have a rollback/contingency plan that includes SLAs, how you will know when you must implement the contingency plan, who will make the decisions, etc.
·         What version will you upgrade to? What service pack/CU level will you be at?
·         Will you upgrade/move all user databases at once?
·         Will you move system databases and/or information from the system databases? This could include logins/passwords, linked server definitions, configuration settings, jobs, DTS/SSIS packages, etc. Note that system databases can only be restored to the EXACT same version. User databases can be restored/attached to a newer version but not back down to a lower major version.
·         Will you do a detach/attach or a backup/restore? Attach/detach is the simplest but generally has a longer user downtime. With backup/restore you can do a full (and possibly some incremental transaction log or differential) backup/restore before-hand and only have downtime for the latest transaction log backup/restore time period. This only works if the database is in full or bulk-logged recovery mode (and for bulk-logged you need to be sure you aren’t doing any bulk operations before the downtime).
·         How long do you expect the upgrade to take including time for potential troubleshooting, breaks, and interruptions? Add more time to that for the scheduled downtime.
·         Make sure you have enough disk space for the entire upgrade process including extra copies of your backups.

Pre-downtime steps
·         If upgrading to SQL Server 2008, consider applying .NET 3.5 SP1 and the latest Windows installer ahead of time as they require a reboot. You may also want to install the SQL Native Client ahead of time.
·         If you have a version of Visual Studio 2008 that is not patched to at least SP1, patch it to at least SP1 prior to installing SQL Server.
·         For SQL Server 2008 if you are not planning to install SP1, install RTM based CU4 (to fix known and resolved setup issues), then apply RTM, then reapply CU4. Or you can slipstream SP1+SP1 based CUx (or whatever the latest SP is at the time) and do a single install that includes RTM, SP1, CUx. For clusters, do each step across all nodes before going to the next step.
·         Take a baseline of the system and note the circumstances (busy vs. slow day, certain time of day/week/month/year, anything unusual).
·         If moving to a new server, install drivers, supporting applications/utilities, etc. on the new system.
·         Make sure OS level settings such as whether or not "Lock Pages in Memory" is enabled for the SQL Server account are the same on the old and new hardware.
·         If necessary, install the latest backward compatibility files on the SQL Server box and any client boxes (which may include other servers).
·         If moving from DTS to SSIS, consider upgrading the packages ahead of time. If you do this make sure no changes are made to the existing production DTS packages unless you also apply the changes to the converted SSIS packages.
·         Install the new version of the client tools (including service packs), samples, and sample databases on DBA and developer desktops.
·         Become familiar with the new interfaces, functionality, and how your features work in the new version.
·         Understand the upgrade process and how to troubleshoot failures in each step.
·         Test security and connectivity, such as whether linked servers work as expected.
·         Consider pre-growing system databases if doing an in-place upgrade.

Just prior to the upgrade:
·         Backup everything (system dbs, user dbs, registry, sys db settings, config options, encryption keys, etc) and save off the backups.
·         Run DBCC CHECKDB on all system and user databases – address any errors that are found.
·         If you are scripting out data from the system databases make sure you have everything you need.
·         If you are keeping the same server name on new hardware, make sure the old box is shut down and the new server and SQL Server (sp_dropserver + sp_addserver with the "local" parameter) have been changed to the old server name BEFORE you enable replication or anything else which relies on the server/instance name.
·         If doing a backup/restore on a full or bulk-logged recovery mode database, take the full backup and restore it to the new instance. Optionally you may have one or more tran and/or differential backups to restore as well.

At Downtime:
·         Document the process, such as actual time to complete each step, any changes you had to make, etc.
·         Make sure all users are out of the system and do whatever is necessary to keep them out until the upgrade is complete.
·         Disable startup processes, SQL Server trace flags, services that access SQL Server, etc.
·         Make sure all replicated data has hardened on all systems and stop replication.
·         Stop any non-essential services and applications, especially any that might have SQL Server related files open. Examples of common problem areas are IIS, backup software, virus/malware scanners, and applications that connect to SQL Server.
·         For an upgrade in place, start the upgrade.
·         For backup/restore, take the final transactional log backup, copy it to the new location (possibly using a SAN clone) and restore it to the new instance.
·         For attach/detach, detach the user databases from the original server, copy them to the new location (or use a SAN clone), and attach them.
·         Take new backups (after upgrade, before any changes) and save them off (where they will not be overwritten until you are ready for them to be).
·         If the system databases were not restored, copy their data and then sync the logins with the users.
·         If the system databases were restored for a pure migration as opposed to an upgrade, tweak configuration options as needed (for example, MAXDOP or the number of TempDB files may change if the number of cores has changed).
·         If you have DTS/SSIS packages or other supporting files stored in the file system, copy them to the new system and disable access to them on the old system.
·         Update statistics (essential for 2000 to 2005/8, nice for 2005 to 2008) on all user databases.
·         Set the compatibility mode to the current version for each user database (by default an attach or restore leaves it at the level of the source instance).
·         Take new backups (after changes) and save them off (where they will not be overwritten until you are ready for them to be).
·         If using Full-Text update your catalogs.
·         Perform another DBCC CHECKDB on each database – optional. If possible use the WITH DATA_PURITY option (this option is implied for databases created in 2005 or later and for any database that has once had that option explicitly stated).
·         Perform DBCC UPDATEUSAGE on each database.
·         Take new backups (after changes) and save them off (where they will not be overwritten until you are ready for them to be).
·         If the instance name changed, point the users/application(s) to the new instance name.
·         Test basic maintenance operations.
·         Test whatever application level items you can do yourself (perhaps with a replay of only SELECT statements) or test with a few trusted users.
·         Let the users back in.
·         Test the application(s) – have all users do at least basic operations.
·         Compare the current performance to your baseline, taking into account the circumstances such as the number of users on the system.
·         Evaluate the criteria to see if you need to apply your rollback/contingency plan.
·         Make sure your new backup strategy is implemented and takes into account the backups you took during the upgrade process.
·         Restart any services, applications, etc. stopped just for the upgrade process.

Later:
·         If you enabled autogrow for system databases, consider disabling it.
·         Re-enable startup processes, SQL Server trace flags, services that access SQL Server, etc.
·         Restart any replication.
·         Update your upgrade checklist/documentation based on your most recent experience. Many of the changes may also apply to your disaster recovery docs.
·         Review your documentation, best practices, troubleshooting scripts, profiler templates, etc. for changes that should be made. For example, in 2005 and later the process to rebuild master and the other system databases uses a different utility than 2000 did.
·         Consider turning on new options available in your new version such as database checksum instead of just torn page detection.
·         Take advantage of the more granular security options in the new versions. This includes better job/replication/SSIS security as well as more role options.
·         With 2008 and later set up a Central Management Server so everyone in a group (such as all production DBAs who support one sector of the business) has the same list of SQL Servers available to them in SSMS.
·         Start using new features/functionality in the new version.
·         Keep up to date with service packs and cumulative updates.
·         Rewrite anything using deprecated features. You can use SQL Profiler to capture an event every time a deprecated feature from the SQL engine is used. Starting with SQL Server 2008 there is also a perfmon counter for this.
·         Capture a new performance baseline/benchmark on the system and update the baseline periodically.
·         For a side-by-side upgrade, determine when and how you will decommission the old instance.
·         Migrate maintenance plans created in 2000 to the new SSIS format.




If you are using replication, Analysis Services (AS), or DTS/SSIS, see these links:




No comments:

Post a Comment