Since SQL Server Analysis Services 2000, the product has supported a feature called drillthrough. Drillthough enables a user to select a cell and then retrieve an underlying result set from the source data for that particular cell. This functionality provides users with the ability to get a more detailed explanation as to why a certain aggregate or cell contains the value that it does. It combines the pre-aggregated nature of OLAP with the detailed records of a relational data store.

In Analysis Services 2000 you configure the drillthough settings via the Cube Editor dialog and then going Tools->drillthrough options. You specify the tables, columns and an optional drillthrough filter. In Analysis Services 2005 you configure drillthrough settings by creating a drillthough action in the cube editor’s Actions tab. Like its predecessor, in Analysis Services 2005 you can optionally provide a filtering condition. Because the drillthrough settings are significantly different in Analysis Services 2000 compared to Analysis Services 2005/2008, this issue only applies to 2000 to 2008 in-place upgrades. I have personally tested Analysis Services 2005 to 2008 in-place upgrades with OLAP cubes that contain drillthough settings and they do in fact get migrated.

In my Analysis Services 2000 test case I am using the out-of-the-box FoodMart 2000 AS database. It contains two objects that have drillthough settings defined, the HR & Sales cubes. Upgrade Advisor will detect and alert you when it scans an Analysis Services 2000 instance which contains drillthrough settings. The Upgrade Advisor corresponding help topic simply states that ‘While drillthrough exists in Microsoft SQL Server 2005 Analysis Services, drillthrough settings are not migrated from previous versions of Analysis Services’. Since Analysis Services 2005 is not subjected to this issue the Upgrade Advisor does not report anything back when it scans an AS 2005 instance.   

Prior to performing the actual SQL Server 2008 upgrade from a SQL Server 2000 instance, make note of the existing drillthough settings. Perform the actual upgrade (we always recommend using a test machine configured to mimic your production environments to test upgrade first) and then recreate your drillthough settings in your SQL Server 2008 Analysis Services instances.

Derek Comingore

As I continue to explore how 2008 will affect an application upgraded from 2000 and 2005, one question that I get almost consistently every week is “should I upgrade from 2000 to 2005 first or jump directly to 2008?”. Sure, both are supported and of course, there is no shortage of opinions and recommendations from Microsoft and 3rd parties.

One of the better 3rd party write-ups on the subject is from Steve Jones who recommends users to skip 2005 and move straight to 2008. I’ve known Steve for a while though we typically only catch up at conferences (TechEd, PASS, etc…). Still, he’s been working with SQL Server a long time and knows what he’s talking about so it’s worth taking a peek at his article on SQL Server Central.

Of course, Microsoft too has a couple of papers on the subject that are worth reviewing. While they may sound like a gentle nudge towards upgrade to 2005 first, some of the reasons are good ones. There’s the original “Why upgrade to SQL Server 2005” paper which is ok if you really are brand new to 2005. While quite dated, the info is still relevant. The newer “SQL Server 2005 Upgrade FAQ” has the latest and greatest information including a short section on the benefits of moving to 2005 first then 2008 later. It’s a good start but IMHO, doesn’t provide enough to help the average user decide.

I really don’t believe there is a hard rule for this; it really depends on each individual deployment (yes, deployment not company). Here are a few important points to consider when trying to decide whether to first upgrade to 2005 then on to 2008 or do both in 1 step. I’ve laid them in in pros/cons format to make it easier to get most folks started but the right approach really depends on your specific deployment and what’s important to you.

Path Pros Cons
Direct to 2008 One time effort Major changes for both DBAs and developers
  One downtime window Deprecated features now removed; more intensive testing required
  Latest capabilities and security  
     
Intermediate 2005 upgrade then 2008 Smaller skills delta for DBAs and developers 50-80% repeated effort (process is reused but testing effort doesn’t change)
  Window for stabilization, tuning and removing legacy code Two downtime windows
  Faster upgrade to “supported” version Lacks latest capabilities until second upgrade cycle (may be > 1 year later)
  Potential need for “workaround code” for certain capabilities

