DBPedias

Your Database Knowledge Community

Jorge Segarra

  1. Magnify SQL Text with SSMS 2012

    This is just a quick tip to help with folks who present SQL code at events such as SQL Saturday. While most presenters use tools like ZoomIt (which if you present, please please learn to use this wonderful, free tool) sometimes it can get nauseating for attendees to watch you constantly zooming in and out, especially on code.

    A quick way around this is by using the magnification feature in SQL Server Management Studio 2012. To do this simply hold down the Ctrl button on your keyboard and with your mouse scroll the mouse wheel up to increase the magnification and scroll down to decrease it.  Alternatively you can simply click on the magnification dropdown, which is located at the bottom left of the query window (by default) and select your desired level of magnification.

    That’s it! Now you can quickly magnify your code to make it easier for your audience to see and you can reserve the zooming to highlight other areas as needed.

    Share

  2. Necromancing the Chicken

    First off, I’m sorry this space has been dead for so long. I’m sure I’ve dropped off many an RSS reader (as well as SQLRockstar’s Rankings) due to inactivity. Well, it’s high time I get back on the blogging wagon! So what’s happened since the last post (YIKES!) in September? Read on after the break to find out…

    Zombie chicken

    Rumors of my demise have been exaggerated…

    I Wrote A Book!

    Well not by myself, but I was a primary author on very major title in Microsoft SQL Server Bible 2012. This was crazy since it was such a massive title and effort from all authors involved. Huge thanks to my fellow author team of

    and contributing authors including:

    I’d also like to give a special thanks to our technical editors on this project:

    After the book writing, I decided to take a break from writing/presenting for a bit. I needed a mental break to regroup and refocus. I have a tendency to overload myself with commitments and after doing that for a couple of years straight it starts to wear on you as well as your family.

    PASS Summit 2012

    In November was the annual PASS Summit conference in Seattle. Unfortunately I wasn’t chosen to speak at last year’s event (fingers crossed for 2013 in Charlotte!) but I was fortunate enough to attend. Exciting news was announced about SQL Server 2012, PDW and vNext information around Project Hekaton. As always, this conference was great not just for the vast amounts of technical knowledge shared and acquired, but seeing all my friends and extended SQLFamily! This year Pragmatic Works also debuted our sponsored Rock Karaoke party which absolutely ROCKED! For those wondering, yes, we will be doing this event again so make sure if you’re in Charlotte this year to stop by Pragmatic Works’ booth and pick up your wristband before they’re all gone!

    Happy New Year!

    New year rang in, the Mayans were wrong and we’re all still kicking. Not much more to say than that I suppose. In the resolutions department, I never really set any but my current short terms goals include:

    • Getting back into blogging (regularly)
    • Losing weight – I’m back up to my heaviest weight again :-(
      • In the interest of actually having a concrete goal, let’s say initial goal is to lose 10 lbs
    • Attain some 2012 certifications
      • MCSA SQL Server 2012
      • Perhaps the Private Cloud certification?

    SQL University is Dead, Long Live SQL University!

    This will be explained more in a separate blog post but yes, SQL University is undergoing a major change and for the better (I believe). Don’t worry, all the content you’ve come to know and love will still be available but the project/site as a whole is going to have a massive facelift. Stay tuned for more information in an upcoming post!

    New Roost for the Chicken

    There’s been a whole lot of moving on my part in the last month. The first move happened with this blog. For the last few years, Brent Ozar (Blog | Twitter) has been gracious enough to host, without charging mind you, the blogs of many of your favorite neighborhood SQL Server bloggers on his server. Unfortunately the free ride couldn’t last forever and we bloggers had to find a new hosting home.

    I’d like to take a moment to give HUGE thank you to Brent. A huge part of my career advancement has been in large part due to to his mentorship, friendship and support. His blog on starting a technical blog was one of the large catalysts that helped me get into the SQL Server Community and going down that path was one of the best choices I’ve ever made. So THANK YOU Brent!

    The second move was actually a physical one. For the last two years my wife Jessica (Blog | Twitter) and I have been living in Jacksonville, Florida. In February we made the move back to Tampa, Florida. For those wondering, yes, I’m still with Pragmatic Works. No, you don’t need to live in Jacksonville to work for them so if you’re thinking of applying to work with us (and yes, we’re always looking for great SQL Server talent, both BI and DBA) then shoot your resume over to jobs@pragmaticworks.com and tell them I sent you. ;-)

    New Presentations

    On the professional side of things I’ve been working on a few new presentations this year including:

    • What Is a BI DBA? – Overview of administering the Microsoft BI stack (SSIS, SSAS, SSRS)
    • Creating a Personal VM Lab – General walkthrough of how to create/setup VMs on your laptop for creating a personal test lab
    • Do More With Less: Consolidation and Virtualization – Overview of consolidation strategies

    I’m hoping to present at least one of these at PASS Summit this year, fingers crossed! I’ve been on a bit of a presentation tear the last few months. If you’d like me to present (remote is great too if your group supports it), please drop me a line at jorge@sqlchicken.com or shoot me a tweet. I love me some presenting!

    Share

  3. 24 Hours of PASS Fall 2012

    Do you like training? Do you like FREE training? Then make sure you check out the 24 Hours of PASS event that starts today at 12:00 GMT. If you miss the events of the day, no worries, the recordings will be up within a few weeks.

    Check out the great schedule of events:

    Thursday, September 20, 2012

    Session 01 (BIA) – Starts at 12:00 GMT
    Choosing the Right Reporting Platform
    Presenter: Brian Knight, Devin Knight

    Session 02 (DBA) – Starts at 13:00 GMT
    Best Practices for Upgrading to SQL Server 2012
    Presenters: Robert Davis

    Session 03 (AppDev) – Starts at 14:00 GMT
    Three Ways to Identify Slow Running Queries
    Presenter: Grant Fritchey

    Session 04 (AppDev) – Starts at 15:00 GMT
    Fasten Your Seatbelt – Troubleshooting the Most Difficult SQL Server Problems
    Presenter: Klaus Aschenbrenner

    Session 05 (CLD) – Starts at 16:00 GMT
    SQL Server Private Cloud != Azure
    Presenter: Allan Hirt, Ben DeBow

    Session 06 (AppDev) – Starts at 17:00 GMT
    What are the Largest SQL Server Projects in the World?
    Presenter: Kevin Cox

    Session 07 (AppDev) – Starts at 18:00 GMT
    Practical Demos of Text Mining and Data Mining using SQL Server 2012
    Presenter: Mark Tabladillo

    Session 08 (DBA) – Starts at 19:00 GMT
    PowerShell 101 for the SQL Server DBA
    Presenters: Allen White

    Session 09 (BID) – Starts at 20:00 GMT
    Mobile Business Intelligence
    Presenter: Jen Underwood

    Session 10 (BID) – Starts at 21:00 GMT
    Slow MDX Queries: The Case of the Empty Tuples
    Presenter: Stacia Misner

    Session 11 (DBA) – Starts at 22:00 GMT
    Using SQL Server 2012 Always On
    Presenters: Denny Cherry

    Session 12 (PD) – Starts at 23:00 GMT
    Leadership – Winning Influence in IT Teams
    Presenter: Kevin Kline

    Friday, September 21, 2012

    Session 13 (BIA) – Starts at 00:00 GMT
    BI Architecture With SQL 2012 & SharePoint 2010
    Presenter: Rod Colledge

    Session 14 (DBA) – Starts at 01:00 GMT
    DBCC, Statistics, and You
    Presenters: Erin Stellato

    Session 15 (BIA) – Starts at 02:00 GMT
    SSIS Design Patterns for Fun and Profit
    Presenter: Jessica Moss, Michelle Ufford

    Session 16 (AppDev) – Starts at 03:00 GMT
    Characteristics of a Great Relational Database
    Presenter: Louis Davidson

    Session 17 (BIA) – Starts at 04:00 GMT
    What’s All the Buzz about Hadoop and Hive?
    Presenter: Cindy Gross

    Session 18 (AppDev) – Starts at 05:00 GMT
    Taking SQL Server Into the Beyond Relational Realm
    Presenter: Michael Rys

    Session 19 (BIA) – Starts at 06:00 GMT
    Agile Data Warehousing with SQL Server 2012
    Presenter: Davide Mauri

    Session 20 (AppDev) – Starts at 07:00 GMT
    Digging Into the Plan Cache
    Presenter: Jason Strate

    Session 21 (BIA) – Starts at 08:00 GMT
    Introduction to Microsoft’s Big Data Platform and Hadoop Primer
    Presenter: Denny Lee

    Session 22 (BID) – Starts at 09:00 GMT
    Big Data Analytics with PowerPivot and Power View
    Presenter: Peter Myers

    Session 23 (CLD) – Starts at 10:00 GMT
    Best Practices and Lessons Learned Using SSIS for Large Scale Azure Data Movement
    Presenter: Steven Howard

    Session 24 (PD) – Starts at 11:00 GMT
    Mentoring for Professional Development
    Presenter: Andy Warren

    * Please be sure to check our time zone guide for exact times in your area. This 24 Hours of PASS event begins at 12:00 GMT on September 20 and runs for 24 consecutive hours.


  4. How To Prevent SELECT * The Evil Way

    SELECT * FROM…when administrators see that from developer code, we generally tend to cringe. Why? In a nutshell, it’s terrible on a few fronts. First, typically that SELECT * FROM that gets written (a lot of the times) lacks a WHERE clause. What’s the problem? Well, that pulls back every single row from the table.

    Sure, that may not be too bad on a table with a few hundred rows but what about on a table with millions? That could cause a lot of performance problems since you’re trying to read all the data off disk (again, potentially).  Secondly, do you really need all those rows and/or columns? It’s a waste of time and resources to pull back every column from a table if your application is only going to be using a few of them anyways.

    So how do we prevent this? Well I recently learned an extremely evil way of preventing such a query. I’d like to start off with, this was NOT my idea. I learned this trick from Adam Jorgensen (Blog | Twitter). I’d also like to add this disclaimer:

    DO NOT JUST GO DO THIS IN YOUR PRODUCTION ENVIRONMENT! I am not responsible for whatever evil you turn loose upon your environment. Always test things out in a development environment first and get proper approvals before making any changes.

    Pure Evil Method

    This method is actually evil in its simplicity. What we’ll be doing is adding a new column to the existing table. The “trick” is that this will be a computed column whose formula will cause an error, specifically a divide by zero error. As shown in screenshot below, create the new column on the table and call it something obvious like ‘DoNotSelectAll’. In the Column Properties window, under the Table Designer section, there is a property called Computed Colum Specification. In the formula section, enter (1/0). Save your table.

    image

    Now if I try to do my SELECT * on this table, I’ll get this lovely message:

    image

    Alright, we learned our lesson, now we’ll explicitly name our columns that we need:

    image

    Now this last query worked but notice how I didn’t put a WHERE clause so it pulls back all rows anyways? Yup, your users can still pull back everything, but at least they’re not doing a SELECT *. Also keep in mind, if you’re used to right-clicking that table in SSMS and selecting TOP 1000, with this column in place it will error for you as well. What are your alternative options?

    LESS EVIL METHODS

    Abstraction

    Another way to control this kind of behavior is by not letting users hit base tables at all. You could create Views that have queries in them that limit rows returned. This way a user can do a SELECT * on a view, but the underlying code of the view itself is limiting row returns.

    Depending on your situation, this could work and it could not. If the user needed very specific data returned that wasn’t in that limited pool of results could adversely affect whatever process they’re using the data for.

    Another option is wrapping everything in stored procedures and granting users access to executing stored procedures rather than querying tables and views. On the one hand, could be good since you’re encapsulating the code. Users can pass parameters to stored procedures so you could make the queries somewhat dynamic.

    Handbrake

    In SQL Server 2008 they introduced a feature called the Resource Governor. This feature allows you to throttle resources on queries based on custom functions and groupings you specify. Yes, it’s an Enterprise Edition feature but it can be well worth it if you’re having resource-related issues due to runaway queries.

    Now this feature will NOT prevent users from doing SELECT * –type queries, however you can throttle how much resource is allocated toward a query so you can at least control how badly it’ll affect you.

    Security

    My friend Brian Kelley (Blog | Twitter) will probably appreciate this one. Be stringent with the accesses you grant! Grant users only the accesses they need. Also, ff you don’t want users banging against your transactional systems directly, think about setting up a dedicated/isolated reporting environment and point the users there instead.

    The reporting box you stand up doesn’t have to be (necessarily) as beefy as your transactional system and you can setup customized security on that database. This is especially helpful for when the transactional system is a vendor application which you can’t make any modifications to the code.

    Do you have any other suggestions/tricks to help prevent crazy user queries? Let’s hear it in the comments!


  5. Identify and Alert for Long-Running Agent Jobs

    Being a DBA is like being a train conductor. One of the biggest responsibilities is making sure all jobs are running as expected, or making sure “all the trains are running on time” so to speak. As my partner-in-crime Devin Knight (Blog | Twitter) posted earlier, we have come up with a solution to identify and alert for when SQL Agent jobs are running longer than expected.

    The need for this solution came from the fact that despite my having alerts for failed agent jobs, we had a process pull a Palin and went rogue on us. The job was supposed to process a cube but since it never failed, we (admins) weren’t notified. The only way we got notified was when a user finally alerted us and said “the cube hasn’t been updated in a couple days, what’s up?”. Sad trombone.

    As Devin mentioned in his post the code/solution below is very much a version 1 product so if you have any modifications/suggestions then have at it. We’ve documented in-line so you can figure out what the code is doing. Some caveats here:

    • This solution has been tested/validated on SQL Server 2005 (SP4) and 2008 R2 (SP1).
    • Code requires a table to be created in a database. I’ve setup a DBAdmin database on all servers here for custom scripts for DBAs such as this, Brent Ozar’s Blitz script, Ola Hallengren’s maintenance solution, Adam Machanic’s sp_whoisactive, etc. You can use any database you’d like to keep your scripts in but just be aware of the USE statement at top of this particular code
    • This solution requires that you have Database Mail setup/configured
    • To setup this solution, create an Agent job that runs ever few minutes (we’re using 5) to call this stored procedure
    • FYI, I set the mail profile name to be the same as the server name. One – makes it easy for me to standardize naming conventions across servers. Two – Lets me be lazy and code stuff like I did in the line setting the mail profile name. If your mail profile is set differently, make sure you correct it there.
    • Thresholds – This is documented in code but I’m calling it out anyways. We’ve set it up so that any job whose average runtime is less than 5 minutes, the threshold is average runtime + 10 minutes (e.g. Job runs average of 2 minutes would have an alert threshold of 12 minutes). Anything beyond a 5 minute average runtime is controlled by variable value, with default value of 150% of average runtime. For example, a job that averages 10 minute runtime would have an alert threshold of 15 minutes.
    • If a job triggers an alert, that information is inserted into a table. Subsequent runs of the stored procedure then check the table to see if the alert has already been reported. We did this to avoid having admins emailed every subsequent run of the stored procedure.

    CODE

    
    USE [DBAdmin]
    GO
    
    --Create the table to store results
    CREATE TABLE [dbo].[LongRunningJobs] (
        [ID] [int] IDENTITY(1, 1) NOT NULL
        ,[JobName] [sysname] NOT NULL
        ,[JobID] [uniqueidentifier] NOT NULL
        ,[InstanceID] [int] NULL
        ,[AvgDurationMin] [int] NULL
        ,[DurationLimit] [int] NULL
        ,[CurrentDuration] [int] NULL
        ,[RowInsertDate] [datetime] NOT NULL
        ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[LongRunningJobs] 
    ADD CONSTRAINT [DF_LongRunningJobs_Date] DEFAULT(getdate())
    FOR [RowInsertDate]
    /****** Object:  StoredProcedure [dbo].[usp_LongRunningJobs]    Script Date: 07/06/2012 16:29:23 ******/
    IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_LongRunningJobs]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[usp_LongRunningJobs]
    GO
    
    USE [DBAdmin]
    GO
    
    /****** Object:  StoredProcedure [dbo].[usp_LongRunningJobs]    Script Date: 07/06/2012 16:29:23 ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    -- =============================================
    -- Author:		Devin Knight and Jorge Segarra
    -- Create date: 7/6/2012
    -- Description:	Monitors currently running SQL Agent jobs and
    -- alerts admins if runtime passes set threshold
    -- =============================================
    CREATE PROCEDURE [dbo].[usp_LongRunningJobs]
    AS
    
     --Set Mail Profile Information
     DECLARE @MailProfile varchar(50)
     SET @MailProfile = (SELECT @@SERVERNAME) --Replace with your mail profile name
    
     DECLARE @MailRecipients varchar(50)
     SET @MailRecipients = 'DBAGROUP@adventureworks.com'
    
     --Set limit in minutes (applies to all jobs)
     --NOTE: Percentage limit is applied to all jobs where average runtime greater than 5 minutes
     --		 else the time limit is simply average runtime + 10 minutes
     DECLARE @JobLimitPercentage float
     SET @JobLimitPercentage = 150 --Use whole percentages greater than 100
    
      --Temp table exists check
     IF OBJECT_ID('tempdb..##RunningJobs') IS NOT NULL
     DROP TABLE ##RunningJobs
    
     CREATE TABLE ##RunningJobs
    (
    	[JobName] [sysname] NOT NULL,
    	[JobID] [UNIQUEIDENTIFIER] NOT NULL,
    	[InstanceID] [INT] NULL,
    	[AvgDurationMin] [INT] NULL,
    	[DurationLimit] [INT] NULL,
    	[CurrentDuration] [INT] NULL
    )
    
    INSERT INTO ##RunningJobs (JobName, JobID, InstanceID, AvgDurationMin, DurationLimit, CurrentDuration)
    (
     --Query for currently running jobs that exceed established limits
    
     SELECT  jobs.name AS [JobName]
    	 ,jobs.job_id AS [JobID]
    	 ,MAX(hist.instance_id) AS [InstanceID]
    	 ,AVG(FLOOR(run_duration/100)) AS [AvgDurationMin]
      	 ,[DurationLimitVar] =
      		CASE
      			--If average runtime less than 5 minutes, limit is average runtime + 10 minutes
      			WHEN AVG(FLOOR(run_duration/100))  (AVG(FLOOR(run_duration/100))) * @JobLimitPercentage
    )
    
    IF EXISTS(SELECT CRJ.*
    FROM ##RunningJobs CRJ
    WHERE CHECKSUM(CRJ.JobID,CRJ.InstanceID) NOT IN (SELECT CHECKSUM(JobID,InstanceID) FROM dbo.LongRunningJobs) )
    
    --Send email with results of long-running jobs
    EXEC msdb.dbo.sp_send_dbmail
        @profile_name = @MailProfile,
        @recipients = @MailRecipients,
        @query = 'USE DBAdmin; Select CRJ.*
    From ##RunningJobs CRJ
    WHERE CHECKSUM(CRJ.JobID,CRJ.InstanceID) NOT IN (Select CHECKSUM(JobID,InstanceID) From dbo.LongRunningJobs) ' ,
        @body = 'View attachment to view long running jobs' ,
        @subject = 'Long Running SQL Agent Job Alert',
        @attach_query_result_as_file = 1;
    
    --Populate LongRunningJobs table with jobs exceeding established limits
    INSERT INTO [DBAdmin].[dbo].[LongRunningJobs]
               ([JobName]
               ,[JobID]
               ,[InstanceID]
               ,[AvgDurationMin]
               ,[DurationLimit]
               ,[CurrentDuration])
          (
    SELECT CRJ.*
    FROM ##RunningJobs CRJ
    WHERE CHECKSUM(CRJ.JobID,CRJ.InstanceID) NOT IN (SELECT CHECKSUM(JobID,InstanceID) FROM dbo.LongRunningJobs) )
    
    DROP TABLE ##RunningJobs
    
    GO
    

    Got any feedback/comments/criticisms? Let me hear them in the comments!


  6. BIxPress 3.5–Now With More Awesome!

    Pragmatic Works has now released version 3.5 of the award-winning BIxPress software! For those not familiar with BIxPress it’s a tool that helps you develop SSIS/SSAS solutions faster, easily/quickly deploy SSIS packages, monitor performance SSIS packages and much, much more!

    So what’s new with 3.5? In addition to now having SQL Server 2012 support (SSIS), you may have noticed in previous released that Reporting Services didn’t get much love. That all changes with this release as we now have incorporated health monitoring of Reporting Services instances called Reporting Performance Monitor!The new dashboard includes Average Runtime for Reports, Longest Running Reports, Report Memory Usage, Average number of Rows, Active Users, et cetera:

    BIxPress Reporting Console Dashboard

    Another great feature in this release is the Report Deployment Tool. This feature lets you quickly and easily deploy your Reports, Folder Structures, and Data Sources between Reporting Services instances!

    BIxPress Report Deploy

    One more major update in this release is the update to the SSIS Package Performance monitoring interface. Same great insight, new cleaner interface!

    BIxPress Package Performance Report

    What are you waiting for? If you already have BIxPress, you can update through the regular process. Don’t have it yet and want to try it out? Download a trial copy today! Also, if you’re a Microsoft MVP don’t forget Pragmatic Works offers NFR licenses to MVPs, so go get your copies today!


  7. Pragmatic Works Software for MVPs

    PW_logo_lgThis is just a quick post to remind folks who are current Microsoft MVPs that Pragmatic Works offers NFR licenses of its software! This NFR offer includes:

    • BIxPress – Audit, Notify, Deploy and Manage SSIS Packages
    • BIDocumenter – One Stop Documentation Solution for SQL Server, SSAS, SSRS and SSIS
    • Task Factory – Collection of high performance SSIS components
    • DTSxChange (10-pack) – Profile, Convert and Monitor. One stop DTS to SSIS Migration Solution

    To get your licenses simply email our Sales folks and they’ll be happy to get you started! If you’re not an MVP and would like to try our software, you can download trial versions of all our software as well.


  8. STOP! Consolidate and Listen

    I just wrapped up my 24 Hours of PASS session on consolidation. A big THANK YOU again to everyone in attendance, who kindly put up with my horrendous rapping “skills”! As promised, below is the link to the slide deck. In the presenter’s notes you’ll find some good links and resources for consolidation.

    Download link: STOP_Consolidate_and_Listen_24HOP (ZIP file)

    If you have any additional questions around consolidation, virtualization or my general sanity feel free to leave them in the comments section below, thanks!


  9. Monday Morning Mistakes: Not Setting Memory Limits

    Welcome back to another addition of Monday Morning Mistakes series. Today’s issue is one I tend to run into quite often with clients and is an important topic to know about as a database administrator. Without further ado, let’s get to our issue

    Issue

    You have SQL Server database engine installed on a system with other services such as Analysis Services, Reporting Services and/ or Integration Services and you constantly seem to run out of memory. Restarting service seems to fix the issue temporarily but some time later the same problem returns.

    Solution

    Always ALWAYS set max memory options for your SQL Server-related services! Setting a hard set maximum keeps your systems from “running away” with memory and causing unexpected performance issues in your environment. This becomes especially important in environments where you’re running multiple services on the same server. In a nutshell here is a breakdown of the different SQL Server services and how they utilize memory by default (read also: running with default settings in relation to memory). The two biggest problem children, in regards to memory configuration, are the database engine service and Analysis Service. Although those two are the most commonly misconfigured, I’ve outlined all four services below.

    Database Engine (aka SQL Server service)

    By default, the Max Server Memory (MB) setting is set to 2147483647. This is one of the first things you want to change upon a new install of SQL Server! In layman’s terms this default setting tells SQL Server it can essentially take up all of the physical memory on the server for use by the SQL Server buffer pool. Notice I said buffer pool and not SQL Server in total? Pre SQL Server 2012, this setting really is setting max memory for the buffer pool but folks have come across instance where they set the max memory setting and yet SQL Server shows it’s actually using more memory than that. Starting with SQL Server 2012, this setting actually dictates how much SQL Server (buffer pool + everything else) can use so it’s less confusing. See this post by Jonathan Kehayias (Blog | Twitter) for more details on what the max memory setting truly means: http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/08/24/troubleshooting-the-sql-server-memory-leak-or-understanding-sql-server-memory-usage.aspx

    Best practice suggests setting this value instead to 80% of physical memory on a server that only has the database engine running. You will need to use smaller percentage if box is sharing resources with other services. Please note this 80% rule is flexible as systems with larger amounts of memory you can increase that percentage. As an example, in the figure below you can an example where I’ve set the max memory for a system with 8GB of RAM and running only the SQL Server database engine on the box. For a great guide on setting max server memory for the engine service see Glenn Berry’s (Blog | Twitter) post on the matter: http://sqlserverperformance.wordpress.com/2009/10/29/suggested-max-memory-settings-for-sql-server-20052008/

    image

    Analysis Services (SSAS)

    This one is really interesting as many folks install SQL Server Analysis Services (SSAS) without realizing what the configurations involved are/do. In a default installation of Analysis Services, the service’s value for LowMemoryLimit is set to take 65% of physical memory by default. Now granted this service does not suck up this much at startup (that value is controlled by PreAllocate property) but if you were to use Analysis Services while running the engine on the same box, Analysis Service will not start freeing up memory until this minimum is reached. Up until that point, any memory used by Analysis Service is exclusive to it. If you’re installing multiple services on the same server, you’ll want to not only set the minimum memory setting here, but you’ll also want to set the TotalMemoryLimit and HardMemoryLimit. Your HardMemoryLimit is really the important one you want to configure as that is the percentage at which SSAS will start denying user and system requests due to memory pressure (essentially an out of memory error). For administrators, a must-read guide for Analysis Services is the SQL Server 2008 R2 Analysis Services Operations Guide. It’s lengthy at 108 pages but you can jump to section 2.3 (Memory Configuration) to get the full details on these settings and how they function.

    Reporting Services (SSRS)

    SQL Server Reporting Services (SSRS) memory settings can be configured but it’s not as straight forward as the other services are. In order to configure SSRS you need to modify an XML configuration file (rsreportserver.config). In a default installation, this file is located at C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer. Please note that path could change depending on what version of SQL Server you’re running, if you’re running 64 or 32 bit installation, and what drive/folder path you’ve installed your services on. If you have trouble locating it, simply do a search on your file system for the rsreportserver.config file.

    image

    SSRS, like Integration Services, is typically benign in regards to memory usage. However if you have an environment where it gets utilized heavily, especially on a system that is sharing resources with multiple services, then you may want to tweak these settings. For best practices regarding Reporting Services configurations I suggest you look at the whitepaper from SQLCAT team on Scale-Out Deployments for Reporting Services Best Practices.

    Integration Services (SSIS)

    Unfortunately this service’s memory usage actually can’t be configured like the other services can. Instead optimization needs to occur at the package level. Having the SSIS service installed alongside the database engine service is quite common and usually doesn’t cause too much issue so long as all the other services are configured optimally. You can read more about SSIS Design and Performance Tuning http://sqlcat.com/sqlcat/b/presentations/archive/2009/05/02/designing-and-tuning-for-performance-your-ssis-packages-in-the-enterprise-sql-video-series.aspx or watch a free webinar from Pragmatic Works on SSIS Performance Tuning: http://pragmaticworks.com/resources/webinars/WebinarSummary.aspx?ResourceID=265

    Conclusion

    Remember this post is to help those who have multiple services (or even all the services) running on the same server. Best practice dictates that for best performance you’d want to segregate one or all services to their own servers, but make sure you do what makes sense for your environments. Best practices aren’t necessarily one size fits all* so make sure you do your homework!

    *Unless that best practice dictates not to auto-shrink your databases. Seriously, don’t shrink your databases, please think of the kittens.


  10. Monday Morning Mistakes: SSIS Expressions Not Evaluating Correctly

    M3logo

    SSIS Expressions

    Expressions in SISS are great. They allow you to create dynamic values for all sorts of stuff like variables, connection strings, properties for almost anything, etc. One huge issue that tends to trip up a lot of folks, especially those new to SSIS, is the evaluation of those expressions when using variables.

    The Issue

    You create an SSIS variable with an expression but at runtime the expression is not evaluating as expected. Instead the expression value is using the default/static value of the variable.

    Quick Answer

    Make sure property for ‘Evaluate as an Expression” on the variable is set to True. Without it being set to true, the variable will evaluate to the hard set value.

    Explanation

    Even if you create an expression on the variable through the expression editor, and even if you test the expression and it evaluates correctly in the editor, the package will not use that expression unless you explicitly set the property on that variable to evaluate as an expression. When the property is set to false, the package will evaluate the hard set value and not the expression! In order to clearly show this in action, I’ve created a quick video below showing this behavior in action.

    Example:

    To demonstrate this behavior I created a simple SSIS package that has a single variable named strMessage. The value I set for it is Manual text. Go to the properties for the variable, find the properties for expressions and click the ellipses button to open the Expression Builder. In the Expression window copy/paste this expression:

    “This is an expression with a date: ” +  (DT_STR, 30, 1252) GETDATE()

    You can hit the Evaluate Expression button to verify the code is evaluating correctly. Click OK to close the Expression Builder.

    image

    In the Control Flow I’ve created a Script Task that creates a message box that displays the value of the variable. Here is the code (VB) inside the script task’s main section of code:

    Public Sub Main()

    MsgBox(Dts.Variables(“strMessage”).value)


    Dts.TaskResult = ScriptResults.Success
    End Sub

    This code simply populates a message box with the value from strMessage variable.

    Don’t forget to supply the variable name in the ReadOnlyVariables property of the script, otherwise the script task won’t be able to read the variable from the package.

    image

    If you execute the package you’ll get a pop up box that should show you this:

    image

    Notice how the value of the message is pulling from the static value of the variable and not the expression? Now stop the package from running (hit the Stop button or press Shift+F5).

    Go back to the properties for your variable and look for a property called EvaluateAsExpression. Change the value of that property to True.

    image

    Now run the package again, this time you should see:

    image


  1. 1
  2. Next ›
  3. Last »