Presentation is loading. Please wait.

Presentation is loading. Please wait.

DAT316 Implementing Microsoft SQL Server Express Steve Lasker Program Manager Microsoft blogs.msdn.com/SteveLasker.

Similar presentations


Presentation on theme: "DAT316 Implementing Microsoft SQL Server Express Steve Lasker Program Manager Microsoft blogs.msdn.com/SteveLasker."— Presentation transcript:

1 DAT316 Implementing Microsoft SQL Server Express Steve Lasker Program Manager Microsoft blogs.msdn.com/SteveLasker

2 Session Objectives and Agenda User Instances Exposed Visual Studio 2005/08 integration SQL Server Management Studio 2005/08 Express Techniques for deploying SQL Server Express SQL Server Express 2008 planned features Unique Scenarios of SQL Server Express

3 Session Objectives and Agenda User Instances Exposed How they work SQL Server Management Studio 2005/08 Express Visual Studio 2005/08 integration Techniques for deploying SQL Server Express SQL Server Express 2008 planned features Unique Scenarios of SQL Server Express

4 User Instances AKA “RANU” Run As Normal User

5 Users Instances Web Development Productivity

6 User Instances Web.config – uses |DataDirectory| AppDomain Property Bag set by ASP.NET Web Projects User Instances problematic for production deployment… DataDirectory = C:\Users\Stevelas\Documents\Visual Studio 2008\WebSites\WebSite2\App_Data

7 User Instances in Action Connect to Main Instance w/ User Instance connection string Parent Instance starts a User Instance and attaches the Db SQL Server Express User Instance First connection can take a while as the master databases are copied May timeout with failure – just try again, or set timeout = 60 seconds ASP.NET/ClickOnce Sets |DataDirectory| In AppDomain ASP.NET/ClickOnce Sets |DataDirectory| In AppDomain Connection returned for the database on the User Instance

8 Users Instance Startup First time creation of Services and Files

9 User Instances Exposed - Startup 1.Copies system databases into the user’s profile 2.Starts the User Instance as a user process 3.Passes the connection for the User Instance back to the calling application 4.Shuts down the User Instance after 60 minutes Use sp_configure ‘user instance timeout’ to configure the timeout duration Subsequent User Instance uses same system databases

10 User Instances Exposed - Services Uses a host service as the router Runs as a network service Launches the User Instance under the Users credentials Main instance throttles down

11 Session Objectives and Agenda User Instances Exposed SQL Server Management Studio 2005/08 Express Connecting to User Instance Visual Studio 2005/08 integration Techniques for deploying SQL Server Express SQL Server Express 2008 planned features

12 User Instances in SQL Server Management Studio Express Can’t create a user instance, but you can connect to an existing user instance

13 Connecting to a User Instance User Instance must be running to connect with SSMS Debug/Launch the app SSEUtil – Great troubleshooting tool Connect via Named Pipes sys.dm_os_child_instancesIdentify the pipe name for the User Instance with a Dynamic Management View sys.dm_os_child_instances Identifies owner of each User Instances Determine State (alive/dead) of each User Instance owning_principal_nameinstance_nameinstance_pipe_nameheart_beat DOMAIN\usernameBB26BAA2-B0CC-3B\\.\pipe\BB26BAA2-B0CC- 3B\tsql\query alive

14 Session Objectives and Agenda User Instances Exposed SQL Server Management Studio 2005/08 Express Visual Studio 2005/08 integration User Instances in Visual Studio Client Apps Managing multiple files ClickOnce deployment of SQL Server Express Techniques for deploying SQL Server Express SQL Server Express 2008 planned features

15 SQL Server Express on the Client Leveraging SQL Server Express within your Client application (Windows Forms, WPF)

16 ClientsServers From desktop to data centerFrom embedded devices to desktops Synchronizing data from the point of activity to the data center Enabling data movement from the smallest device, capturing data at the point of activity to the largest data center, enabling business insight

17 User Instances with Client Apps Creating a database in VS leverages User Instances: Add New Item from Project menu or Context menu New Connection dialog from Data Source Configuration Wizard Add Connection dialog from Server Explorer