Note the the lists is not ordered or weighted in anyway. They are just intended to get folks thinking about some of the issues involved. For example, testing efforts for a 1-step upgrade might be significantly more involved than a 2-step approach. This is because there are (a small number of) deprecated features that are fully de-supported/removed from SQL Server 2008. If you had taken a 2-step approach, you would have some time to setup alerts (use of unsupported features/command will fire an event create an entry in the SQL Server log) and phase them out gradually. With the 1-step upgrade, you’d have to hunt down every line of code including dynamic SQL to be analyzed by Upgrade Advisor or run through the Application Compatibility Testing tool.

Not purely an IT decision.
Sure, the DBAs and application admins are intimately involved since they need to handle the testing and deployment. However, there’s a fair bit of learning involved especially if you want to take advantage of Policy Based Management (aka DMF) so there’s the first involvement from the business side - training budgets. Still, the most important points, IMHO, from a business perspective are the downtime window and regulatory compliance. I’ve worked with some customers where extended downtime is schedule up to 2 years in advanced. This doesn’t leave much room for doing a lot of upgrade operations so you might have to just bite the bullet and make one big jump. On the other hand, if there are specific regulations that require you to run only products that have mainstream support, you’ll likely have to get to 2005 asap (2008 will not be available till summer).

The SP1 rule
One important point I’d like to make is about SP1. I know of a lot of companies that have this rule - no RTM deployments, wait for SP1. I used to subscribe to this rule also, a very long time ago when I helped manage some Oracle DBs and in my early SQL Server days. As of 7.0, this SP1 rule really made less sense with every release. My rationale is simple. Beta versions of SQL Server have been running in production environments for SAP customers and a bunch of Microsoft’s own internal applications (its own SAP and other business critical applications) since 7.0 and the practice continues today. If you know anything about SAP, you’d know running it in production on a beta database is no small feat regardless of how many modules you run. I don’t know of any other enterprise database that does this. So if multi-billion dollar companies can run their very complex business critical applications on beta versions of the product, I’m pretty comfortable running the released version.

If you still can’t decide after all this, do a POC. Download a copy of the AppCompat Tool, aka SSUA for SQL Server 2008 (currently slated for March release) and do your own application compatibility testing. That should give you a good idea of the effort it’ll take to upgrade your database/application which hopefully, puts you in a place to make the right decision on which path to take.

In short, there are no easy answers and your decision should not be based on features alone. Though the most common response to this question is “do you need the new features”, it is hardly the most important one. Most features can be worked around with some creative code or 3rd party applications. Downtime windows and regulatory compliance requirements are generally very inflexible. Of course, your environment might be such that neither of these apply so all you really care about are the new features. Like I said from the start, it depends on each individual deployment.

joe.

ODBC History

ODBC or Open Database Connectivity is a platform neutral, universal approach for providing an Application Programming Interface (API) to access relational database management systems. ODBC was an early modular approach to enable database access. The ODBC library itself is an independent Operating System (OS) component which acts like a bridge passing requests from the consuming application to the corresponding ODBC drivers. The various data store vendors develop their product’s ODBC drivers and then either ship those with the product and or make them available over the Internet. Microsoft designed Object Linking and Embedding Database (OLEDB) as a replacement for ODBC mainly due to the desire to support a much larger variety of data stores beyond those that are pure relational databases. A nice alternative point to this post is that we take so much for granted in today’s technological landscape. At one point in time, performing database access was not a trivial task.

In today’s world, particularly the SQL Server BI world we have a plethora of drivers and providers for accessing databases, email systems, spreadsheets you name it. Like SQL Server native extended store procedures (XPs), Microsoft is slowly (but surely) phasing out the old ODBC API. Currently, Microsoft OSs still support the ODBC platform/technology, however the higher-level components are withdrawing support. SQL Server Analysis Services (SSAS) is one such component, since SQL Server 2005, SSAS has not supported the ODBC specification. The following is a quote describing the non-support of ODBC by SSAS 2005, the entire technical article can be located here http://technet.microsoft.com/en-us/library/aa964120.aspx :

