Professional Documents
Culture Documents
DATABASE
MIGRATION
SQL Server 2016 - SQL Server 2019
WHAT IS MIGRATION IN SQL?
Component Requirement
Hard Disk SQL Server requires a minimum of 6 GB of available hard-disk space.
Internet Minimum
Express Editions: 512 MB
All other editions: 1 GB
All other editions: At least 4 GB and should be increased as database size increases to ensure
optimal performance.
Processor Speed Minimum: x64 Processor: 1.4 GHz
Note:
Installation of SQL Server is supported on x64 processors only. It is no longer supported on
x86 processors.
Software Requirements
Component Requirement
Operating system Windows 10 TH1 1507 or greater
Network Software Supported operating systems for SQL Server have built-in
network software.
Note: SQL Server Setup installs the following software components required by the product:
SQL Server Native Client
SQL Server Setup support files
PRE-MIGRATION PLAN
● SQL SERVER DATABASE MIGRATION PATHS:
○ Source Server: 2016
○ Destination Server: 2019
○ In-Place: With the help of SQL Server Setup program users can directly upgrade the running
instance of Server 2016 to SQL Server 2019. An earlier instance of MS SQL Server will be replaced.
○ Side-by-side: With steps to migrate multiple or some data from an instance of SQL Server (2016) to
the separate instances of SQL Server 2019. There are two types of variations of the side-by-side
upgrade strategy:
Action Item In Place Upgrade Parallel or Side by Side Upgrade
Upgrade Efforts ● Minimum ● Efforts needs to be planned
● Upgrade is Automated ● Manual migration
● No data migration Needed ● Data migration required
Server Name and IP ● No changes in Server and SQL server instance ● Server and IP address will change
● Application can continue using same server Name and IP ● All application needs to change their connection to connect to new
Address server with new IP address
Testing ● Testing is relatively faster as same testing script and be ● Thorough testing required as there are chances to a configuration
used once upgrade is completed mismatch
● Testing needs to be planned and new testing script required since
Server Instance has changed for testing script
Rollback ● Rollback usually is rebuilding the whole system ● Rollback is very easy as production system remains online during
● Requires backup of all configuration, databases including migration, if testing fails, it can be remediated with no downtime
system databases required and all application can connect to previous Online
production system
SQL Versioning and Architecture ● Versioning upgrade would be possible with same ● Since it would be new install, any version with any architecture can
architecture (32 bit to 32 bit), 32bit to 64 bit is not be installed and tested
supported
● TASK AT SOURCE SERVER
○ Roll up all required Service Packs, Updates, and Hotfixes (fix a single issue). Microsoft SQL Server
2016 can directly transfer to MS SQL server 2019 after achieving these below Service Packs:
■ SQL Server 2016: SP1.
■ SQL Server 2016: SP2.
○ Run DBCC CHECKDB :command on all databases to be sure that they are in the consistent state.
○ Run the Upgrade Advisor Tool: Is a great tool provided by Microsoft to help you understand what
needs to be changed within the database before and after migration.
○ Linked Servers
--LINKED SERVERS
SELECT *
FROM SYS.SYSSERVERS
○ Collect the information of dependent applications
○ Database logins, users and their permissions.
○ Maintenance plans.
○ SQL Agent Job
○ Check Orphan users and Orphan fix
--CHECK ORPHAN USERS
SP_CHANGE_USERS_LOGIN 'REPORT'
GO
--CHECK ORPHAN USERS FIX
USE
MASTER
CREATE LOGIN [LOGINNAME] WITH PASSWORD = ‘LOGIN@123’,
SID = USERSID
✓ Stop all applications services with database connected with the database
✓ Set the database to read only mode (if required)
✓ Take latest backup of the database
✓ Restore the latest copy of the database to the new server
✓ Check database compatibility lever after restore
✓ Migrate all user logins and windows logins to new server
✓ Enable trustworthy database setting
✓ Verify the orphan users and fix the same
✓ Execute DBCC UPDATEUSAGE command to correct pages and row counts on migrated data
✓ Rebuild all indexes on newly migrated database
✓ Upgrade statistics on migrated database
✓ Recompile all stored procedures, functions and triggers with sp_recompile.
✓ Deploy your high availability and disaster recovery plans (if any)
✓ Test the application and correct errors (if any)
POST-MIGRATION PHASE
AFTER THE MIGRATION IS COMPLETE IT IS IMPORTANT TO PERFORM THE FOLLOWING TASKS:
❏ UPGRADE DATABASE COMPATIBILITY LEVEL: THE DATABASE COMPATIBILITY LEVEL NEEDS TO BE MANUALLY CHANGED
ON THE 2016 INSTANCE
❏ RUN DBCC CHECKDB WITH DATA_PURITY: CHECKS FOR INVALID DATA VALUES BASED ON COLUMN DATA TYPE
❏ RUN DBCC UPDATEUSAGE: CORRECTS PAGE COUNT INACCURACIES TO REFLECT ACCURATE INFORMATION WHEN USING
SP_SPACEUSED
❏ UPDATE STATISTICS: BRINGS DATABASE STATISTICS ARE UP TO DATE TO ALLOW THE QUERY OPTIMIZER TO CHOOSE
THE BEST QUERY PLAN
❏ TAKE A FULL BACKUP OF THE DATABASE: MAKE SURE YOU CAN RECOVER THE DATABASE WITH ALL OF THE MIGRATION
EFFORTS
❏ POINT THE APPLICATION TO THE NEW DB SERVER IP (CONNECTION STRING ETC TO ALTERED BY THE
APPLICATION SUPPORT TEAM)
❏ RESTART NETWORK CONNECTIONS BETWEEN ALL STAKE HOLDING SERVERS (NETWORK TEAM)
❏ CHECK THE SQL SERVER ERROR LOG AND WINDOWS ERROR LOGS FOR ANY FAILURES.