18 ClickOnce Deployment Deploying the SQL Server Express runtime

19 ClickOnce for SQL Server Express Deploying the engine

20 Multiple Data Files Client Projects “Build” output files Great for development – if you know what’s happening As you edit test data under F5, the master is maintained Can be confusing – if you don’t know what’s happening “Disappearing data” New copy of the database is copied each time you (F5). Dangerous in deployment

21 User Instances – Managing Data Files Client Development Productivity & Gotchas

22 Pre Overwriting user data (Yikes!) Pre Update to Version 3 ClickOnce Deployment Concerns for database deployment Update to Version 2Install Version 1 Update App

23 Session Objectives and Agenda User Instances Exposed SQL Server Management Studio Express Visual Studio 2005/08 integration Techniques for deploying SQL Server Express Deploying database updates via ClickOnce Web deployment - Database Publishing Wizard SQL Server Express 2008 planned features

24 Deploying Databases as Scripts Using embedded scripts is the “best practice” when deploying databases and database updates Pros Maintains user data during upgrades Gives application control of database updates Uses standard T-SQL scripts to propagate database Supports installing database to custom location Cons Additional complexity to track database versions Small amount of new application code

25 Deploying Databases w/Scripts Maintaining User Data Maintaining App and the Database

26 Managing Script Deployments Set Data and Log File Properties CopyToOutputDirectory = Copy Never Build Action = None ClickOnce Files auto updated based on Build Action VerifyDatabase on App Startup Create initial database if NOT Exists If Exists(), check for version, and apply update scripts if necessary Embed Scripts as Resource Files Can copy/paste scripts with Management Studio Add Settings Property to track Database Version Add an AppInfo table to the database to track it’s version

27 SQL Server Express to the Web Moving your database from development to your hosting site

28 Deploying Databases to Websites Data Publication Wizard Standalone & Integrated into Visual Studio Database Publishing Wizard – Ability to script entire database and data for easy deployment to web hosted database Database Publishing Services Eases web deployment Web service tools available to Web Hosting companies Provide automated upload of database and scripts http://www.codeplex.com/sqlhost SQL Server Hosting Toolkit

29 Data Publication Wizard Generating scripts to publish your website

30 Session Objectives and Agenda User Instances Exposed SQL Server Management Studio Express Visual Studio 2005/08 integration Techniques for deploying SQL Server Express SQL Server Express 2008 planned features SQL Server Express improvements Management improvements Reporting Services improvements

31 New SQL Server Express 2008 Features Native x64 version of SQL Server Express New data types FILESTREAM Date, Time, DateTime2, DateTimeOffset Spatial Geodetic HierarchyID Integrated Full Text Search Change Tracking

32 New SQL Server Express features Development Sync Services for ADO.NET Language Integrated Query (LINQ) ADO.NET Entity Framework Management and Tools Import/Export Wizard Dynamic Management Framework Improved Generate Script Wizard Reporting Services Advanced Data Visualization (Enhanced Charts and Gauges) Export reports to Word Report Deployment without IIS

33 User Instances Roadmap

34 Session Objectives and Agenda User Instances Exposed How they work SQL Server Management Studio Express Connecting to User Instance Visual Studio 2005/08 integration Client & Web App usage ClickOnce deployment of SQL Server Express Techniques for deploying SQL Server Express Deploying database updates with Scripts & ClickOnce Web deployment - Database Publishing Wizard SQL Server Express 2008 planned features SQL Server Express improvements

35 ClientsServers From desktop to data centerFrom embedded devices to desktops Synchronizing data from the point of activity to the data center Enabling data movement from the smallest device, capturing data at the point of activity to the largest data center, enabling business insight

36 Resources Steve Lasker’s Blog Blogs.msdn.com/SteveLasker Blogs.msdn.com/SteveLasker Technical Communities, Webcasts, Blogs, Chats & User Groups SQL Server Express 2005 : http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=385&SiteID=1 http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=385&SiteID=1 SQL Server Express 2008: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1621&SiteID=1 http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1621&SiteID=1 SQL Server Express Blog: http://blogs.msdn.com/sqlexpress/http://blogs.msdn.com/sqlexpress/ Database Publishing Wizard http://www.codeplex.com/sqlhost http://www.codeplex.com/sqlhost Microsoft Developer Network (MSDN) & TechNet http://microsoft.com/msdn http://microsoft.com/technet http://microsoft.com/msdn http://microsoft.com/technet