‘Microsoft SQL Server Analysis Services 2000 supported a range of OLE DB providers. In particular, it supported OLE DB for ODBC. You could configure an ODBC data source to access your database.Analysis Services 2005 provides greater functionality by providing data-source views. Because it supports different syntaxes, Analysis Services 2005 imposes stricter requirements on client libraries than does Analysis Services 2000. Analysis Services 2005 does not support Microsoft OLE DB Provider for ODBC. To access your database, you must find an appropriate version of the OLE DB provider for Analysis Services.

Besides OLE DB in Analysis Services 2005, you can use managed providers to access your relational database.’

Detecting SSAS 2000 ODBC Data Sources with the Katmai Upgrade Advisor

When you analyze a SQL Server 2000sp4 SSAS instance that contains ODBC data sources with the SQL Server 2008 Upgrade Advisor (UA) utility you will receive an advisory stating that ‘ODBC Data Sources are not supported’. As described in my previous post, this is one of the more common issues that the UA will find when analyzing Analysis Services instances. A lot of folks out there are still running on the SQL Server 2000 platform including Analysis Services.

Post Katmai Installation & Resolutions

Once you perform the SQL Server 2008 upgrade you will need to update or recreate your Analysis Services data source to use a corresponding OLEDB provider. This issue applies only to SQL Server 2000sp4 upgrades to SQL Server 2008. That being said, because of the sheer number of Analysis Services 2000 installations running in production that do in fact use the ODBC drivers this is a fairly common Katmai upgrade issue.

Derek Comingore

As Joe describes in his post ‘Upgrading to SQL Server 2008: The Next Version of SQL Server Upgrade Assistant’, Microsoft made available a very handy utility called the Upgrade Advisor (UA) to assist customers in assessing their existing SQL Server 2000 environments for upgrade to the SQL Server 2005 platform. With the arrival of SQL Server 2008 we also have access to the updated UA utility that supports analyzing both SQL Server 2000sp4 and SQL Server 2005sp2 installations (which are the supported platforms for upgrade to SQL Server 2008). The UA utility is applicable to both the relational engine as well as the SQL Server Business Intelligence (BI) components (Integration Services|Data Transformation Services, Analysis Services, and Reporting Services).

*The UA utility requires the .Net Framework 2.0 redistributable

In our testing of this utility based on the November 2007 CTP build of Katmai (CTP5) we found that the UA will allow the analysis of both local and remote instances of the BI components excluding Reporting Services. Reporting Services instances will require the UA to be installed on the report server itself. Another discovery we found from our tests is that in the CTP5 build the Reporting Services analysis does not seem to be working as designed. Integration Services is not yet supported in UA, however the tool does note that in a future CTP/build of Katmai UA will support analyzing SSIS. In addition, SQL Server 2008 will continue to support the Data Transformation Services (DTS) runtime and thus the UA allows you to analyze DTS Packages in both a SQL Server 2000 and 2005 environment. A nice bonus is the ability to analyze DTS packages stored in the file system as well. Also note that when you analyze a SSAS 2000 instance the UA utility will require the Decision Support Objects (DSO) object model.

*DTS Packages are an official deprecated feature in SQL Server 2008. You should migrate your organization’s DTS packages as soon as possible to help support future upgrades of your SQL Server environments.

The UA utility provides you with both analysis and reports. UA reports provide you with the alerts/warnings that you should consider or take action on prior to upgrading your SQL Server environments to the 2008 platform. A nice feature of the UA utility is its ability to provide the user with links directly to its alert documentation. Some of the more important UA alerts are as follows:

SQL Server Data Transformation Services UA Key Alerts

· SQL Server DTS Packages are now a deprecated feature

· To continue running and managing your existing DTS Packages, the SQL Server 2008 Backwards Compatibility Files are required (these files were required for the same reason in SQL Server 2005 platform)

· The DTS Designer Components are a required add-on if you wish to edit DTS packages in Management Studio (these files were also required for the same reason in SQL Server 2005 platform)

SQL Server Analysis Services UA Key Alerts

· VBA functions handle NULL values and empty values differently from SQL Server Analysis Services 2005

· Custom Aggregations are not migrated

· ODBC Connections are not migrated

