Dandy Weyn Technical Development Manager Microsoft Session Code: DAT308 Your key to success … Understanding Upgrade Strategies Plan for Upgrade Perform the Upgrade Post-Upgrade Upgrade Path Considerations SQL SERVER VERSIONS 2000 SP4+ 2005 SP2 + COMPONENTS DB Engine RS NS * AS DTS IS Developer Enterprise EDITIONS Desktop Workgroup Personal Standard PLATFORMS 32-bit 64-bit (IA64 and x64) LANGUAGES All 2000 All 2005 In Place Upgrade Pros Easier, mostly automated, generally fast overall process System data upgraded May require no additional hardware Applications remain pointing to same server/DB Cons Less granular control over upgrade process – all or nothing Instance remains offline during part of upgrade Not best practice for all components Rollback Strategy SQLSQL Server 2008 Server Instance 2000/5 Instance Upgrade Upgrade Process Point of no return Instance is still available Install prerequisites Check for upgrade blockers Install SQL Server 2008 binaries 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 Side by Side SQL Server 200x Instance SQL Server 2008 Instance Compare and Verify Verified! Install new instance of SQL Server Transfer using: Copy Database Wizard Detach -> Copy -> Attach Backup -> Restore T-SQL Scripts, BCP , Break SAN mirror -> attach Upgrade Options Side-by-Side Pros 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 Cons Usually require additional hardware Server/database name changes Not practical for VLDB unless utilizing SAN (hybrid approach) 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 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 Additional ANSI SQL standards enforcements in 2008 (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 Some Known Compatibility Issues Poorer performance after upgrade Review or remove query hints Do full updated statistics Queries take longer to run after upgrading to SQL Server 2008 Review TempDB utilization Run DB Tuning Advisor Seek Customer Support for excessive issues Use different sampling size for large tables Optimize via storage isolation Some Known Compatibility Issues Cannot access SQL Server after upgrade Clients can no longer connect to the database server or related components Check Configuration Manager settings “off-bydefault” is in place for features and access methods Surface Area Configuration Manager removed Upgrade Advisor 17 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) 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 InPlace 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 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 Long-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 Dandy Weyn – dandyw@microsoft.com Complete an evaluation on CommNet and enter to win an Xbox 360 Elite! Related Content SQL Server 2008 Upgrade Technical Reference Hands-on-Labs: DAT23 – Upgrading from SQL2000/2005 to SQL Server 2008 Resources www.microsoft.com/teched www.microsoft.com/learning Sessions On-Demand & Community Microsoft Certification & Training Resources http://microsoft.com/technet http://microsoft.com/msdn Resources for IT Professionals Resources for Developers © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.