Musings of a Data professional

Stuart Moore

Author: Stuart Moore Page 12 of 18

Nottingham based SQL Server DBA who dabbles with many other technologies. 15+ years of experience with databases and still keen to learn and explore.

Automation: Making the boring slightly more interesting

T-SQL Tuesday

T-SQL Tuesday time again. This month SQLChow (b|t) is has set us the homework assignment to talk about SQL Sever Automation. So here’s my take on the subject:

Every job has those mundane repetitive tasks than you HAVE to do, day in day out.

As SQL Server DBAs we have a particularly long list of things that we have to do to make sure our databases are working properly, and also to ensure that when they’re not we can fix them quickly enough that we’re not looking for a new job!

Using PowerShell to add images to mp3 files

PowerShellI spent a fair chunk of the Christmas break ripping yet more of my CD collection to mp3s so I can shove them on the home NAS, put the CDs in the loft and reclaim a load of space. Ripping them was a fairly predictably repetitive job of shoving CDs into the drive, waiting for the FreeDB lookup to run (or fail, which meant a bit of typing) and then hitting the go button.

Not the most fun of jobs, but still a lot less work that when I digitised some large parts of my vinyl collection a few years ago After a couple of days I had a nice collection of mp3s all sat there on a disk ready to be imported into the main collection folder.

Just one job remained, getting the Album art together. This is always a fun job of getting the right image. I’ve been using Album Art Downloader for this for a while, as you can set plenty of options to remove most of the effort. But, it doesn’t embed the images into the files. Which as an iDevice user I want so I can have the pictures transfer across when I sync. This got me thinking. I’ve got a windows file system with a nice hierarchical folder structure containing files, and I want to perform an action on each of the files in that structure.

Now if only there was some sort of Windows scripting language that was good at this sort of thing……..

2014 Goals, SQL Server and Personal

Not resolutions, oh no! A resolution can be broken by one relapse, goals are something I can keep working on even if there’s a setback!

Just putting them here, as once they’re shared it’s very hard to ignore them.

SQL Server related ones:

1) Get more inventive with BI work, and get involved in some Big Data technologies

  • Want to get involved with some BI work that’s pushing the envelope a bit. Either Volume, Velocity or Variety wise. Also want to get involved in a few projects that are using newer technologies/ideas to extract information from data.

2) Automate even more of my workload

  • Mainly because I can, and because it will free up more time to pursue the other 9 goals in this post!

3) Get really down and dirty with SQL Server Clustering and AlwaysOn

  • I want to get to a really solid position with the various SQL Server HA and Replication technologies. I can build them, and debug them, but there’s always a suspicion that there’ll be something I don’t know. So lots of building test environments and finding inventive ways to break them! Also signed up for training from the master, Allan Hirt (b|t), being put on by Technitrain

4) Present some open access training courses.

  • I’ve run training in house courses and sessions for various companies, tutored a few people via email, and spoken at a number of SQL Server community events. Now I’m looking forward to offering some longer sessions to the general public. Discussions are underway about offering some day long SQL Server DBA PowerShell training in the Nottingham/East Midlands area, and possibly a day on Extended Events as well

5) Speak at more SQL community events, maybe overseas

  • I’ve really enjoyed the SQL Community events I’ve attended and spoken at during 2013. So I’m keen to speak at more in 2014. I’ve been sounded out about trying something new at SQL Saturday Exeter, which I’m really looking forward to (but not sure if I can completely announce it yet!) And there’s a number of User Groups I’ve not spoken at (think I’ve pretty much promised to make it up to SQL North East at some point), and some I’d love to go back to. Also very tempted to submit a session for a non UK event.

And because it’s not all about work, here’s some Personal ones:

1) Keep on at my OU Maths Degree

  • I’ve been working at getting a BSc in Mathematics for the last 4 years. So I’ll be continuing the studying this year, with a residential school to look forward to and also beginning on Level 3 modules, which should bring a change of pace

2) Once I find out about what I can do with my knee, target a 100km audax or a marathon

  • Following an altercation with a section of Nottingham’s tram tracks I’m currently not cycling or running due to knee damage. Once the doc’s given me the prognosis I’ll make a decision about what sporting target to go for this year. Either another 1000km+ plus Audax ride, or getting round to running a full marathon

3) Read more fiction and non-technical non-fiction

  • It’s not been a great year for non-technical or  non-degree reading, so I want to turn that around in 2014 and read a bit more for pure enjoyment. Will probably pick back up on my GoodReads list, and use that as a way to measure success

4) Pick my photography back up a bit

  • Apart from a couple of weddings in 2013 I didn’t do much with my camera kit. Partly because our current kitchen layout isn’t good for film processing, and partly due to just not having one with me a lot of the time. So, I’ve got a new work bag which will make it easier to carry a camera with me, and I’ll get the crack across the lens of my iPhone repaired so I can use that as well. Hopefully be updating my Flickr account a little more often.

5) Find and settle into a new home

  • We’re currently renting a house. This years big task is to find and buy a home. Plenty of planning has been done, now we just need to find somewhere and enjoy the legal niceties!!

What are your goals and hopes for 2014? Feel free to share them with us in the comments.

Handling striped SQL Server backupsets using PowerShell

PowerShellA quick question on twitter from William Durkin (b|t) reminded me that I hadn’t covered SQL Server multistriped backupsets during my 31 Days of SQL Server Backups and Restores with PowerShell series, so without further ado I’m going to correct that:

