Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Building Management Applications with SQL Server “Yukon” SQL Management Objects (SMO): Overview Bruce Prang Development Manager Microsoft Corporation.

Similar presentations


Presentation on theme: "1 Building Management Applications with SQL Server “Yukon” SQL Management Objects (SMO): Overview Bruce Prang Development Manager Microsoft Corporation."— Presentation transcript:

1 1 Building Management Applications with SQL Server “Yukon” SQL Management Objects (SMO): Overview Bruce Prang Development Manager Microsoft Corporation bprang@microsoft.com Bruce Prang Development Manager Microsoft Corporation bprang@microsoft.com Session Code: DAT360

2 2 What is SMO SQL Server Management Objects Programmatic object model for DDL operations Use it for creation, management, discovery, configuration of Sql Servers.NET Class Library Not a total abstraction of Sql Server SQL Server Management Objects Programmatic object model for DDL operations Use it for creation, management, discovery, configuration of Sql Servers.NET Class Library Not a total abstraction of Sql Server

3 3 Some of the Design Goals 100% coverage of Sql Server features Improve scalability and performance Simple to use, but rich object model High level of control over object model behavior Advanced scripting capabilities Build SQL Server Workbench on it 100% coverage of Sql Server features Improve scalability and performance Simple to use, but rich object model High level of control over object model behavior Advanced scripting capabilities Build SQL Server Workbench on it

4 4 Object Model Databases Server ConnectionContext Database SqlAssembly FileGroup Tables Table Assemblies FileGroups JobServer Jobs Job Alerts Alerts Shared Schedules Job Schedule

5 5 SMO – lets see it Ovidiu Craciun ovidiuc@microsoft.com Sql Server Management Tools Ovidiu Craciun ovidiuc@microsoft.com Sql Server Management Tools

6 6 SMO SMO Architecture Utility Classes Instance Classes Scripter Classes Management Application WMI Provider Enumeration Component Connection Class (SQL Server.NET Data Provider) SQL Server Configure/Enum

7 7 SMO Features Optimized instantiation of objects Scripting – Basic and Advanced Capture of Transact-SQL Support for new Yukon features Use of.NET types E.g. DateTime, Timespan instead of scaled long integers, etc. Management Object Model for SQL Services and Configuration (through WMI Provider) Optimized instantiation of objects Scripting – Basic and Advanced Capture of Transact-SQL Support for new Yukon features Use of.NET types E.g. DateTime, Timespan instead of scaled long integers, etc. Management Object Model for SQL Services and Configuration (through WMI Provider)

8 8 Feature Overview Optimized Instantiation Instance Classes support “optimized (delayed) instantiation” Object states 1: Partially instantiated (some properties available) 2: Fully instantiated Full instantiation is triggered when a property is called that has not been retrieved yet, or when a method is called that requires a missing property Instance Classes support “optimized (delayed) instantiation” Object states 1: Partially instantiated (some properties available) 2: Fully instantiated Full instantiation is triggered when a property is called that has not been retrieved yet, or when a method is called that requires a missing property

9 9 Feature Overview Optimized Instantiation Can be controlled by programmer DefaultInitFields, PrefetchObjects Fits any scenario Can be controlled by programmer DefaultInitFields, PrefetchObjects Fits any scenario Memory optimal Network/Query optimal Delayed instantiation per object [default] Many objects fully initialized

10 10 SMO – lets tune it Ovidiu Craciun ovidiuc@microsoft.com Sql Server Management Tools Ovidiu Craciun ovidiuc@microsoft.com Sql Server Management Tools

11 11 Feature Overview Capture Mode All Transact-SQL generated by performing actions on SMO objects can be captured or recorded This is NOT transactional, it is only capture WorkBench Dialogs use this capability to script operations All Transact-SQL generated by performing actions on SMO objects can be captured or recorded This is NOT transactional, it is only capture WorkBench Dialogs use this capability to script operations

12 12 Feature Overview Scripter Class Basic Scripting All DMO Scripting options will continue to be supported Script interface on individual classes will also be available (same as SQL-DMO) Advanced Scripting Filtering, available in multiple places List modification Object modification Progress and Error events Basic Scripting All DMO Scripting options will continue to be supported Script interface on individual classes will also be available (same as SQL-DMO) Advanced Scripting Filtering, available in multiple places List modification Object modification Progress and Error events

