Why bother building a user hierarchy in a dimension if a user can manually arrange attributes in a hierarchy in the browsing tool?

by windy 12. October 2010 09:39

A user hierarchy is more than simply an aid to the user. In combination with the attribute relationships for the attributes defining each level of the hierarchy, the user hierarchy is used for designing aggregations. You can think of aggregations as a collection of summary tables that are managed for you by Analysis Services. The addition of aggregations to a cube is one way to improve performance. You probably won't notice much if your fact table contains thousands of records, but once you cross into the "millions of records" zone, you'll notice a difference in query performance between a cube with aggregations and one without aggregations. 

Tip by Stacia Misner, a consultant and author specializing in business intelligence solutions since 1999, providing consulting and training services through Data Inspirations, and writing about BI at blog.datainspirations.com.

Tags:

Tips

How can I turn off a best practice warning?

by windy 7. October 2010 01:21

The best way to turn off a best practice warning is to implement the design change that the best practice warning is recommending! However, there are cases where the warning is just a recommendation, and not critical to the performance or usage of the cube. In those cases, you have two options--either disable  the warning on a case by case basis, or disable the warning forever within the current database.

When you deploy the Analysis Service project, the Error List window will contain all the warnings, even if it the project deploys successfully. If you don't see the Error List window, click Error List on the View menu. In the Error List window, right-click on the warning that you want to ignore, and click Dismiss. You can provide a comment to remind yourself (or anyone else that looks at the project) why you are ignoring the best practice warning. Dismissing best practice warnings in this way operate case by case. You'll continue to get the same warning for another object until you dismiss it.

Rather than dismiss the same best practice warning over and over again across multiple objects, you can disable it globally -- for the current database. There is no effect on other databases that you are managing. To disable the best practice warning, click the Edit Database command on the Database menu, and then click the Warnings tab. On the top half of the window, you'll see the categories of warnings. Expand a category and then clear the checkbox for the particular warning that you want to disable. You can add a comment to remind yourself why you did it. If you dismissed individual warnings using the case by case method as described above, you'll see those in the lower half of the window along with the comments if provided.

Tip by Stacia Misner, a consultant and author specializing in business intelligence solutions since 1999, providing consulting and training services through Data Inspirations, and writing about BI at blog.datainspirations.com.

Tags:

Tips

Is it really necessary to build a star schema before I build a cube?

by windy 28. September 2010 10:09

To work properly, the cube requires data that "looks like" a star schema. That means you can simulate a star schema by creating named queries in the Data Source View if you can't (or don't want to) build out a physical star schema. In fact, this capability makes it very easy to prototype your cube design in Analysis Services, a step you really ought to take to ensure you get validation from users before building any physical structures. If your data is relatively small (i.e. in the thousands, not millions, of records) and if you don't need to worry about slowly changing dimensions, then you can leave named queries in the Data Source View and forego building out an actual star schema. Without an actual star schema in place, the processing time of your cube will take longer than it would with a star schema -- so the processing time difference for small volumes of data will be negligible. At some point (i.e. as you deal with more data), it will become more noticeable. Although there are still some tricks you can use to manage processing time, you're probably better off building the star schema, and more likely to need one for handling slowly changing dimensions.

Tip by Stacia Misner, a consultant and author specializing in business intelligence solutions since 1999, providing consulting and training services through Data Inspirations, and writing about BI at blog.datainspirations.com.

Tags:

Tips

DMVs related to current connections and query statistics

by windy 7. September 2010 22:37

SQL Server 2005 and SQL Server 2008 have many useful Dynamic Management Views (DMVs) and Dynamic Management Functions (DMFs) that have been introduced that provide insight into how SQL Server is operating.  The difference between a DMV and DMF is that a DMF takes parameters like any other function and a DMV works just a regular view. 

The collection of Dynamic Management Objects (DMOs), the combination of DMVs and DMFs, is pretty vast and maybe overwhelming to determine which ones you should be using.  So in this tip we will focus on DMOs realted to query statistics and current connections that allow you to see what statements have been run, how frequently and the resources they are using.

In this tip we will cover these DMOs.  The first 3 provide data similar to Activity Monitor or runnig sp_who2.  The last 4 provide detailed info about the actual queries that have been run.

Note: sys.dm_exec_query_stats stores cumulative data since the last time SQL Server was started, so when you do a restart of SQL Server the data in this view is reset.