· MDX Changes

SQL Server Reporting Services UA Key Alerts

· Custom Reporting Services extensions (DLLs) will not be moved

· Client Certificates were detected (Reporting Services 2008 does not support them)

· Reporting Services 2000 Report Server database is on a remote 2000 instance (blocks a 2000 to 2008 SSRS upgrade)

Be aware that UA cannot analyze every aspect of your SQL Server environments and thus it cannot detect every issue that could affect an upgrade. Some examples of items not analyzed by the UA are middle-tier or front-tier code containing TSQL, encrypted stored procedures, and extended stored procedures. Regardless of the UA limitations, it is a very good tool for the BI professional to leverage for prepping their environments for SQL Server 2008.

Happy Upgrading!

Derek Comingore

icon for podpress  Business Intelligence: Platform Introduction [9:13m]: Download

No not, SQL Server 2008 but rather how the version numbers are tracked. Run SELECT @@VERSION or SELECT SERVERPROPERTY(’productversion’) if you’re not sure where this comes from.

 In 2005 and earlier, the version format looked something like M.mm.BBBB.rr

where

M is the major version number
mm is the minor version number
BBBB is the build number
rr is the build revision number

With SQL Server 2008, the format is now M.m.BBBB.rr where the minor version number will only display 1 zero and the revision number will only display 1 digit if it’s only a single digit revision. For example, the November CTP is 10.0.1075.23

Most of us really just cared about the major and build numbers since MS did away with .5 releases a long time ago. The build number tells us what service packs and/or hotfixes have been applied.

If your application checks for SQL Server version information during setup and has a tight dependency on the format of the string returned, remember to update your setup checker so it doesn’t disallow install for the wrong reason.

We had a few ISVs encounter this so far and while the change is a really tiny one (took a whole 30 seconds to fix) the app won’t install otherwise. Not that big of a deal but your users might get a little annoyed if your app’s setup complains about the wrong version in its error message (because it incorrectly interprets the new version number format) when users are using the right one.

 

joe yong

If I had to pick my favorite feature in Katmai, it would have to be the Resource Governor. This is something I had wanted for a long time for various reasons and was sorely disappointed when it was cut from Yukon. I’m sure Richard & Euan remember the amount of grief I gave them though it wasn’t really them who made the final cut decision (but they did own the feature back then).

Prior to SQL Server 2008 Resource Governor, there really was very little you could do to manage resources within an instance. The Windows Server Resource Manager controls Windows processes so all you’re doing is restricting what the sqlservr.exe process could consume. Max/min memory settings locked things down at the instance level and so did CPU and I/O affinity. There really wasn’t much that you could do to specific users or groups. Sure, there was the query governor but all you can really do is set an “execution time threshold” for queries. I.E. If the estimated cost of a query exceeds the threshold, it won’t be allowed to run. Not bad for preventing very heavy queries from running but not really controlling resources either and the side effect is users might start opening support tickets thinking something’s wrong with the system because they can’t run their reports. Also, if your statistics are out of date and not automatically updated, queries may be incorrectly allowed or disallowed to run.

With Resource Governor, Admins can now set controls on how resources are consumed in SQL Server. At this time, the RG can control CPU and memory. Disk I/O and network I/O are not covered in this release. Still, this is already a giant step forward.

Let’s try a few things. First, the old way using the Query Governor cost limit. You can set this at the server instance (sp_configure) or on a per connection basis (set query_governor_cost_limit). If your goal is really to prevent long running queries during peak hours, you probably set this at the instance level. After all, how many users do you know will voluntarily not run their heavy queries? ;-) If you’re wondering what self-respecting DBA would allow reporting, DSS and other BI type queries run against a production OLTP system during business hours, well, DBAs don’t write the checks or run the business. It is reality today that the business users want/need to analyze data rapidly, not after a day, week or month. While you can create separate reporting servers, there are some genuine needs where a reporting server’s latency is beyond what the business users require. It’s the new world my fellow traditional DBAs - embrace and control it!