13 13 Scripting Phases /****** Object: Table [employee] Script Date: 9/28/2001 4:02:31 PM ******/ if not exists (select * from dbo.sysobjects where id = object_id(N'[employee]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) BEGIN CREATE TABLE [employee]( [em p_id] [empid] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [fna me] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [mi nit] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS, [lna me] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [job _id] [smallint] NOT NULL CONSTRAINT [DF__employee__job_id__1B0907CE] DEFAULT (1) Single phase without manipulation

14 14 Scripting Phases List Generation Script Generation ManipulationDiscoveryManipulation /****** Object: Table [employee] Script Date: 9/28/2001 4:02:31 PM ******/ if not exists (select * from dbo.sysobjects where id = object_id(N'[employee]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) BEGIN CREATE TABLE [employee]( [em p_id] [empid] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [fna me] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [mi nit] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS, [lna me] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [job _id] [smallint] NOT NULL CONSTRAINT [DF__employee__job_id__1B0907CE] DEFAULT (1)

15 15 How Did We Get Here? SQL Server 6.x– SQLOLE SQL Server 7.0– SQL-DMO SQL Server 2000– SQL-DMO SQL Server Yukon– SMO Architectural limitations in DMO Needed a.Net class library Needed Full Support in object model SQL Server 6.x– SQLOLE SQL Server 7.0– SQL-DMO SQL Server 2000– SQL-DMO SQL Server Yukon– SMO Architectural limitations in DMO Needed a.Net class library Needed Full Support in object model

16 16 Backwards Compatible SMO Supports SQL Server 7.0 SQL Server 2000 SQL Server “Yukon” COM callable wrappers for Script DMO “Yukon” Shipping in the Yukon box Works against “Yukon” No new Yukon features SMO Supports SQL Server 7.0 SQL Server 2000 SQL Server “Yukon” COM callable wrappers for Script DMO “Yukon” Shipping in the Yukon box Works against “Yukon” No new Yukon features

17 17 SMO – a little more Ovidiu Craciun ovidiuc@microsoft.com Sql Server Management Tools Ovidiu Craciun ovidiuc@microsoft.com Sql Server Management Tools

18 18 SQL Server Resources Week long SQL Server “Ask the Experts” lounge in: Foyer outside Room 309 Support for SQL Server “Yukon” PDC Preview at SQLJunkies http://www.sqljunkies.com/forums SQL Server “Yukon” FAQ Blog at SQLTeam http://yukonblog.sqlteam.com/ Other Key Resources http://www.microsoft.com/sql/community http://msdn.microsoft.com/sqlserver/ 34 world wide user groups, http://msdn.microsoft.com/usergroups/find.asp Our most active SQL Server newsgroups, Microsoft.public.sqlserver.programming Microsoft.public.sqlserver.server Microsoft.public.sqlserver.dts Microsoft.public.sqlserver.olap Microsoft.public.sqlserver.setup Microsoft.public.sqlserver.replication Microsoft.public.sqlserver.msde Week long SQL Server “Ask the Experts” lounge in: Foyer outside Room 309 Support for SQL Server “Yukon” PDC Preview at SQLJunkies http://www.sqljunkies.com/forums SQL Server “Yukon” FAQ Blog at SQLTeam http://yukonblog.sqlteam.com/ Other Key Resources http://www.microsoft.com/sql/community http://msdn.microsoft.com/sqlserver/ 34 world wide user groups, http://msdn.microsoft.com/usergroups/find.asp Our most active SQL Server newsgroups, Microsoft.public.sqlserver.programming Microsoft.public.sqlserver.server Microsoft.public.sqlserver.dts Microsoft.public.sqlserver.olap Microsoft.public.sqlserver.setup Microsoft.public.sqlserver.replication Microsoft.public.sqlserver.msde

19 19 Questions? bprang@microsoft.com Requests: sqlwish@microsoft.com bprang@microsoft.com Requests: sqlwish@microsoft.com

20 20 © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

21


Download ppt "1 Building Management Applications with SQL Server “Yukon” SQL Management Objects (SMO): Overview Bruce Prang Development Manager Microsoft Corporation."

Similar presentations


Ads by Google