These DMOs can be queried just like any other view as shown below. 

You can see for the last two examples we used the DMFs along with the CROSS APPLY operator.  The CROSS APPLY returns only rows from the outer table that produce a result set from the table-valued function .  You can read more about this in Books Online.


SELECT * FROM sys.dm_exec_connections 
SELECT * FROM sys.dm_exec_requests 
SELECT * FROM sys.dm_exec_query_stats 
SELECT * FROM sys.dm_exec_cached_plans 
SELECT * FROM sys.dm_exec_connections 
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) 
SELECT * FROM sys.dm_exec_query_stats 
CROSS APPLY sys.dm_exec_query_plan(plan_handle)


Here is a query that uses a combination of DMOs.  This query returns the command text for what is runnnig, the query plan as well as some additional columns from the views.


   P.[query_plan], 
   S.[program_name], 
   S.[host_name], 
   S.[client_interface_name], 
   S.[login_name], 
   R.* 
FROM sys.dm_exec_requests R 
INNER JOIN sys.dm_exec_sessions S ON S.session_id = R.session_id 
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS T 
CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS P


This query will return the top 5 statements that have the highest average CPU time.


SELECT TOP 5 query_stats.query_hash AS "Query Hash", 
   SUM(query_stats.total_worker_time) / SUM(query_stats.execution_count) AS "Avg CPU Time", 
   MIN(query_stats.statement_text) AS "Statement Text" 
FROM 
   (SELECT QS.*, 
      SUBSTRING(ST.text, (QS.statement_start_offset/2) + 1, 
      ((CASE statement_end_offset 
         WHEN -1 THEN DATALENGTH(st.text) 
         ELSE QS.statement_end_offset 
         END - QS.statement_start_offset)/2) + 1) AS statement_text 
FROM sys.dm_exec_query_stats AS QS 
CROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) as ST) as query_stats 
GROUP BY query_stats.query_hash 
ORDER BY 2 DESC

This query returns how frequently a cached query has been used.  You can use this to see which statements are used most on your server.


SELECT usecounts, 
   cacheobjtype, 
   objtype, 
   text 
FROM sys.dm_exec_cached_plans 
CROSS APPLY sys.dm_exec_sql_text(plan_handle) 
WHERE usecounts > 1 
ORDER BY usecounts DESC;


I hope this gives you enough information to get started using these DMOs.  You can find plenty of additional examples on the internet or in SQL Server Books Online.

 

Tip provided by Greg Robidoux

Tags:

Tips

Why does it sometimes take so long for a package to start executing in Business Intelligence Development Studio?

by windy 26. August 2010 00:39

If you use the Start Debugging button on the toolbar (the green arrow), or press F5, BIDS will run a validation process to make sure connections in the package are valid and will check the metadata in external data sources match the package definitions. However, this validation process runs not only on the current package, but on all packages that exist in the same project. If your package contains an Execute Package task, you should continue to use the Start Debugging command to make sure dependent packages are validated before executing the current package. However, if you right-click the package in Solution Explorer and select Execute Package, BIDS validates only the current project and starts the execution much sooner.

Tip by Stacia Misner, a consultant and author specializing in business intelligence solutions since 1999, providing consulting and training services through Data Inspirations, and writing about BI at blog.datainspirations.com.

Tags:

Tips

How do you decide when to use an Integration Services built-in component as part of the data flow versus a SQL script that can accomplish the same goal?

by windy 18. August 2010 01:22

Although Integration Services is optimized to do a lot of tasks in memory, there are certain tasks that will perform better in the database engine. The following tasks are available in the data flow, but are best handled in your SQL script: Aggregate, Sort, and OLE DB Command (to do an update). In the case of both the Aggregate and the Sort, Integration Services has to put all of your data into memory to perform the operation. If the same operations are performed by the database engine, SQL Server can take advantage of parallelism and query optimization to speed up the process. With regard to using the OLE DB command for updates, Integration Services processes each update row by row, but execution of a comparable SQL script can process updates as a set operation.

Tip by Stacia Misner, a consultant and author specializing in business intelligence solutions since 1999, providing consulting and training services through Data Inspirations, and writing about BI at blog.datainspirations.com.

Tags:

Tips

Regaining Administrative Access to SQL Server

by webmaster 24. May 2010 19:16