37 Local Storage & Sync @ Tech Ed Upcoming Sessions Tuesday 10:45 WIN202 Introduction to Microsoft Sync Framework Tuesday 15:15 WIN307 Implementing Solutions that Leverage Microsoft Sync Framework Tuesday 15:15 DAT306 Optimizing Online, Enabling Offline with SQL Server Compact and Sync Services for ADO.NET Wednesday 10:45 DAT305 Microsoft SQL Server 2005 Compact Thursday 17:30 Tell Us Where it Hurts! SQL Server Product Feedback Friday 9:00 DAT317 Replication Best Practices and What’s New in SQL Server 2008 Friday 13:30 DAT314 The Future of Sync Services for ADO.NET: Better on SQL Server 2008 and the P2P Provider

38 Q&A

39 Resources Technical Communities, Webcasts, Blogs, Chats & User Groups http://www.microsoft.com/communities/default.mspx http://www.microsoft.com/communities/default.mspx Microsoft Learning and Certification http://www.microsoft.com/learning/default.mspx http://www.microsoft.com/learning/default.mspx Microsoft Developer Network (MSDN) & TechNet http://microsoft.com/msdn http://microsoft.com/technet http://microsoft.com/msdn http://microsoft.com/technet Trial Software and Virtual Labs http://www.microsoft.com/technet/downloads/trials/defa ult.mspx http://www.microsoft.com/technet/downloads/trials/defa ult.mspx New, as a pilot for 2007, the Breakout sessions will be available post event, in the TechEd Video Library, via the My Event page of the website Required slide: Please customize this slide with the resources relevant to your session MSDN Library Knowledge Base Forums MSDN Magazine User Groups Newsgroups E-learning Product Evaluations Videos Webcasts V-labs Blogs MVPs Certification Chats learn support connect subscribe Visit MSDN in the ATE Pavilion and get a FREE 180-day trial of MS Visual Studio Team System!

40 Complete your evaluation on the My Event pages of the website at the CommNet or the Feedback Terminals to win!

41 © 2007 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.

42 Typical Questions regarding Express

43 Custom Setup Wrappers Detect existing installations Dynamic download only if needed Detect service pack level Determine installed features Respond to system environment OS architecture Availability of Windows feature (eg. IIS for Reporting Services) Dynamically generate installation command line Perform custom deployment tasks Install/Upgrade database Create Logins and DB Users Configure application properties (eg. connection string)

44 Detection of existing installations Common methods: SQL WMI Provider Registry Keys The SQL WMI Provider will allow for the same detection code to work across versions starting with SQL 2005. This isn’t true for registry detection as registry keys will change. select * from SqlServiceAdvancedProper ty where SQLServiceType = 1 and ServiceName = ‘SQLEXPRESS' and (PropertyName = 'SKUNAME' or PropertyName = 'SPLEVEL') http://blogs.msdn.com/sqlexpress/archive/2006/07/29/faq-detecting-sql-server-2005- using-wmi.aspx

45 Custom Setup Wrappers public bool InstallExpress() { if (SQLExpress_Exists() = false) { // Use a new process to install SQL Server Express Process myProcess = new Process(); myProcess.StartInfo.FileName = @"\\Path\SQLEXPR.EXE"; // Set a custom command line myProcess.StartInfo.Arguments = @"/qn ADDLOCAL=Sql_Data_Files; INSTANCENAME=SQLEXPRESS; DISABLENETWORKPROTOCOLS=2; SQLACCOUNT=DOMAIN\User1"; myProcess.StartInfo.UseShellExecute = false; return myProcess.Start(); } When ClickOnce Pre-Req's aren't enough


Download ppt "DAT316 Implementing Microsoft SQL Server Express Steve Lasker Program Manager Microsoft blogs.msdn.com/SteveLasker."

Similar presentations


Ads by Google