POP-BI

Popular Business Intelligence

SSIS: Execution History Catalog Dashboard To Go

Posted by popbi on August 7, 2014

The SSISDB contains a wealth of statistical data for your SSIS package executions and messages.   In a package failure scenario, trawling through SQL Management Studio to get detailed reports becomes quite tedious.  For a very quick and easy dashboard looking at the most recent events try a simple Reporting Services report with two tables and two datasets.  The two datasets are outlined in more detail below.

Screen Shot 2014-08-07 at 10.23.02 pm

The first dataset takes the last 3 days worth of execution history for your packages as per the top table. Whilst this dataset returns one row per execution as displayed, adjusting the groupings in this query will give you interesting perspectives on Average Duration and Execution Count.

The second table contains the last 15 messages.  In a failure scenario the second dataset will typically hold the most recent failure if no other packages have been run subsequent to the failure.  However you may need to adjust the dataset to suit, where TOP is specified, or parameterise as required – add a little Dijon mustard :)

Execution Summary – Last 3 Days

SELECT        folder_name, COUNT(*) AS tally_executions, SUM(DATEDIFF(ms, start_time, end_time))/1000 AS total_duration_s, package_name,
                         CASE status WHEN 1 THEN 'Created' WHEN 2 THEN 'Running' WHEN 3 THEN 'Cancelled' WHEN 4 THEN 'Failed' WHEN 5 THEN 'Pending' WHEN 6 THEN 'Ended Unexpectedly'
                          WHEN 7 THEN 'Succeeded' WHEN 8 THEN 'Stopping' WHEN 9 THEN 'Completed' END AS Status, start_time
FROM            catalog.executions AS e
WHERE start_time > getdate()-3
GROUP BY folder_name, package_name, status, start_time
ORDER BY start_time DESC

Message Detail – Last 15 Messages

SELECT        TOP (15) event_message_id, message, package_name, event_name, message_source_name
FROM            (SELECT        event_message_id, operation_id, message_time, message_type, message_source_type, message, extended_info_id, package_name,
                                                    event_name, message_source_name, message_source_id, subcomponent_name, package_path, execution_path, threadID,
                                                    message_code
                          FROM            catalog.event_messages AS em
                          WHERE        (operation_id =
                                                        (SELECT        MAX(execution_id) AS Expr1
                                                          FROM            catalog.executions)) AND (event_name NOT LIKE '%Validate%')) AS q
ORDER BY message_time DESC​

Here’s a couple of chilly reads that go a little deeper.

http://sqlblog.com/blogs/jamie_thomson/archive/2012/10/17/querying-the-ssis-catalog-here-s-a-handy-query.aspx

http://www.rad.pasfu.com/index.php?/archives/79-SSIS-Catalog-Part-6-Operations.html

Posted in Integrate (ETL, SSDT and SSIS) | Tagged: , , | Leave a Comment »

SSIS: Task failed because sgen.exe was not found, or the correct Microsoft Windows SDK is not installed.

Posted by popbi on August 4, 2014

You may have come across this error if you try to program against web services in your SSIS packages.

“Task failed because sgen.exe was not found, or the correct Microsoft Windows SDK is not installed”.   If your I.T. Department won’t let you install the SDK and you are out of Freddo frogs, follow these instructions to navigate to and disable the Generate Serialization Assembly option.

1. Open SQL Server Business Intelligence Development Studio or SQL Server Data Tools.
2. Open the project file or the solution file.
3. In Solution Explorer, double-click the SSIS Package to open the Package Designer.
4. Double-click Script Task in the Package Designer to open the Script Task Editor dialog box – Click Edit Script.

ScriptTask

6. In Project Explorer, right-click the project, and then click Properties.

ProjectProperties
7. Click the Build tab. In the Output area, select Off in the Generate serialization assembly list.

BuildTab
8. Make sure you Save Selected Items before you exit.

SaveSelectedItems

 

9. You should now be able to Build your code without error.

Posted in Integrate (ETL, SSDT and SSIS) | Tagged: , | Leave a Comment »

SSRS: Driven to the Brink with the Data Driven Subscriptions Error

Posted by popbi on July 1, 2014

Clam Chowder….but first, you attempt to create a Data Driven subscription.  You have setup your SMTP settings for your Reporting Services instance, you have setup your encryption key for storing sensitive data and you have configured stored credentials for all data sources used in the report.

