Tag: syndicated

  • Copy-SqlJob, a handy dbatools cmdlet

    I really like the dbatools project. This is a series of PowerShell cmdlets that are built by the community and incredibly useful for migrations between SQL Servers, but also for various administrative actions. I have a short series on these items.

    One of the things I’ve often needed to do is move jobs around between instances of SQL Server. I’ll often test a job on one instance, maybe run it for awhile to see if it’s a useful addition to my instance, and then deploy the same job to other instances.

    I do this often with jobs that help each instance manage itself independently. While each new build often includes some standard settings and jobs, I do find that I’ll adjust jobs over time, fix bugs, enhance them, and I’ll need to move the job over. This has usually involved scripting the job on one instance, adding delete code, and then running the script on other instances.

    No longer.

    Enter Copy-SqlJob

    One of the cmdlets in dbatools is Copy-SqlJob, which does what you’d expect. It copies jobs from instance to instance. If you look at the docs, but default it copies all jobs, but I rarely need that. Though I might start using that for new builds along with Copy-SqlDatabase to move my DBA database from machine to machine.

    However, I can copy specific jobs, which is perfect for my purposes. Just put a list of jobs to be copied in a script and run that. Let’s see how this works. On one instance  I have a number of jobs.

    2017-05-01 13_58_50-SQLQuery2.sql - (local)_SQL2016.master (sa (82))_ - Microsoft SQL Server Managem

    Another instance has fewer jobs.

    2017-05-01 13_58_55-SQLQuery2.sql - (local)_SQL2016.master (sa (82))_ - Microsoft SQL Server Managem

    Let’s move just the CommandLog Cleanup and Output File Cleanup jobs over. I can fire up a PowerShell and go from there. I’ll start with the –WhatIf parameter, which lets me test without moving anything.

    2017-05-01 14_06_19-powershell

    That’s easy enough. Let’s just move one job for now, the CommandLog Cleanup job.

    2017-05-01 14_07_08-powershell

    And refreshing the second instance:

    2017-05-01 14_07_18-SQLQuery2.sql - (local)_SQL2016.master (sa (82))_ - Microsoft SQL Server Managem

    That’s useful, and it works easily across these instances with Windows Auth. What if I need SQL Auth? I can use SourceSqlCredential and DestinationSqlCredential to specify accounts. I can even have this prompt me for the password:

    2017-05-01 14_09_06-SQLQuery2.sql - (local)_SQL2016.master (sa (82))_ - Microsoft SQL Server Managem

    Once I type it in, the copy works.

    What if I update a job on the source server, and need to ensure the changes get copied to the destination? I can use –Force. If I don’t, I’ll get a message that the job exists. With the Force parameter, the job gets copied.

    2017-05-01 14_12_10-powershell

    This is a simple, but handy way to move jobs between servers. Many of the dbatools cmdlets are designed for migrations, and this is no exception. You can migrate jobs easily if that’s your requirement.

    I’d urge you to download dbatools and see which of these cmdlets might make your administration of SQL Server easier than you ever expected.

  • I’m on dbatools!

    I made the front page of dbatools, as a part of the community that is supporting this project. Along with quite a few others, I’m happy to be there and doing my part to make SQL Server administration and scripting easier.

     

    Maybe I’ll even write a cmdlet some day.  Since I keep working on my PoSh skills and playing with the various cmdlets.

  • Finding the Service Name–#SQLNewBlogger

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

    A quick one today, and this one I remembered without looking anything up.

    I recently needed the service name to kill it for a test. I was using the sc.exe command line and couldn’t get it to give me the SQL Agent service name. I could have hit Windows, typed services, scrolled down, found the Agent, right clicked it, selected properties, and gotten the name.

    Or I could do this:

    Get-Service | Where {$_.Name –Like ‘SQL*’}

    That worked and I could quickly see all the names.

    2017-04-18 11_19_49-cmd - powershell (Admin)

    The only thing that threw me was I forgot the hyphen before “like”. One of these days I’ll actually remember that.

  • How Can I Get Accepted to Speak at the PASS Summit?

    There has been some discussion and concern over the changes to the speaker selection process for the PASS Summit. I’ve written some thoughts, as have others (Joey, Andy), but I was struck a bit by Eugene Meidiner’s post. In it, he asks, how can I speak? What do I need to do beyond presenting at user groups or SQL Saturdays? How do you get to the Summit?

    I’ve got a few thoughts, but keep in mind this is a complex topic. I’d like to see some people write about their experiences, preferably those that have spoken only once or twice.

    The Path

    First, there is no one path. Unlike martial arts, or some other program, there isn’t a series of things you need to do in order to get selected. What works for one person might not work for another.

    It’s like getting recognized by Microsoft as an MVP. There isn’t a set of things to do, but some guidance that may help.

    Compete

    The next thing to understand is that this is a competition. Imagine that you want to run in the Olympics as a sprinter. You can do everything possible to increase your speed. You might be the best sprinter in your college, or region. You might run the 100m (mens) race in 9.90 in college. When you get to the trials, you run a 10.0.

    That’s not good enough if the top three go to the Olympics that year. The best three times at the trials were 9.8, 9.84, 9.98.

    Does that mean you’re not an amazing sprinter? No. You just weren’t one of the those selected that day.

    The PASS Summit speaker selection is way more complex. We divvy up the abstracts into various piles, mostly based on the topic area. If you look at last year’s schedule, there were five main areas. Your session is in one of those areas, competing with many others. If we pick (roughly) 60 sessions in an area, you have to be top 60 to make it. Doesn’t mean you’re not a great speaker, or don’t have a great session. It means you didn’t compete well enough at this time, for this event.

    Get Help and Get Better

    The way into the Summit is to get better at your craft. That’s better at your speaking craft, better at your abstract writing, certainly better branding yourself as a SQL Server expert. It’s not that you need to be smarter, better at the Microsoft Data Platform, but people have to think you are worth going to see.

    Adam Machanic has a great post on session abstracts. Louis Davidson has thoughts, and Brent Ozar has hints. There’s no magic formula. You have to build something that catches the eye of your peers, who are those reviewing the abstracts, and you have to impress them with the talk.

    Most of these people are volunteers that have attended lots of talks at events. They’ve seen lots of speakers. Certainly there can be bias towards those people whose sessions they’ve seen, or who they think has submitted an abstract, but mostly they’re looking for great content. Something they’d consider attending, or think others would.

    That’s subjective and unlikely to get much better. At some point someone has to make decisions, and so you need to ensure you impress people.

    Use the advice that’s out there. Have friends, or even more experienced speakers review your abstract. Try to find a good place to submit. If you want to talk T-SQL tricks, you’re going to compete with Mr. Ben-Gan, Mr. Betrand, Mr. Kline, and plenty of experienced speakers. Be careful of that. Find a place where you solve a problem, do it well, and it’s interesting to others. You won’t know if that’s true in a vacuum. Get feedback and advice from others.

    Gain Experience

    Part of the process is getting experience. This means presenting often, and learning to do it well. You need to ensure the audience likes watching your presentations.

    • Are you invited back?
    • Do multiple people tell you afterwards you had a great talk?
    • Do multiple places accept your abstract?

    You should be answering yes to all of these.

    My suggestions:

    • Present multiple talks for one group –  Learn to express yourself, communicate well, and handle different demos. You should get positive feedback from your local group, your virtual chapter, something.
    • Present the same talk to multiple groups – One of the things that helps me get better is to deliver the same talk more than once. I learn how to build better flows, how to correct previous issues, and explain myself better.
    • Enjoy Yourself – If you don’t really enjoy teaching people something, or impressing them with your knowledge, why do you want to speak at the Summit? Is it resume bullet? A bucket list item? Those are fine, but passion and enjoyment shine through.

    Cross Your Fingers

    This is a hard competition. Lots of people want to speak, and if you have submitted 4 times and never been picked, that doesn’t mean PASS is out to get you. Or that you suck. It means you didn’t make it over the bar those four times. Whether you did the same thing or four different things, the results could be the same.

    This year, I’d suggest that you try a multi-pronged approach. Refine something you submitted last year, with feedback from others. Add something new, but make sure you get feedback on this as well.

    Don’t give up, but don’t get too frustrated. At least this year if you’re a first time speaker, things are slightly easier. Invites mean that you aren’t competing against someone like Itzik Ben-Gan or Brent Ozar, who likely get invites. Therefore your abstract isn’t weighed against theirs. A focus on getting some level of new speakers mean you should get a little weight added to your submission as well.

    Enjoy the challenge, do your best, meaning put effort in, and let the chips fall.

    At least you won’t compete against me this year. I won’t submit, so there’s one or two slots that will be open.