Upgrading to SQL Server 2008 R2 and SQL Server codename “Denali” Dandy Weyn What is an upgrade? Existing version of SQL Server to a higher version Upgrade versus Migration SQL Server Migration Assistant What people try to accomplish… VIRTUALIZATION HAPPY UPGRADE CONSOLIDATION Upgrade Methods • • • • Less granular control over upgrade process Instance remains offline during part of upgrade Not best practice for all components Considerations for Rollback Strategy • • • • More granular control over upgrade process at DB level Can be used to perform test migration Ability to run systems side-by-side for parallel runs Relatively straightforward rollback strategy • • • • • • More granular control over upgrade process at DB level Can be used to perform test migration Ability to run systems side-by-side for parallel runs Relatively straightforward rollback strategy Goes frequently together with OS upgrade Goes frequently together with platform upgrade (x86>x64) • • • • • • • Easier, mostly automated, generally fast overall process System data upgraded May require no additional hardware Applications remain pointing to same server/DB Usually require additional hardware Server/database name changes Not practical for VLDB unless utilizing SAN • • • Requires additional Hardware Server/Database name changes Not practical for VLDB unless utilizing SAN In Place Upgrade Process Point of no return Instance is still available Install SQL Server binaries Install prerequisites Check for upgrade blockers Stop service Redirect services to new binaries Start service in single-user mode Instance is no longer available Attach resource database Stop service Restart service Execute various upgrade scripts Start updating all databases Partial availability starts here Remove old binaries Instance becomes available Important steps for a happy upgrade experience PRE UPGRADE Plan and Assess Understand Upgrade Strategies Clean your environment Have a backup THE UPGRADE Document Upgrade Determine Success POST UPGRADE Decommission Document Get Ready for More Your Key to Success … • • • • Understanding Upgrade Strategies Plan for Upgrade Perform the Upgrade Post-Upgrade Tools • SQL Server Upgrade Advisor • SQL Server Best Practices Analyzer In Place Upgrade • • • • Copy Database Wizard Backup / Restore SSIS Object Transfer Attach / Detach Upgrade Path Considerations SQL SERVER VERSIONS 2000 SP4+ 2005 SP2 + COMPONENTS DB Engine RS NS * AS DTS IS Standard Developer Enterprise EDITIONS Desktop Workgroup Personal PLATFORMS 32-bit 64-bit (IA64 and x64) LANGUAGES All 2000 All 2005 Pre-Upgrade Considerations • Document existing SQL Server solution • • • • sp_configure SQLDIAG.EXE sp_dboption Configurations: SAN, networks, and security • Capture performance baseline data • System level (WMI, Counters, etc.) • Application level (query response, concurrent users, etc.) • Develop criteria and unit / verification tests • Optional: capture plans for complex queries Deciding on Upgrade Strategy • Upgrade In-Place or Side-by-Side • Database size and number of objects • Local maintenance jobs • Tolerance for downtime • Hardware capacity / age • System dependencies & other applications • Back-out time Pre-Upgrade Tasks: Backward Compatibility • Some features are discontinued: They do not appear in SQL Server 2008 R2 / Denali • Examples • • • • • Undocumented system stored procedures Virtual cube Virtual dimension DUMP / LOAD database Backup with TRUNCATE ONLY • Some are deprecated: • They won’t be supported in a future SQL Server release (e.g. Notification Services) Some Known Compatibility Issues • Applications work fine on 8.0/9.0 compatibility mode but fails in 10.0 mode or higher Additional ANSI SQL standards enforcements in 2008/R2 (e.g. left and right outer joins using *= and =* no longer supported) Modify SQL statements to be standards compliant (will still work if in 8.0 compatibility mode) Some Known Compatibility Issues • References to system and/or undocumented objects Accessing system tables/stored procedures or undocumented features may/will fail or behave differently Utilize Dynamic Management Views and Functions e.g. syslocks sys.dm_tran_locks Undocumented objects are not supported, ever My queries run longer – what now? Review or remove query hints Do full updated statistics Review TempDB utilization Queries take longer to run after upgrading Run DB Tuning Advisor Seek Customer Support for excessive issues Consider rewrite and evaluating new functionality Use different sampling size for large tables Optimize via storage isolation Some Known Compatibility Issues • Cannot access SQL Server after upgrade “off-by-default” is in place for features and access methods Clients can no longer connect to the database server or related components Check configuration Surface Area Configuration Manager removed Pre-Upgrade Tasks: Outside Forces • Database Solutions • COM Components • Extended Stored Procedures • sp_OA% • CLR assemblies • Linked Servers • Cross-database dependencies • DTS packages Pre-Upgrade Tasks: Outside Forces • Some editions have a different feature set • Example: Express does not have SQL Server Agent • No substitute for knowing your application! • Especially if supporting international versions Post-Upgrade Tasks • Immediate Tasks • Decision whether to roll back • Ensure performance • Resource Planning • Short-Term • Medium-Term • Long-Term Immediate Post-Upgrade Tasks • Review all logs • Revisit Upgrade Advisor recommendations • Update statistics to ensure performance • Full if possible • Sample for very large tables • Reconfigure Log Shipping (if upgraded from 2000) No direct upgrade path to Denali from SQL Server 2000 Immediate Post-Upgrade Tasks • Re-populate Full-Text catalogs • Verify Agent jobs and maintenance tasks • Verify security settings • Especially cross server and/or cross-domain access privileges • Check database consistency • DBCC CHECKDB • DBCC UPDATEUSAGE (for 2000 upgrades) Immediate Post Upgrade Tasks • Configuration Manager • Critical for Side-By-Side to reset environment, protocols, etc… • Upgrade process “tries” to preserve functionality for In-Place • Size and configure tempdb correctly • DBCC CHECKDB, CTEs, Cursors, MARS, Row Versioning, Service Broker, Triggers • Verify MODEL database • Verify MASTER database • Perform unit / verification tests • Commit upgrade or rollback! Short-Term Post Upgrade Tasks • Data Types • Take advantage of new data types • From 2000: NVARCHAR(MAX), VARCHAR(MAX), VARBINARY(MAX), XML • From 2000/2005: Filestream, spatial, date, time, hierarchyID • Even more new datatypes in SQL Server Codename “Denali” • Persisted columns • Index persisted columns • Database options • • • • DB_CHAINING, EXECUTE AS PAGE_VERIFY CHECKSUM Evaluate AUTO_UPDATE_STATISTICS_ASYNC Evaluate PARAMETERIZATION Short-Term Post Upgrade Tasks • Partitioned Tables • Enterprise Edition • Partitioned Views -> Partitioned Tables • Appropriate lock escalation setting • Database Files / Filegroups • Performance Benefits • sp_configure ‘affinity mask’ • sp_configure ‘affinity I/O mask’ • Management Benefits • Reports, DMVs (including new and changed), etc. • Database Tuning Advisor Medium-Term Post-Upgrade Tasks • Re-evaluate Optimizer Hints • Remove or document reasons to retain • Online operations • Enterprise Edition • Row Versioning • Evaluate Read Committed Snapshot Isolation (RCSI) • ALLOW_SNAPSHOT_ISOLATION • READ_COMMITTED_SNAPSHOT Medium-Term Post-Upgrade Tasks • Re-evaluate Indexed Views • Definition of “determinism” has changed • Custom aggregations • Re-evaluate indexes • Optimizer has changed • Database Engine Tuning Advisor • Re-evaluate statistics • Sampling • Automatic • Manual Longer-Term Post-Upgrade Tasks • Re-write “COM components” as CLR • XPs to C# or VB in CLR • Custom CLR types in 2005 • E.g. date, time, spatial • Deprecated Features • xp_sendmail / SQL Mail • Data types Long-Term Post-Upgrade Tasks • DTS Packages • Especially if “upgrade” from 2000 to 2005 then 2008 without re-write • Security • Schemas • Different encryption options • New audit capabilities • There are many more! • Especially for 2000 upgrades – see Books Online Upgrading Mirrored Databases to SQL Server 2008 R2 • • • Rolling upgrades supported to minimize impact Mirror version has to be equal or newer than Principal At least one manual failover required; failback is usually performed but not required (dependent on setup) • Ensure system can do both without issues prior to upgrade especially if using any SAN replication technologies (e.g. SRDF, Business Copy, etc…) • Consider temporarily disabling SAN replication but be aware of risks • Typical upgrade flow • Remove Witness (for HA configuration only) • Witness can be upgraded anytime after removal • • • Switch to High Safety mode (if current mode is different) Upgrade MIRROR instance, allow to rejoin Database Mirroring pair and synchronize Failover to MIRROR and upgrade original PRINCIPAL, allow to rejoin as the new MIRROR and synchronize • Failback if appropriate • Re-establish witness and/or High Performance mode where applicable Upgrading Replicated Databases • Mixed versions are supported but • Distributor version must always be equal or newer than Publisher • Subscribers for transactional replication can be within 2 versions newer/older of Publisher • Subscribers for merge replication must be equal or older than Publisher • Verify features supported by editions before upgrade, especially for 2000 MSDE 2005 Express • E.g. Merge in Express 2008 is subscriber only • Process is similar to 20002005 upgrade • 20002008R2 is supported • Update agent security settings post upgrade to reflect new security model (2008 and 2005 have same security model) • Typical upgrade flow: Distributor, Publisher, Subscriber Upgrading Log Shipped Databases • Upgrade from 2000 to 2008R2 is not supported; migrate using same method as 20002005 • Monitor server instance can be updated anytime but monitoring is stopped until completed – Log Shipping itself is not affected • Secondary server must be upgraded first • Instance is upgraded first but DB remains 2000/2005 because it is offline; upon failover/recovery it automatically upgrades • Logs are accumulated during upgrade and applied when done • Primary can be upgraded with • Less downtime – requires failover and re-establish Log Shipping after upgrade • Less effort – no failover but system is unavailable during upgrade of primary • Typical upgrade flow: • Less downtime – upgrade secondary, failover, upgrade primary, establish Log Shipping, failback, establish Log Shipping • Less effort – upgrade secondary, allow catch-up, upgrade primary Upgrading Analysis Services • 20052008 R2 typically upgraded via 2008R2 setup • 20002008 R2 upgrade via setup supported but sideby-side upgrade recommended using AS Migration Wizard • Migration Wizard requires DSO backwards compatibility components which are not installed by default – remember to select option during setup or add component before migration • Typical upgrade flow • setup: run 2008 R2 setup, select upgrade workflow, select 2000/2005 AS instance to upgrade • migrate: install 2008 R2 AS, run AS Migration Wizard and follow workflow Upgrading Reporting Services • Upgraded via 2008 R2 Setup • Different patch level requirements from RDBMS • RS2000: Service Pack 2 or later • RS2005: RTM or later • Manual upgrade for RS server using a remote SQL Server 2000 database • RS2000 report server endpoint is no longer supported • Reporting Services 2008 R2 uses native http.sys • Typical upgrade workflow • Run 2008R2 setup, select upgrade workflow for RS, select report server instance to upgrade Upgrading Integration Services (and DTS) • DTS upgrade supported as side-by-side installation – DTS has no dependency on SSIS • Upgrade does not automatically migrate DTS packages to SSIS format – run migration wizard • Consider converting DTS source packages to native SSIS • Conversion tool available from Microsoft partners such as www.dtsxchange.com Upgrading Log Shipping Cannot upgrade Log Shipping 2000 Switchover to standby Upgrade primary Migrating with failover Log Shipping in 2008 R2 does not use DB Maintenance Plan Wizard Switchback Upgrade standby Re-establish Log Shipping or other HA technology Upgrade primary Migrating without failover Upgrade secondary Re-establish Log Shipping or other HA technology Stay up to date with TechNet Belux Register for our newsletters and stay up to date: http://www.technet-newsletters.be • Technical updates • Event announcements and registration • Top downloads Join us on Facebook Download MSDN/TechNet Desktop Gadget http://www.facebook.com/technetbe http://bit.ly/msdntngadget http://www.facebook.com/technetbelux LinkedIn: http://linkd.in/technetbelux/ Twitter: @technetbelux TechDays 2011 On-Demand • Watch this session on-demand via TechNet Edge http://technet.microsoft.com/fr-be/edge/ http://technet.microsoft.com/nl-be/edge/ • Download to your favorite MP3 or video player • Get access to slides and recommended resources by the speakers THANK YOU