Alas you get the following error when creating your Data Driven subscription.

DataDriven

If you have checked all of the above and you think you might be going crazy, then it is likely you have made a reference to the User!UserID Report Collection within your report somewhere.  You will need to get rid of it, or use a workaround that I stumbled across http://prologika.com/CS/blogs/blog/archive/2011/03/28/data-driven-subscriptions-and-row-level-security.aspx (read through this link a little because it has more detail than my blog) but the example below simplifies the expression a little.

Use the following code snippet in any expression where you need to see the User running the report.


=Code.ClamChowder()

And make sure you have the following function set out in the Code section of your Report.


Public Function ClamChowder() as String

return Report.User!UserID.ToLower()

End Function

You gotta love Clam Chowder with sour dough.

 

Posted in Report (SSRS Report Builder Power View) | Tagged: , , , | Leave a Comment »

MDX: How to Pass a SSRS Parameter Label into a MDX Parameter

Posted by popbi on June 30, 2014

Ok Computer, Sing… us a song …

You have to pass a text string from your Reporting Services parameter (Label) into a MDX dataset as a parameter. An example MDX dataset is outlined here …


SELECT Measures.[some stuff]

ON 0,

FROM [Your Model]

WHERE

(

StrToSet("[Dimension].[Attribute].&[" + @YourString + "]")

)

Posted in Analyse (SSAS, Excel, MDX, DAX and Powerpivot), Report (SSRS Report Builder Power View) | Tagged: , | Leave a Comment »

Always On Availability Groups: Do I need a File Share Witness or No ?

Posted by popbi on June 26, 2014

This blog sets about doing a shallow dive – to simply understand how a File Share Witness is used and required in an Always On Availability Group cluster.

An Always On Availability Group cluster requires no shared storage – Windows 2012 supports up to 16 nodes, SQL Server 2012 supports up to 5 nodes in an Availability Group, and SQL Server 2014 supports up to 9 nodes.  A cluster can sustain itself  as it loses nodes and Quorum is described as the state of the cluster.

The basic rule for determining how many nodes your cluster can sustain losing is a “majority” …. I love a good analogy… here is one … Your cluster is like a bar stool … quorum is its ability to remain standing… or rather, how many legs it can lose before it falls over.

So… File Share Witness, Yes or No ? … Mathematically speaking the short answer is …

…Even number of legs = Yes

…Odd number of legs = No

A bar stool with an odd number of legs isn’t an issue, an odd number of legs means a majority can always be determined, but for an even number of legs, losing half of the legs creates an issue – a majority can’t be determined, unless you have a witness (a backup leg).

Lets take a really simple example – a bar stool with 2 legs – this is your 2 node cluster.  Each leg is considered a vote, until it is removed, in which case its vote doesn’t count.

The state of the bar stool (quorum) is determined by how many legs are still standing (votes).  It would be pretty pointless setting up 2 node Always On cluster if you had no redundancy.  The mathematical  formula which explains how many legs a bar stool can afford to lose is… (legs/2)-1 … that’s (2/2)-1 … which equals zero legs.  Without a backup leg (file share witness), the bar stool could not sustain losing any legs… so it has no redundancy.

2legsfailure

File Share Witness -> With a backup leg however (file share witness), the bar stool can lose half its legs (1), form a majority and meet the number of Votes required to keep the bar stool standing.

2legsfailurewitness

Let take a 4 leg bar stool example…because lets face it, they usually do … how many legs can a bar stool afford to lose to keep standing ? …The formula is (legs/2)-1 … that’s (4/2)-1 … which is equal to 1 leg.  If a 4 leg bar stool loses 1 leg … this still forms a majority and the stool maintains its quorum…

4legtable2legsfailure

But if it loses two legs, (half of its legs), we are in trouble… a count of standing legs won’t reach a majority and the quorum can’t be sustained… unless…

4legtable2legsfailure

File Share Witness -> For a bar stool with an even number of legs, a bar stool CAN lose up to half its legs, as long as a backup leg (file share witness) is used.   You can see when half of the nodes are missing, a majority can still be determined and satisfied, when a file share witness is used.

4legtable2legsfailurewitness