Now, let’s try this example. The following script (written by my colleague Suresh) scans the order tables in the Sales schema in the Adventureworks database and offers a discount for purchase quantities greater than 3. A cursor is used to scroll through and evaluate each row, taking action where appropriate. This query takes anywhere from 20-25 minutes to run on a workstation consuming a notable amount of CPU and memory.

USE AdventureWorks;
GO

DECLARE @l_SalesOrderID INT
SET NOCOUNT ON
DECLARE update_cursor SCROLL CURSOR
FOR
 SELECT SalesOrderID FROM Sales.SalesOrderHeader

OPEN update_cursor

FETCH NEXT FROM update_cursor INTO @l_SalesOrderID

WHILE (@@fetch_status = 0)
 BEGIN
  UPDATE Sales.SalesOrderDetail
  SET UnitPriceDiscount = 0.01
  WHERE SalesOrderID = @l_SalesOrderID
  AND OrderQty >= 3
  FETCH NEXT FROM update_cursor INTO @l_SalesOrderID
 END

CLOSE update_cursor
DEALLOCATE update_cursor
SET NOCOUNT OFF
GO

SQL Server 2005 (and earlier)
With SQL Server 2005 and earlier, you would do one of the following:

Instance wide: sp_configure ‘query governor cost limit’, 300

Per connection: SET QUERY_GOVERNOR_COST_LIMIT 300

Either of these will evaluate queries and disallow execution if they exceed 300 seconds. If you tried to execute the sample query from above, you will get a message that looks like:

Error 8649, Severity 17, State 1, Procedure iduSalesOrderDetail, Line 33
The query has been canceled because the estimated cost of this query (1157) exceeds the configured threshold of 300. Contact the system administrator.
Msg 3609, Level 16, State 1, Line 14
The transaction ended in the trigger. The batch has been aborted.

So that accomplishes your goal of not letting heavy queries execute. These settings can be changed at any time so you can setup SQL Agent to set the appropriate value at different times of the day. However, the big downside here is that your “heavy” queries do not get executed at all. This probably won’t go down very well with your end users. How about letting the query run but not allowing it to dominate server resources?

With SQL Server 2008, you have MUCH better control and can keep both regular OLTP and batch/reporting users happy.

There are a few terms we need to be familiar with before diving into Resource Governor. The following are brief descriptions of key terms. BOL has the gory details which I encourage you to check out.

  • Workload group: a logical way to classify different types of workloads you want to govern
  • Internal group: a “special” group created by and for SQL Server for system processes. This is not user configurable.
  • Default group: another special group created by SQL Server to be the catch-all bucket for any workload that doesn’t get allocated into a user defined group for whatever reason.
  • Classification function: a UDF that determines with group a submitted workload belongs to
  • Resource pools: a logical container for the amount of CPU and memory that members of the pool can consume
  • Internal pool: a “special” resource pool created by and for SQL Server to be consumed by system processes (in the internal group). This is not user configurable and will always have higher priority than all other pools.
  • Default pool: another special resource pool created by SQL Server to be the catch-all bucket for any group (stars with the default group) that doesn’t get allocated into other user defined pools. While it cannot be dropped, its configuration can be altered.

Getting started with Resource Governor.
Before we can start bossing workloads around with RG, there are a few things we need to consider.

Rules and environment prep:

  1. How many logical workgroups do you have in your database? E.g. Regular OLTP users, reports users, batch processors, administrators, security team, etc…. Can you standardize across your organization?
  2. What is the typical CPU and RAM utilization of your server? While limits can be adjusted easily, knowing the typical utilization will help avoid setting initial limits that are too low and causing performance problems.
  3. Is there a order of priority among your users?
  4. Is there an SLA (implicit or written) on query response time?

Once you figure out what you need from a user and administration perspective, you can then start implementing the controls.

Basic setup:

  1. Create workload groups in your environment that you want to have specific resource allocations for (others will fall into the default group)
  2. Create a classification function to place workloads in appropriate groups
  3. Register the classification function with Resource Governor
  4. Enable Resource Governor

The syntax itself is easy enough so I won’t elaborate here. The example below uses explicit transactions but it does not have to be that way. However, this is a recommended practice;  in case you make a mistake, it is easily undone (rolled back).

