Tag: administration

  • Important Alerts for SQL Server

    One of the things that I think is extremely important for DBAs and really anyone that has to administer a SQL Server instance is a set of alerts on various items that might occur.

    I ran across Glenn Berry’s article on Provisioning SQL Server and there’s a section in there that is titled “Setting Up SQL Server Agent Alerts”. It assumes you have Agent running (and you should), and includes a series of alerts that you can set to inform you when certain things occur.

    Glenn has alerts for severity errors 19-25, which are important, and then includes an alert for Error 825.  This error is indicative of possible corruption and at least some I/O issue with your storage. It’s important to have this error trapped, but in addition, I’d also recommend setting alerts for 823 and 824 errors.

    I would recommend modifying Glenn’s code to include this T-SQL as well.

    -- Error 823: Read Write Request Failure
    DECLARE @Error823AlertName SYSNAME = N'I/O Alert - Error 823: Read or Write request failure';
    
    EXEC msdb.dbo.sp_add_alert @name = @Error823AlertName,
                  @message_id=823,
                  @Severity=0,
                  @enabled=1,
                  @delay_between_responses=900,
                  @include_event_description_in=1,
                  @category_name=N'[Uncategorized]',
                  @job_id=N'00000000-0000-0000-0000-000000000000';
    
    EXEC msdb.dbo.sp_add_notification @alert_name = @Error823AlertName,
    @operator_name=@OperatorName, @notification_method = 1;
    GO
    -- Error 824: Read Write Request Failure
    DECLARE @Error824AlertName SYSNAME = N'I/O Alert - Error 824: Logical Consistency I/O Error';
    
    EXEC msdb.dbo.sp_add_alert @name = @Error824AlertName,
                  @message_id=824,
                  @Severity=0,
                  @enabled=1,
                  @delay_between_responses=900,
                  @include_event_description_in=1,
                  @category_name=N'[Uncategorized]',
                  @job_id=N'00000000-0000-0000-0000-000000000000';
    
    EXEC msdb.dbo.sp_add_notification @alert_name = @Error824AlertName,
    @operator_name=@OperatorName, @notification_method = 1;
    GO
    
  • Manage By Delegation

    powershell
    Powershell might be a great skill if you need to manage lots of instances.

    More and more SQL Server instances are being deployed all the time. In fact, with the ease with which we can build a new virtual machine (VM) through snapshotting and cloning, it seems that many administrators are finding that the number of servers for which they are responsible might be doubling or tripling.

    Even moving to the cloud doesn’t completely remove the need for some administration of your data and databases, though it does require you to rework the type of administration that you perform. I foresee more hybrid solutions over time, which will require DBAs to not only manage data, but help analyze the financial impacts of moving data (and analysis) to, or back from, the cloud.

    In SQL Server 2008 we had the chance to begin managing our servers through a set of declared rules with  Policy Based Management (PBM). I haven’t seen that feature take off, and it seems relatively few people are using PBM to manage their servers. I think it’s a great platform for ensuring that your instances are conforming to certain rules, though I think there is a bit of creativity needed to ensure that this system works well for you.

    Powershell is becoming integrated into all Microsoft products. Virtually everything in SQL Server, perhaps even every thing by now, can be managed through Powershell scripts that access the SMO objects. I hear various people say that Powershell is a critical skill for DBAs of the future. I’m not sure of that, but I do think it will be used more and more if you have the need to perform repeated actions on multiple servers. Whether you use it now or not, it doesn’t hurt to learn how it works and what it can do for you.

    It just might be the tool to make your job easier as you get more and more instances to manage, something that seems to happen more and more.

    Steve Jones


    The Voice of the DBA Podcasts

    We publish three versions of the podcast each day for you to enjoy.

  • (Mis)Using DBCC Page

    In one of my presentations recently I was recommending DBCC CHECKDB on every database every day. I realize that isn’t always possible or practical, so I noted that if you don’t have resources on your production server, or enough spare hardware, you should at least run it on every database once a month. At least on the database you care about.

    Someone in the audience asked if they could just script DBCC PAGE on every page in the database instead. I wasn’t sure if that was accurate, but I didn’t think it was. So I asked THE MAN, and he confirmed this doesn’t equate to a DBCC CHECKDB.

    I won’t attempt to give a complete explanation, mostly because I’m sure I’d miss something or be incorrect, but I will tell you how I feel about this, based on what I know.

    CHECKDB performs an extensive evaluation of not only all objects (and hence their pages), but also their linkages. It performs a more complete check by default, but you can add the PHYSICAL_ONLY flag to speed things up and limit the checks to just the physical structures and allocations. PHYSICAL_ONLY also skips Filestream checks.

    The DBCC PAGE command, undocumented, works, but it doesn’t really examine if the links and relationships between pages are correct.

    I can’t say that DBCC PAGE couldn’t be use to detect corruption or find issues, but I wouldn’t depend on it. YMMV, but I wouldn’t use this as a substitute for CHECKDB.

  • Database Maintenance Essentials – Resources

    I told people in New York at SQL in the City that I’d post some resources on the blog from my talk. My apologies for not getting it done over the weekend, but during a little downtime in Austin I’m getting it done.

    Checklist

    From the last slide, a checklist of things for you to look at on your instances.

      • Backups scheduled on all database (full and log)
      • DBCC CHECKDB running regularly on all databases
      • Test restores scheduled
      • Manage mdf/ndf/ldf file sizes
      • Proactively monitor and maintain indexes and statistics
      • Monitor jobs and set up alerts

    Challenge

    At work, someday soon, but in the next 30 days, go through the checklist on your important servers, or all your production servers, and assess your maintenance.

    Resources

    From the slide deck, which will come soon in email. These are a list of links and resources from the talk.