In advanced Always On architecture, a node can be configured so that it as no vote.   It still participates in the cluster and the availability group, but for the purposes of counting a majority, the vote doesn’t count.  So a 4 node cluster, with 1 node set to no vote, gives a 3 node vote.  A majority can be determined with an odd number of votes so a file share witness is not needed.   Locating your file share witness in a third datacentre can also provide another level of resilience.

:D

Posted in Manage (SQL Server Admin), SQL 2012/2014 Installation and Upgrade | Tagged: , , | Leave a Comment »

Architecture: Bunch of SQL Server 2012 Whitepapers

Posted by popbi on June 20, 2014

There are a few gold nuggets in this bunch… get your SQL Server 2012 whitepapers here …

http://msdn.microsoft.com/en-us/library/hh403491(v=sql.110).aspx

“You can have it all. Just not all at once.” ― Oprah

 

Posted in Manage (SQL Server Admin), SQL 2012/2014 Installation and Upgrade | Tagged: | Leave a Comment »

DAX: NAAN is good…NAN is not…use DIVIDE

Posted by popbi on June 19, 2014

Just a minute while I reinvent myself …

Measure [ExampleWithoutDivide] divides one measure by another in your Tabular cube…and when you run a query in Management studio you get -1.#IND values …

Screen Shot 2014-06-18 at 1.31.29 pm

And in your Reporting Services dataset you get NaN values …

Screen Shot 2014-06-18 at 1.32.51 pm

Use DIVIDE in your MDX calculation as illustrated in the [ExampleWithDivide] measure above…

ExampleWithDivide:=DIVIDE([Measure1],[Measure2])

Oe Use an alternative result option to return a constant numeric value instead …

Screen Shot 2014-06-18 at 1.50.04 pm

ExampleWithDivide:=DIVIDE([Measure1],[Measure2],1)

See you in places
You’ll be upstairs…
And I’ll be there too…

Posted in Analyse (SSAS, Excel, MDX, DAX and Powerpivot), Report (SSRS Report Builder Power View) | Tagged: , , | Leave a Comment »

TSQL: <3 Search all your SQL Server Databases for a Specific Table …

Posted by popbi on June 16, 2014

We’re all just searching for something …

Bigger than we’re all able to find …

Chasing all the things that keep us young …

We won’t stop running til we reach the sun …

We’re just chasing what we can’t ever get … ever have …

EXEC sp_MSforeachdb 'USE ?
IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = ''YourTableName'')
BEGIN
SELECT ''?'' AS DATABASE_NAME, TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = ''YourTableName''
END'
Simple substitute your own table name into the code above and find the table you are looking for in any database on your SQL Server instance… Enjoy <3

Posted in Manage (SQL Server Admin) | Tagged: , | Leave a Comment »

SSRS: Creating Report Labels for Multi Select Parameter Selections

Posted by popbi on June 11, 2014

You want to display the selected multi select parameter values within a label in your report.   Add a textbox to your report, then use the following expression in your textbox to display your multi select parameter selections :

Your label will display “All Selected” – when all parameter values have been selected…

“Multiple Selected” – When more than one value has been selected but not all…

and the actual parameter label will be displayed of only one selection is made.

="For Parameter:   " &
IIF(COUNTROWS("YourDataset")=Parameters!YourParameter.Count,
"All Selected",
IIF(Parameters!YourParameter.Count>1,"Multiple Selected",Parameters!YourParameter.Label(0)))

Posted in Report (SSRS Report Builder Power View) | Tagged: | Leave a Comment »

SSRS: Email Report Subscriptions and the Greyed Out To Field Fiasco

Posted by popbi on May 29, 2014

You are creating a report subscription to Email, then you notice the To field is greyed out and you are unable to edit.   We assume you have setup your Reporting Services SMTP successfully because the Email option was available when you created your subscription.
Locate your RSReportServer.config file on the server where Reporting Services is installed.   Take a backup of this file and keep the backup in a safe place.    Now edit the RSReportServer.config file and search for the tag SendEmailToUserAlias – change the value from True to False so this line should look as follows.
<SendEmailToUserAlias>False</SendEmailToUserAlias>
Once edited, save the RSReportServer.config file.  There is no need to restart your Reporting Service service.  Try creating your report subscription to Email again.    The To field should now be unlocked and editable.

Posted in Report (SSRS Report Builder Power View) | Tagged: | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 89 other followers