First, let’s create the buckets (known as groups) that we want to place our users into:

BEGIN TRAN
CREATE WORKLOAD GROUP ResGroupAdhoc
CREATE WORKLOAD GROUP ResGroupReport
CREATE WORKLOAD GROUP ResGroupAdmin
CREATE WORKLOAD GROUP ResGroupExecs

Next we need to create a classification function. This is the “filter” that decides which group each query submitted to SQL Server belongs to. Note that any workload that does not get classified by your function goes into the ‘DEFAULT’ group

CREATE FUNCTION ClassifierFn_Basic() RETURNS SYSNAME WITH SCHEMABINDING AS
 BEGIN
   DECLARE @ResGroup AS SYSNAME
   IF (SUSER_NAME() = ’sa’) OR (SUSER_NAME() = ‘REDMOND\v-jyong’)
      SET @ResGroup = ‘ResGroupAdmin’
   IF (SUSER_NAME() = ‘BillG’) OR (SUSER_NAME() = ‘CORP\DaBoss’)
      SET @ResGroup =  ‘ResGroupExecs’
   IF (APP_NAME() LIKE ‘%Management Studio%’) OR (APP_NAME() LIKE ‘%SQL Query Analyzer%’) OR
   (APP_NAME() LIKE ‘SQLCMD’)
      SET @ResGroup = ‘ResGroupAdhoc’
   IF (APP_NAME() LIKE ‘%REPORT SERVER%’) OR (APP_NAME() LIKE ‘%Microsoft Office%’)
      SET @ResGroup = ‘ResGroupReport’
   RETURN @ResGroup
END

COMMIT TRAN
GO

If you aren’t sure what App_Name to filter with, run Profiler for a while just to capture the ApplicationName column.

You can set classification conditions by a number of different connection properties including user name (both SQL Server and domain users), application name, hostname (source machine name), server role, etc… Check out BOL for details.

This function is just a sample of what you can do to place each user connection or application into specific groups. This is how you classify/categorize your users and it is with these groups that you will set resource utilization controls on later.

Next, we need to register the function with Resource Governor and enable RG.

ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION=dbo.ClassifierFn_Basic)
GO

Now that we have the function registered and RG enabled, we can set resource usage allocations for each group that we created.

First thing we want to do is to limit the amount of CPU resources ad hoc queries can consume. Let’s say we do not want ad hoc queries to consume more than 20% of CPU cycles  and no more than 15% of available memory if there are other workloads running. To do this, we need to create a resource pool, place the ad hoc group in that resource pool and set limits on that pool.

CREATE RESOURCE POOL ResPoolAdhoc WITH (MAX_CPU_PERCENT = 20,
     MAX_MEMORY_PERCENT = 15)

Next, we will assign the Adhoc group to the resource pool we just created so it will be governed by the policies we set for that pool. We then need to notify Resource Governor (kinda like what we already do when making a change with sp_configure).

ALTER WORKLOAD GROUP ResGroupAdhoc USING ResPoolAdhoc
GO
ALTER RESOURCE GOVERNOR RECONFIGURE
GO

Now all queries that are submitted via SQL Server Management Studio, Query Analyzer or SQLCMD (from a command prompt) will not be allowed to consume more than 20% CPU time or 15% of available memory if there are other workloads running. If the server isn’t very busy, RG is smart enough to let the queries use free cycles. For more details on how it works, check out BOL.

You can now repeat this process for other groups to set the max and/or min values for each group by creating and assigning resource pools for the groups. Try it out by submitting the long running query at the start of this article but use different UserIDs that belong to different resource groups. Run several instances of them and you’ll see the effect of the Resource Governor. It becomes very obvious when you run a lot of instances of that query.

Note that if you forget to assign a particular group to a resource pool, it will remain in the default pool. New applications or applications that are not defined in your function will fall in the default group which also falls into the default pool. (For example: another team may decide to use Toad as their query tool instead of Query Analyzer). That’s why it is always a good idea to set the default pool limits to values that you are comfortable with so that queries that are not caught by your classifier function will not hog server resources.

