SQL Server Training for Developers

1,949 views

Published on

http://www.intertech.com/Courses/CourseCategory.aspx?CategoryID=46

This is a slidedeck from an Oxygen Blast technical briefing Intertech delivered at Microsoft.

Published in: Technology
  • Be the first to comment

SQL Server Training for Developers

  1. 1. Davin Mickelson Intertech Instructor davin@intertech.com Copyright © Intertech, Inc. 2008. All Rights Reserved.
  2. 2. • 1st hour – SQL 2008 for Developers • Questions during 5 minute break • 2nd hour – Introduction to Linq Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 2
  3. 3. • I’m a developer - you’re a ____ • This talk is for anyone wanting to learn about SQL 2008 • I hope you learn some cool stuff here today Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 3
  4. 4. • SQL 2008 isn’t done yet – things will change! • SQL Server 2008 RTM scheduled for Q3 2008 • RC schedule for Q2 2008 • Latest Community Technology Preview (CTP) • Feb 2008 CTP released Feb 19th, 2008 • Free to everyone – go get it! • Latest news on SQL 2008 • Microsoft’s Data Platform Insider Blog • http://blogs.technet.com/DataPlatformInsider/ Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 4
  5. 5. • SQL 2005 to SQL 2008 • Reminiscent of SQL 7.0 to SQL 2000 transition • Not extremely different • SQL 2005 with new features • Advantages to Upgrading • Hot Add CPU – dynamically add CPUs to a running system (physical, logical and virtualization) • Exciting new features covered in this talk • Other feature not covered as well  Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 5
  6. 6. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 6
  7. 7. • Advantages of Upgrading • List below same for SQL 2005 as SQL 2008 • Security • Performance • x64, IA64 (Itanium) • Capacity • Scalability • Support from Microsoft Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 7
  8. 8. • Architectures of SQL Server 2008 • x86, x64, IA64 • Platforms • XP Pro, Win 2003, Win 2008, Vista • Developer Edition (x86, x64, IA64) • Can be upgraded later to Standard/Enterprise for production use • Express Edition (x86) • Like SQL 2005 Express, a replacement for MSDE Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 8
  9. 9. • Same two primary user interface tools as in SQL 2005: • Business Intelligence Development Studio (BIDS), which uses Visual Studio 2008 (Feb CTP!) • SQL Server Management Studio (SSMS) • Finally (in this latest release)… • BIDS now uses VS 2008 – not VS 2005! • VS 2005 / SQL 2008 Server Explorer connection (KB942246) • VS 2008 / SQL 2008 Server Explorer connection (KB945855) Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 9
  10. 10. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 10
  11. 11. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 11
  12. 12. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 12
  13. 13. • List of accounts is based on features installed • You need to set all the accounts before continuing • SQL Agent and SQL Database Engine • Run under weak account(s), member of users • Remaining accounts • Run under weak Windows service account(s) • Such as NT AUTHORITYLOCAL SERVICE Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 13
  14. 14. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 14
  15. 15. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 15
  16. 16. • Be patient during installation • Appears to lock up at times (but doesn’t!) • Adds several listings to Add/Remove Programs Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 16
  17. 17. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 17
  18. 18. •Add SQL features via Command Line •SQL Server Samples available on CodePlex •http://codeplex.com/SqlServerSamples/ •Link To Security Features Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 18
  19. 19. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 19
  20. 20. • SQL 2005 introduced SSIS to replace SQL 2000’s DTS (Data Transformation Services) as its primary ETL (Extract, Transform, Load) utility • SQL 2008 automatically upgrades SQL 2005 packages • SQL 2008 can now use ADO.NET source and destination components • Can also use new date and time data types Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 20
  21. 21. • Like Exchange 2007, PowerShell now used with SQL 2008 • PowerShell much like Linux/UNIX style shells (ls, for example) • Powerful scripting shell used for administrative purposes • Installed with SQL 2008, includes special SQL 2008 admin libraries • Exposes entire .NET 2.0 (required) framework! • Cmdlets: PS tools Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 21
  22. 22. • sqlcmd utility was introduced with SQL 2005 • Replacement for osql and isql • Executes ad hoc SQL queries or T-SQL scripts from a standard Command Prompt • Uses OLE DB provider (not SqlClient!) • Can be enabled from SSMS • PowerShell uses invoke-sqlcmd to call scripts • Uses SqlClient provider • Use SQL 2008 PowerShell launcher, sqlps or launch from SSMS Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 22
  23. 23. • sqlcmd Demo • Launch command prompt and start sqlcmd • Query authors from pubs table USE pubs SELECT * FROM authors GO • PowerShell Demo • Launch SQL 2008 PowerShell (sqlps) and use SQL Cmdlet • Query authors from pubs table Invoke-Sqlcmd -Query quot;select * from authorsquot; -Database quot;pubsquot; • get-help command • Launch via SSMS Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 23
  24. 24. • SQL 2008 security now more like Windows 2003/2008 security – least privileged authority • SQL 2008 ready for Windows Server 2008 and Vista’s UAC (User Access Control) • Installation/upgrade prompts you to rename “sa” account • The machine Administrators group members are no longer automatically sysadmin role • SQL 2005 Surface Area Configuration replaced by new Policy-Based Management feature (see SSMS) • Transparent Data Encryption (TDE) encrypts database at file level (when enabled) Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 24
  25. 25. • Policies are based on one or more Conditions • Conditions are based on one or more Facets • Policies are either enabled or disabled • Policies are enforced at various levels • On demand • On schedule • On change (cannot be enabled) Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 25
  26. 26. • Open SSMS • Inspect policy • Show conditions • Enable/disable • Exception message and hyperlink • Try to create one anyway! Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 26
  27. 27. • Database activities, changes and events can now be audited • Audits are created/managed at the database or server level Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 27
  28. 28. • Merely turn it on or off • When on, TDE provides automatic database file encryption (real- time I/O) for data and logs • Either use: • Server certificate • Server asymmetric key (not functional yet in Feb CTP!) • Different levels (AES - 128, 192, 256) and types (3DES) of encryption available • Protect tape/drive back ups if stolen. Back ups are encrypted as well! • Invisible to software using the database • Encryption affects performance for reading/writing (disk access) only • New T-SQL commands available for managing TDE keys (Creating, etc.) Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 28
  29. 29. • Start SSMS • Enable encryption on a database • Tasks – Manage Database Encryption • Database properties • Configure encryption level Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 29
  30. 30. • Sparse columns can save drive space • Sparse columns don’t store null • Sparse columns are optimized to hold null values • Best suited for columns that primarily hold null values in most rows (roughly 20-40%, advantage depends on column type) • Less storage but… • Non-null values take more space to store them Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 30
  31. 31. • Non-null data takes more space to store in sparse columns • Column on right displays space savings if column is at least 40% null Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 31
  32. 32. • Create a new table in SSMS • Define an ID column • Define another and set it to be a sparse column • Try to disallow nulls – whoops! Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 32
  33. 33. • New date and time types define higher precision storage of values • date - new (highly precise) date type • time - new (highly precise) time type • datetime2 – a more precise version of the classic datetime type • datetimeoffset – time zone aware presentation of date and time Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 33
  34. 34. • Three functions below use the Windows API for higher precision • SYSDATETIME • Returns current database system timestamp without time zone adjustment • SYSDATETIMEOFFSET • Returns current database system timestamp with time zone adjustment • SYSUTCDATETIME • Returns current database system timestamp based on Greenwich Mean Time Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 34
  35. 35. • Compression available in SQL 2008 Developer and Enterprise editions • Row Compression affects how the data is stored to disk • Only compresses simple data types (not images, datetime, varchar, etc.) • Page Compression works at a higher level, affecting the Row, Prefix and Dictionary compression • Wizard in SSMS calculates space savings Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 35
  36. 36. • Open SSMS • Right-click table and click Storage – Manage Compression • Choose Row or Page compression and click Calculate Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 36
  37. 37. • SQL 2008 allows you to store files, documents, images directly to the file system • This is a nice alternative to storing them as images in the database • FILESTREAM unites SQL 2008 with media files that were previously left unorganized and separate • Stores large varbinary (max) BLOB data as files on the NTFS file system • Files are accessible through standard T-SQL access • Best for 1MB+ files and when fast access is required Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 37
  38. 38. • In SQL 2005, UDTs were limited to 8,000 bytes in size • SQL 2008 are now unlimited is size • Treats your UDTs as Large Object (LOB) types • NOTE: UDTs under 8,000 bytes will still behave like SQL 2005 UDTs Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 38
  39. 39. • You can create SQL 2008 server groups and assign servers to them • One of them is the configuration server • The configuration server connects to each of the instances • You can perform multiserver queries from the query editor in SSMS • You can also push policies to all SQL instances in a group Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 39
  40. 40. • SSRS no longer relies on IIS (dramatic pause) • Utilizes its own authentication/authorization model • It can host ASP.NET and the SQL CLR • In this CTP version, there is a preview edition of the new (Office 2007 looking) Report designer • Much work still needed • With SharePoint integrated mode, SharePoint sites can view SSRS reports • Required: Reporting Services Add-in for SharePoint Technologies Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 40
  41. 41. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 41
  42. 42. • SSRS now supports many different authentication mechanisms • Windows • Forms • Basic • Custom • Uses built in ASP.NET security • Configure authentication in RSReportServer.config and web.config files of your ReportServer web site Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 42
  43. 43. • My new development laptop: • Vista Ultimate x64 SP1 • MSDN subscribers - go get SP1! • Intel Core 2 Extreme 2.60 GHz • 4 GB RAM DDR-2 800, NewEgg cost: $87.99! Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 43
  44. 44. • x64 – Intel and AMD 64 processors • Native software will state x64 as its type • Affordable • Used on servers as well as user machines • IA64 – Intel Itanium and Intel Itanium 2 • Different architecture • Used primarily on servers • Less user software offered for IA64 Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 44
  45. 45. • Higher performance! • Remember the move from 16-bit to 32-bit? • Memory – Use all 4GB of the installed memory • On x86, you can only use 3.5 GB of the physical memory • Watch out when ordering new servers with Windows Server preinstalled! What version (x86, x64) are you purchasing? • Are you ordering it with more than 4 GB of RAM? • Some x86 Windows Server 2003/2008 x86 editions can work with more than 4GB. Be wise with your decision. • The transition is happening; plan for the future. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 45
  46. 46. • C++/Assembly developers will have the most work for migrating code to x64 • .NET developers – you don’t have to change anything, unless your code touches unmanaged code • Exchange 2007 requires x64 architecture Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 46
  47. 47. • Most 32-bit games run fine on x64 platforms • Test for stability • Performance may be hindered • Some games have transitioned to x64 • FarCry (XP Pro patch), Half-life 2, etc. • Patches are available for x64 editions of games • For Choice of OS, choose between (x64) editions of XP Pro SP2, Vista, Server 2008 • I did successfully install Halo 2 on my laptop’s Server 2008 installation (once on Beta 3!) Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 47
  48. 48. • Several programs now offer x64 alternatives • (Freeware) 7-Zip has an x64 edition • Windows comes with a snappy x64 version of IE • Add-ons don’t work, though - and that’s okay! • (Freeware) JKDefrag has an x64 edition • Adobe Acrobat handles x64 automatically • Office 2007 runs fine of x64 version of Windows • Daemon Tools supports x64 • More drivers available now for x64 Windows • Check out x64 software web sites: • http://www.start64.com/ • http://www.iexbeta.com/wiki/index.php/Native_x64_Software • http://www.planetamd64.com/ Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 48
  49. 49. Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 49
  50. 50. • Many games now sport the logo • Watch for it in stores Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 50
  51. 51. • Andrew Troelsen is next with: • Introduction to Linq Copyright © Intertech, Inc. 2008 • www.Intertech.com • 800-866-9884 • Slide 51

×