Module 3
Module 3
OBJECTIVES
==========
- Strategies for upgrading SQL Server instances, services and databases to SQL Server
2017
- Strengths and Weakness of different migration strategies
- Ugrade existing instance to SQL Server 2017
NB: Editions
------------
Upgrades are permitted only between compatible editions of SQL Server
You can move from a lower featured edition to higher feature edition but not vice versa e.g.
SQL Server 2008 R2 Standard Edition -> SQL Server 2017 Standard/Enterprise Edition
SQL Server 2008 R2 Enterprise Edition -\-> SQL Server 2017 Standard Edition ✘ not allowed
Side-by-side Upgrade
--------------------
Databases are migrated from the existing SQL Server instance to a new SQL Server 2017
instance
Migrations are carried out using;
- database backups
- detach and reattach of data files
- data transfer between databases using the Copy Database Wizard
- BCP
- SSIS or another ETL tool
Less risk than an in-place upgrade because the original system stays in place - can be
restored back to production should an upgrade issue arise
Side-by-side upgrade routes
1. One server
The new instance (SQL Server 2017) is installed alongside the instance to be
upgraded on the same machine.
2. Two servers
New instance is installed on a different machine from the existing instance
NB:
Both routes require sufficient hardware resources provided for both instances.
A side-by-side upgrade is an alternative where there is no in-place upgrade path
Issues
- Configuration of server-level objects and services on the new instance - SQL Server
Agent jobs, logins etc.
- Time taken to copy all the user databases to a new location
- Disk space to hold all the data being transferred
- For one server side-by-side upgrades, some SQL Server versions cannot be
installed side-by-side on the same machine
IN-PLACE SIDE-BY-SIDE
Mostly automated -you can modify the More granular control over process
features and editions if need be.
System data upgraded - shared components Use to perform test migration - can be used
as a test bed. Create a side by side copy,
take data out from live and test it before
moving to production.
Quicker deployment
Hybrid Options
---------------
Strategy that is a combination of some features from an in-place upgrade and side-by-side
upgrade
e.g Rather than copying all the user databases, after installing the new version of SQL
beside the existing version and migrating all the server level objects
you can detach user databases from the previous instance and reattach them to the new
instance
After databases have been attached to the new instance, they cannot be reattached to the
old instance.
This holds true even if the database compatibility settings have not been upgraded
Rolling Upgrade
----------------
This is more complex approach that maximises uptime and minimizes risk that is used
when upgrading an instance wthat employs High Availability functionality.
HA Features it is dependent on
- Always-on availability groups
- Failover clustering
- Mirroring
- Log shipping: process of automating the backup of transaction log files on a primary
database server and then restoring them onto a standby server
- Replication
- Reporting Services scale-out
NB:
Results from the utility are only as representative as the content of source trace data files.
Consideration of how long the trace that captures client activity needs to run to capture a
representative workload and trade this off against the size of the captured data
SQL Server Profiler trace data file are preprocessed before being used by the Distributed
Replay Utility
- Follows upgrade criteria for updating the Database engine as it is user database
- All upgrade methods require the following additional steps;
- Upgrade the schema of the MDS database using the Upgrade Database Wizard in
Master Data Services Configuration Manager
- any customizations of objects in the MDS are overwrriten by this upgrade
- Install SQL Server 2017 Master Data Services web application
- After schema upgrade, old versions of MDS web app will no longer be able to
conncet to Database
- Upgrade any clients using Master Data Services Add-in for Excel to the SQL Server
2017 version
- Clients using the old version of the add-in will no longer be able to connect
- An inplace upgrade of MDS can be executed without upgrading the database engine
hosting it
- Servers running Analysis Services in SharePoint mode can undergo side-by-side or in-
place upgrades
- PowerPivot for SharePoint Add-In is always installed side-by-side with ealier versions and
cannot be upgraded in-place
- When Power Pivot for SharePoint is upgraded to SQL Server 2017, admin must install or
upgrade SharePoint components in the SharePoint server or server farm.
- Upgrade prerequisites and procedure for Power Pivot varies depeding on whether you
are using SharePoint 2010 and SharePoint 2013. But in summary;
- Upgrade all servers running Analysis Services in SharePoint mode (at a minimum, the
PowerPivot instance must be upgraded)
- Install and configure SQL Server 2017 Power Pivot for SharePoint Add-in on all
servers in the SharePoint farm.
In a multiserver when the upgrade is completed on one server, the other servers are
unavailable until they are upgraded.
- The upgrade will not upgrade Power Pivot workbooks that run on the SharePoint servers,
but workbooks created by previous versions of Power Pivot for Excel will continue to function
ok.
- The exception to this, is workbooks using scheduled data refresh. These workbooks
are required to use a version of PowerPivot for Excel that matches the server version.
- These workbooks must be manually upgraded or use the auo-upgrade for data
refresh feature in SharePoint 2010.
NB:
- Two server side by side upgrade of databases involved in replication requires the
following;
- reconfiguration of replication
- providing a new snapshot to be delivered to subscribers
- To avoid the above strenous tasks, the server and database names on the new server
must match those of the old server. This can create complexity in the upgrade plan.
- SQL Server supports replication of data between nodes running different versions of SQL
Server.
- This means that nodes can be upgraded independently without halting activity across
the SQL Server replication topology.
- When log reader agent is running for transactional replication, any activity on the
database must be stopped, to allow the log reader agent to process any pending operations
before stopping it to complete the upgrade process.
For merge replication instances, the Merge Agent and Snapshot Agent must be run for
each subscription following an upgrade
NB:
- One server side-by-side upgrades are only supported for Reporting Services running in
native mode
- An in-place upgrade cannot be used to switch a Reporting Services installation
between native and SharePoint mode
- Reporting services using scale-out deployment - deployment includes more than one
report server - all memebers of the scaled-out deployment group must be removed before
upgrading them. As servers are upgraded, members of the scaled-out deployment group can
then be added back individually.
***** Check out Copy Databases with Backup and Restore ****
https://docs.microsoft.com/en-us/sql/relational-databases/databases/copy-databases-with-
backup-and-restore?view=sql-server-ver15
Disadvantages of SMO
--------------------
- Slower than Detach/Attach or using a Backup
- The process of copying the data is vulnerable to network connectivity issues.
- As the source database remains available during the copy operation, it is
important that client applications are not permitted to make changes to the source database
during the operation - to ensure the source and target databases are in a consistent state.
Achieving the same manually
---------------------------
- To carry out steps similar t
o the Copy Database wizard manually;
- Write SMO scripts or script database objects using TSQL
- Create your own SSIS package to transfer the data or use an alternative tool
e.g. BCP.exe
- Regardless of whether it is done manually or using the wizards the same pros and
cons still apply.
Contained Databases
-------------------
- Supported in SQL Server 2012, 2014 and 2016
- Contained database provides facilites that are normally at the instance level in the
database level (e.g. user authentication).
- Contained database users;
- users with passwords stored in the database
- can be used to break dependency between logins and database users.
- Containment levels determine which features to carry out at instance level and which
ones at database level
- Partial
- Full
Orphaned Users
--------------
- These are users with logins that are not linked to the SQL Server instance.
- Orhpaned users are allowed exist and have object permissions assigned to them but
cannot login directly to a database.
- Users can be orphaned for two reasons
1. The login was deleted after the user was created
2. The database has been restored or attached from another SQL Server instance;
the linked login has not been created on the new instance.
EXEC sp_configure
Run these commands on both the source and target instance and compare to determine
which settings to change.