A few other things you should probably be aware of:

  • Dedicated Admin Connection runs in the “internal group”. That means you do not need to place it in a group to ensure it will always be able to run. SQL Server already takes care of that for you.
  • Don’t create vastly complicated classifier functions. All connections will be filtered through the function so if you have some convoluted code that performs 27000 checks, the connection may timeout before getting clasffied.
  • Multiple groups can belong to the same pool (e.g. default pool) but you can still impose some priority for allocation within that pool using the “IMPORTANCE” setting (LOW, MED, HIGH).
  • You can do all this in Management Studio, it doesn’t have to be via TSQL

Ok, so this is quite a bit more involved than the Query Governor Cost Limit in SQL Server 2005 and earlier but it also provides a lot more control and flexibility. This is one of those features that requires some work to take advantage of but it really isn’t much work plus the returns are huge. We covered the basics here which should enough to get you started. There are quite a few more things you can do with RG including setting up filters that just log events when queries run for a specific period (want an easy way to track offenders with long running queries?). BOL documents this pretty well and look for whitepapers (to come) on www.microsoft.com/sql/

So what should you do after upgrading to 2008 if you currently use Query Governor Cost Limit? I suggest creating the appropriate rules in Resource Governor (sorry, no such thing as an upgrade/migrate for this) starting with a close to 1-1 match for what you had before. Get used to its behavior then expand with more rules. This will work for probably >95% of the users of the Query Governor Cost Limit. There are some scenarios where you truly do not want a query to run if it is expected to last longer than x minutes. In which case, you can keep both; they are compatible.

Btw, if you’re wondering about how to monitor activity and how the allocations are actually being used, monitoring data is exposed via System Monitor (aka perfmon) and DMVs. BOL documents these well or you could just do what most DBAs do; fire it up and look around.

Beyond workload governance
Performance management and runaway queries aren’t the only things the Resource Governor is good for. With the ability to set resource utilization limits within a database, it becomes harder for malicious acts against your database such as a DDOS attack to cause widespread problems. It also provides greater flexibility and resource usage efficiency in database consolidation. There’s a good reason why this one feature is cited across multiple scenarios in the 2008 release. It really is super handy. Now as soon as we get network and disk IO added to the resources we can govern, DBAs will rule the world (more than before). :-)

joe yong

This is our first Podcast in a series that we will have to support our overall Katmai Application Compatibility efforts with audio content. In this podcast we cover basic technical decision maker information through two interviews. The first interview is with Roger Doherty, Sr. Technical Evangelist, Developer & Platform Evangelist Division, The Microsoft Corporation. The second is with Joe Yong, Architect, Scalability Experts Inc.

Play Podcast

-Derick Schaefer, Scalability Experts

 
icon for podpress  SQL Server 2008: Technical Decision Maker Info Podcast [22:38m]: Play Now | Play in Popup | Download

 
icon for podpress  Business Intelligence: Overview of SQL 2008 BI Platform [9:13m]: Play Now | Play in Popup | Download

Continuing from my previous post on [URL=http://blog.scalabilityexperts.com/?p=79]DMF[/URL], let’s look at several things you probably do today either manually or by writing some creative scripts or little apps to accomplish. We’ll start with the very basic stuff and then look at something a little more “interesting”.

Before we get started, there are a few DMF specific terms you need to be familiar with that are new in SQL Server 2008. Policies we all get (perhaps too well). Then there are targets. As the word implies, that’s what you want to apply your policies to. Targets can be a SQL Server instance, database, table, etc… Within the targets, you have different facets that you can apply one or more policies to. For instance a database target can have options (sp_db_options is deprecated btw), table, etc… You can set a naming policy for tables or set auto update stats on policy for the database. You might have noticed by now there’s a tree hierachy to the targets but we’re database guys, so we get this (or think we do). Anyway, other things to be aware of are conditions and execution modes. Conditions are just that; conditions you define for a facet. Execution modes determine how your policies are executed and enforced (e.g. passively as in log the transgression or actively where non-compliant activities are disallowed). This is just the elevator brief on the terms. Do look them up in BOL for detailed definitions and also for a few other related subjects not covered here.

Background:
Let’s say you’re new to the company/department (previous DBA just stopped showing up for work one day and won’t answer calls/emails, nobody knows why) and you’re the only “real” DBA in the company/department. You quickly discover that everyone and their pet iguanas know the SA password and you cannot change it or take it back because the developers have test harnesses with the password hardcoded and most if not all production apps use SA for one or more tasks. Well your boss wants you to clean up shop.

So your first few months are spent chasing after one performance issue after another along with the usuals like backups, reindexing, space allocations, etc… Somethings you script out and use SQL Agent to run periodically, others you write DDL triggers for. With servers running 2005 SP2, you even find time (between 2-5am) to write custom reports with colorful charts. Finally, after months of hard work and some help from a guy named Johnnie W. (the one with the blue ribbon, not the green one), you convinced your CIO to upgrade to SQL Server 2008. Now you’ve got some serious tools to work with…. :)

