Author: way0utwest

  • #RedgateRocks at the PASS Summit

    If you are attending the PASS Summit next week in Seattle, and want to attend a fun party on Thursday night, come by the Redgate Software booth in the expo hall for your #RedgateRocks bracelet. This is your ticket to admission Thursday night.

    Walk down to 1927 3rd Ave between 7:30-10:30 Thursday night and come in. We’ll buy the first drink and have some nibbles, as the Brits say.

    Grant and I will be down there for at least part of the night along with plenty of Redgaters enjoying the night. We might not look quite the same, but we’ll be having some fun.

    Steve-and-Grant

    There’s plenty of other Redgate contests and fun for the week, so come see us at the Summit.

  • Where Do You Run Your R Scripts?

    I know most of you don’t work with the R language. In fact, plenty of you might not know anything about R other than a cursory understand of this as some sort of data analysis language. If you want to know more, here’s what the R Project is.

    Microsoft wants you to use R Services in SQL Server, or the R Server product available as a standalone system. However, I saw someone ask the question why would someone run their R scripts inside SQL Server, because these are expensive CPU cycles to burn on analysis. Someone else noted that Microsoft loves your licensing dollars, so their push to use R Services is perhaps a little self serving.

    Push the intellignce to the data makes sense. Isn’t that what we do with large data warehousing queries or SSAS cubes? We’re trying to get the analysis done at scale without having to move the data elsewhere, especially considering we’ve (usually) already moved the data in some sort of ETL (or ELT) process. Gaining insights from our ever increasing scales of data requires some computational cycles somewhere.

    What’s the alternative? Large queries that pull data to some client? I think that’s fine, and that might be a better alternative since simple queries to pull data don’t burn as many CPU cycles as those that might perform analysis. I certainly understand that the licensed CPU cycles for a SQL Server instance are expensive, and we want to be careful how they are used. Adding complex R scripts might not be the best use of our licensing dollars. On the other hand, if I can perform analysis quicker, that is more useful, than perhaps I can eliminate other random queries analysts want to run on my database?

    Ultimately I think that R Services make some sense in SQL Server, but not as some experiment. I would suggest that the R client is the way to experiment, preferably on a copy of data that allows someone to build scripts and determine if there is insight to be gained from a particular set of data. Build a Proof of Concept (POC), and only deploy it to a SQL Server if you find it provides value.

    And if you do so, continue to experiment. That R script you run today might not be as useful in six months as your application, database, and business evolve. Data analysis isn’t a set-it-and-forget-it, but rather an ongoing, iterative process.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 3.8MB) podcast or subscribe to the feed at iTunes and Libsyn.

  • Creating a Logon Trigger–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    Suppose you want to audit logins for your SQL Server instance. There are multiple ways to do this, but Logon Triggers have a few advantages. First, they get data into a table that most of us are familiar with, SQL Server. Second, they guarantee that the event is captured on the instance if the trigger is enabled.

    There are plenty of other uses for these triggers, but beware that you can cause problems if your code doesn’t execute flawlessly.

    I’ll show you how to create a basic logon trigger here. Note, these are server level items, and you’ll need to be able to create the trigger in the master database.

    The structure of this code is similar to other triggers. We’ll use the CREATE TRIGGER DDL. Where this differs from DML triggers is that we use the ON ALL SERVER command. For auditing, I tend to set this as an EXECUTE AS ‘sa’, but you may choose a different type of account.

    Here’s my basic code:

    CREATE TRIGGER LogonTrigger
    --ALTER TRIGGER LogonTrigger
    ON ALL SERVER
    WITH EXECUTE AS 'sa'
    FOR LOGON
    AS
    BEGIN
        INSERT DBAAdmin.dbo.LoginAuditing
        SELECT SYSDATETIMEOFFSET(),
            ORIGINAL_LOGIN(),
            HOST_NAME(),
            APP_NAME();
    END;
    GO
    Note in this code  I’m specifying a specific table to store data in. This has to exist.

    I also use the FOR LOGON event. You can scope triggers for other events, at the server or database levels, and read more about DDL triggers in BOL.

    Once a user attempts to logon, the trigger fires and a simple insert takes place. If there are errors in inserting this data, the user may not be able to logon.

    There is a lot to write about logon triggers, but for this short piece, I’m just showing hot to get started. Please, please, please, be careful with these and read the documentation carefully. Be sure you understand how they work and how to disable them. If you implement one, test it extensively.

    SQLNewBlogger

    I had a small issue building a logon trigger, and thought I’d get a few posts written on the topic. This was 5 minutes work since I had the code and just wanted to describe things, but I’ve got a few more posts sketched on this topics  as I’ve learned more.

    Learning something, solving a problem, writing about it. This is a good way to show someone you are learning about a topic and developing some skill.

  • Fun and Contests at Summit 2016

    I’ll be attending the 2016 Pass Summit as a part of the Redgate Software crew. I’m not speaking this year, so most of my time will be at the Redgate booth, showing you a few tricks and tips with products and maybe convincing you that we can help your company produce software just a little bit better.

    As a part of the Redgate experience this year, we have a few fun contests for you, an amazing new product, and a party as well. First, the contests.

    Win Coffee

    Many of us like coffee. Even if you don’t, I bet someone in your life does. Redgate is giving you that chance to win Death Wish Coffee. In fact, you can win a year’s supply. Just the thing to help you get through those longs weeks at work.

    Come by the Redgate booth and learn the answers to a few questions. Then enter online.

    Oh year, you’ll also win a SQL Toolbelt + support.

    Win a GoPro Hero 5 Session

    We have a difference flyer that you can fill out and return to win a GoPro Hero 5 Session. That’s a neat little camera that looks like a lot of fun. In fact, maybe I need to get one of these for some mini movies in my life.

    SQL Clone

    I’m excited about SQL Clone. In fact, I saw a demo, using mocked up basic PoSh over a year ago and I knew this was a great idea. It’s finally coming to fruition, with a beta release next month (Nov 2016).

    However, Grant is presenting a session SQL Clone on Thursday, Oct 27, at 3:15pm. Come see this talk and learn why I think this will really help with database development (and other tasks).

    Redgate Rocks

    Thursday night, Oct 27,  Redgate Software is hosting a party. This will be from 7:30-10:30 at 1927 Events on 3rd Ave. With drinks and snacks, this will be a fun time and  a good chance to unwind and chat with colleagues.

    You’ll need a wristband to attend, so be sure to stop by the Redgate booth and pick one up.

    Follow @redgate

    We’re on twitter as @redgate, and we’ll be posting updates during the week, so keep in touch with us and hope to see you next week.