Finding used drive letters on a Microsoft Windows Cluster using PowerShell

PowerShell

Just a quicky this time.

I was called in to install a SQL Server instance on an already built and populated Windows Cluster. Unfortunately as the system had grown, noone had kept an accurate record of which drive letters had been used. So a quick drop into PowerShell and the fun of WMI (as there isn’t a native PowerShell way to get this, yet), and I had this little one liner

Get-WmiObject -Namespace root\MSCluster MSCluster_DiskPartition -ComputerName "Cluster.contoso.com" -Authentication PacketPrivacy `
    | Format-List Path, VolumeLabel

(In this case ComputerName is the cluster name)

And I had a nice list of all the Drives attached to the cluster with their Path and Volume Label. This also returns all the mountpoint mounted volumes as well, which may cloud things on a complex setup. These can be filtered out quite easily, and the list ordered to make it easier to spot the gaps like so:

Get-WmiObject -Namespace root\MSCluster MSCluster_DiskPartition -ComputerName "Cluster.contoso.com" -Authentication PacketPrivacy `
    | Format-List Path, VolumeLabel `
    | Where-Object {$_.Path -like "?:"} `
    | Sort-Object $_.Path
    | Format-List Path, VolumeLabel

While this is really handy, it’s still no real substitute for properly documenting your cluster while it’s being built. Please for your own sanity, and mine if  I ever get called out to it, document all your drives, saves relying on random PowerShell scripts you find lying around on the Internet!

Presentation and Demo scripts from PowerShell Backup and Restore sessions at SQLRelay 2013

relay-2013R2-logo

Here are the Presentation and the demo scripts I was using during my SQL Server Backups and Restores with PowerShell sessions at the Birmingham and Norwich SQLRelay events.

SQLRelay-2013R2-psbackups

Please make use of them. And if you have any queries (or find any problems) please get in touch via email or twitter.

Removing Old SQL Server backup files with PowerShell

PowerShellA common question that comes up during my PowerShell Restore presentation is on how to delete your old SQL Server backups after a certain period of time. This is especially important for those DBAs who are looking after SQL Express installs who don’t have the luxury of SQL Server Agent and Maintenance Wizards to configure it for them.

Learning to play with SQL Server

play-learn-cat
Ever wonder how some people always seem to know the answer in SQL Server? Or seem to come up with it with a minimum of digging around?

Well,  they’re not necessarily cleverer than you, it could just be that they’re better at playing with SQL Server than you are. Knowing how to quickly and simply build up a test scenario means whenever you want to try something out, or prove a hunch then you can be most of the way to proving something while others are still Googling and Binging away. Or if you’ve found something on the Internet, you can check it does actually do what it claims to. Because as Abraham Lincoln once said:

Blog Copy Editing, a SQL Server Community approach

copy-write-crop

I’m sure I’m not alone amongst SQL Server bloggers in starting to write a new post in a fit of great enthusiasm, but eventually getting bogged down in a mire due to dithering about whether:

  • The point on my post is clear enough?
  • Is the post structured properly?
  • Is my writing clear and understandable?
  • I am using too many colloquialisms?
  • Do my code examples make sense?
  • Are any attempts at humour actually funny?
  • And a whole host of other things I’ve probably not picked up on, because someone hasn’t told me….

Having helped various people over the year proofread documents (My wife’s MA dissertation in English Literature being a highlight) I realise how important it can be to have another pair of eyes look over your work.

That pair of eyes are even better when they can offer usable criticism. So when I proofread my wife’s dissertation I could spot obvious spulling mistkes, but the chances of me spotting a problem when discussing the actions of the  Ranting Poets of the early 80’s was nigh on impossible. And vice versa, whilst an expert on Poetry and English Literature, Charlotte isn’t likely to pick up on my making a mistake whilst discussing PowerShell backups.

So, assuming that there are other SQL Server bloggers out there in the same boat I was considering setting up a mutual help group? We’d offer to help proofread and copy edit each others future posts, offering advice, criticism (Constructive!) and a potential soundboard.

If you are interested, drop a comment below. Depending on the uptake we might need to think of a clever way of managing this, but hey, we’re nothing if not inventive!

 

Speaking at Birmingham and Norwich SQL Relay 2013R2 events

relay-2013R2-logo

I’m happy to announce that I’ll be speaking at 2 of the SQL Relay 2013R2 events happening in November.

If you’ve not been to a SQL Relay event before, these are FREE all day SQL Server training events featuring some of the top SQL Server experts from around the world (and me!). This edition is visiting 10 different locations around the UK over 2 weeks, so there’s bound to be one near you.

I’ll be speaking at Birmingham on 14th November and Norwich on 27th November, presenting on PowerShell for SQL Server backups and restores.

In Birmingham you’ll also get Denny Cherry speaking on Hekaton, the new in memory SQL Server objects coming in SQL Server 2014

And in Norwich, Klaus Aschenbrenner will be presenting. While he’s not announced his topic yet, Klaus is always a great presenter so it’ll be a good ‘un.

Some of the events are filling up fast, so register quickly to make sure of a place: Register for SQL Relay

Hope to see some of you there. Please come up and say Hi if you do.

Page 12 of 18

Powered by WordPress & Theme by Anders Norén