Scenario 1: Database options policy
Starting small, you decide to set standard database options. You figured by setting auto stats management back on will solve 60% of performance tickets because someone had read somewhere that stats management can burn server resources and decided to turn it off in the interst of performance. Of course, that someone also doesn’t know what the stats are for and calls you regularly to complain about slow queries. And then you have 95% of the log files autogrowing at 10% because the default values have to be the best, right? Well, you’d rather create a big enough file and let it auto grow by 25MB increments. This should be enough for a start.

You fire up Management Studio and browse to Management in the object explorer. You then expand Facet and create the appropriate new conditions for the Database Option and Log File facets.  

DMF_Policy

Next, you create your first policy by right-clicking on Policies and select the conditions you want to apply. In this case, it’s the Database Options policy (use whatever name you assigned earlier). You’re even kind enough to provide an informational message in the description and a link to an intranet site for more information. You schedule this to run weekly because you know your team tends to get careless on Monday mornings before their second cup of coffee. When done, you repeat this for the Log Files condition.

DMF_Facets

All this is done easily via SSMS and the screenshots show a couple of the steps. Books Online documents this very clearly and even provides some examples. Do check it out when you get a chance.

Now, what is not documented are the actual commands executed to create the conditions and policies. The current cTP build doesn’t even have a “Script” button for you to script everything out like other tasks in SSMS. BOL doesn’t mention anything about what commands are used either. A simple trace reveals the use of system SPs in msdb such as msdb.dbo.sp_syspolicy_add_condition to create the condition. It takes in several parameters including name, description and an expression which is basically the condition you define but in XML-like format. Exporting the policies also yields a similar form. Not sure what the release plans are but according to Buck Woody (SQL Server PM who delivered a DMF session at SQLPASS), the product group does intend to provide scripting support so check out future CTP releases as they become available.

Regardless, this will take you a whole 2-3 minutes to create and maybe a few more to push out to your existing targets which can include new databases that will be created later. In less than 15 minutes after upgrading to Katmai, you’re done with chasing after databases every week to ensure they have the right database options. Not bad at all.

Though useful this is too easy a scenario. Next, we’ll look at a more complex example where you can have multiple conditions (including differentiating between 32-bit and 64-bit platforms) and policies that depend on other policies. 

 joe yong

There already dozens good blogs/websites on Katmai (SQL Server 2008) including ones by the product group so why another one? Well, we are kinda different in that we are responsible for the application compatibility content and experience - something few people are working on. Sure, we’ll discuss what’s cool and what’s not with Katmai like the rest but we’re very focused on the upgrade experience, not just how cool a feature is.

We worked with MS to help ISVs around the world with the upgrade tools and processes for SQL Server 2005 and have learned a great deal from that experience. With that, we hope to offer a little uniqueness and practicality from the other great sites discussing Katmai features.

I am the primary author for the core relational database areas while my colleague Andrew will cover the BI related subjects. Other folks on my team will contribute from time to time also but you’ll hear mostly from Andrew and I.

If you have specific areas of interest in Katmai that is related to application compatibility (basically what happens when you upgrade), do drop us a note. We’d love to hear from you.

 joe.