Problem

In some rare occasions it’s possible for organizations to 'forget' their sa password to an operational SQL Server. In cases where this occurs and no trusted Windows Logins (or groups) are part of the sysadmin server role on the server itself, there is seemingly no way to regain Sysadmin permissions.

 

Solution

In many ways this scenario is like locking your keys in your car when you need to be somewhere – because without the sa password it’s impossible to log in, and without any trusted users in the servers’ sysadmin server role, windows can’t grant administrative access either.

 

In cases like this (which should be extremely rare) many systems administrators assume that their only recourse is to power SQL Server down, copy the databases somewhere (as a precaution) and then uninstall/reinstall SQL Server and redeploy their databases.

 

Happily, there's a better way. To recover administrative access to a 'locked out' SQL Server, a member of the Local Administrators group on the host machine can restart SQL Server in single user-mode using the -m startup option (as outlined in Books Online) and by doing so they’ll be automatically added to the sysadmin server role – meaning that they can then either reset the sa password and/or assign users to the sysadmin server role.

 

Of course, if you’re astute, you’ll note that this ‘feature’ also provides a potential security threat of its own as it means users with administrative access can gain control of SQL Server data even when they haven’t been granted explicit permissions to do so. But, as they say, there’s “no free lunch” (especially when it comes to security). So make sure to have auditing and other safeguards in place if your data is extremely sensitive.

 

Tip by Michael K. Campbell, SQL Server consultant, author and founder of SQLServerVideos.com, home of high quality, FREE SQL Server instructional videos

Tags:

Tips

Integrating spatial data and overlay Bing maps using Report Builder 3.0

by webmaster 12. April 2010 18:10

You can now integrate spatial data and overlay Bing maps using Report Builder 3.0. SSRS 2008 supports 2 types of spatial data: Geographic (latitude and longitude) and Planar (x and y coordinates).

To overlay a Bing Map:


1. Start Report Builder 3.0
2. Create your data set. Your data set should include some Geospatial data.
3. Insert a new map using the Wizard, and point to your data set. This should automatically detect your geospatial data.
4. In the “Choose spatial data and map view options” dialog, simply check “Add a Bing Maps background for this map view”

 

Tip by Donabel Santos, DBA/Developer/Trainer at Black Ninja Software and Instructor at British Columbia Institute of Technology.

Tags: ,

Tips

Using the downloadable Report Viewer with Reporting Services and PowerShell

by webmaster 5. April 2010 19:48

You can use the downloadable Report Viewer with your Reporting Services and PowerShell.

To use the report viewer, you need to load the libraries first in your PowerShell script:


#For example if you need webforms, use Microsoft.ReportViewer.WebForms
[void] [System.Reflection.Assembly]::Load("Microsoft.ReportViewer.WinForms, `
    Version=9.0.0.0, Culture=neutral, `
    PublicKeyToken=b03f5f7f11d50a3a")

 

In your script, you will need to create a ReportViewer object, and will need to specify the ServerUrl, ReportPath and other report properties:
 
$rv = New-Object Microsoft.Reporting.WinForms.ReportViewer;
$rv.ProcessingMode = "Remote";
$rv.ServerReport.ReportServerUrl = "http://localhost/reportserver";
$rv.ServerReport.ReportPath = "/Reports/Sample Report";
 
#if you need to provide basic credentials, use the following
#$rv.ServerReport.ReportServerCredentials.NetworkCredentials=
#    New-Object System.Net.NetworkCredential("myuser", "mypassword");
 
$rv.Height = 600;
$rv.Width = 800;
$rv.RefreshReport();


Tags: ,

Tips

Performing SQL Server tasks using PowerShell and SQL Server SMO

by webmaster 15. March 2010 23:04

You can PowerShell it! And no, you're not limited to the mini shell that comes with SSMS 2008. As developers, we like to code and script. There are a lot of SQL Server tasks you can do using PowerShell and SQL Server SMO, like backup/restore, starting/stopping SQL Server agent, exporting data, and even automating SSRS exports to different formats ... Check out Idera's SQL Server Powershell script repository, or SQL Server PowerShell Extensions from CodePlex (http://www.codeplex.com/SQLPSX

Tip provided by: Donabel Santos - DBA/Developer/Trainer -http://www.sqlmusings.com

Tags: , ,

Tips