Category: Blog

  • Test Database Compatability with dbatools

    I really like the dbatools project. This is a set 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 items that few DBAs think about often is compatibility. We tend to create databases with the default level, based on the instance. If we upgrade an instance, I’ve seen many people assume the level changes with the upgrade script (it does). However, if you restore a database, or attach one, the compatibility level might not match, and that could cause issues.

    The dbatools project has thought of this, and they have a great cmdlet that can help you build checks of all your databases. The Test-DbaDatabaseCompatibility cmdlet will return the databases and whether they match the server level. You can also get more details if you like. Here’s a quick view. I can run:

    Test-DbaDatabaseCompatibility -SqlServer .\SQL2016

    This gives me a lot of databases on this instance. In fact, they scroll off the results quickly.

    2017-09-14 10_50_03-Windows PowerShell ISE

    I don’t really worry about those databases that match. In fact, I expect that most databases do. My rule of DBA information is often that I want to only see those items that might cause me to take some action. Here, I only want those items that don’t match.

    I can easily use filtering to do this:

    2017-09-14 10_55_43-Windows PowerShell ISE

    Of course, I could simple wrap this in a function as well, add this in a pipeline that takes a list of instances, or more. For me, I’d want each instance to check itself with this cmdlet and record the results.  That way I could periodically review the list and decide if I can actually can change any of these.

    I could also put a query in my SQL Monitor monitoring system as a custom metric and have this tracked there, but I wouldn’t want alerts for this. It’s not critical enough to interrupt me too often.

  • Join me at VS Live – Anaheim

    We’re just a month away from Visual Studio Live in Anaheim where I’ll be speaking along with many others. Join me today, register with ANSPK14 and save $400. This gives you the 4-day, all access conference package for a reduced rate.

    California coding, with experts in DevOps, Cloud Computing, Databases, Visual Studio, Mobile, and more. This is a multi-technology conference, and you can learn about all those different technologies where you need to work.

    The Agenda is packed, and I’ll be covering security and testing for SQL Server, but I’m looking forward to checking out some Azure, VS and VSTS tricks, Lambdas and more.

    If you’re looking to learn some SQL Server and more this fall, think about joining me in California for a warm break. Register today and enjoy some fall learning in LA.

  • Experimenting with VSCode instead of the ISE

    I’ve been playing with PowerShell here and there, learning a few things. As I use the dbatools project, or

    I saw a tweet from Rob Sewell on using VS Code for PoSh, which I’ve tried, but it felt cumbersome and hard. I didn’t spend much time on it before dropping back to the ISE, which I was comfortable in.

    However, Rob’s tweet mentioned a post from Mike Robbins on configuring VSCode, so I decided to give it another try. It’s not that the ISE doesn’t work well, but I keep hearing people talking about VSCode, which has git support, and so I thought this might be worth trying.

    I won’t talk about anything in Mike’s post. You can try that out. I already at the PoSh extension, but it was upgraded since I first used it, and now pops the integrated console when I open a .ps1, which makes it like the ISE.

    2017-09-12 08_27_56-newdetachall.ps1 — Visual Studio Code

    I don’t remember that from before, and I certainly like that. I also skipped the VSCode-icons in place of VSCode Great Icons. I mean, I want to be great at this stuff.

    The one thing I did do was change the settings from Mike to set a new zoom level. Zero is a little low for my old eyes, and 2 (where I’ve been working) is too big here. I chose 1.

    vscode_ise

    Using VSCode

    The main thing you want to do with an editor is write code. So, I decided to write some simple code. I have a few things to do, but I decided to start with something simple. I wrote a few lines of PoSh. This isn’t terribly useful, but I wanted to play with the editor and the debugger.

    2017-09-12 08_56_19-newdetachall.ps1 — Visual Studio Code

    Now, in the ISE, I do get some intellisense and parameters. The parameters look better, but the screen capture ghosted them out a bit.

    2017-09-12 08_57_07-Windows PowerShell ISE

    In VSCode, this actually looks better. First, I enter a cmdlet name and see some basics.

    2017-09-12 08_58_08-● newdetachall.ps1 — Visual Studio Code

    After I’ve entered it, I see more details as I work with it.

    2017-09-12 08_58_13-● newdetachall.ps1 — Visual Studio Code

    Running code works OK. I can hit F5 and the code runs. Not ideal, as the function keys make my hands move off the keyboard. That isn’t different from the ISE. I definitely wish we had shortcuts, and I know there are extensions to help with this. I need to play with some.

    The debugging, however, is much easier. More in line with VS and other debuggers. Set a breakpoint, F5, and I have real debugger controls if I want them (as well as F10, F11).

    2017-09-12 09_03_32-newdetachall.ps1 — Visual Studio Code

    I can see variables in the debug window, or in the main window if I hover. This feels a bit cleaner than the ISE.

    2017-09-12 09_05_24-newdetachall.ps1 — Visual Studio Code

    There still are some issues. F10 seems to disappear sometime. I’ve tried to remove breakpoints and they don’t always remove. However, those are pretty minor items in the scheme of things.

    Overall, I’ve changed a bit of my view of VS Code here. It does seem to have improved since the last time I tried PoSh in here. Maybe I’ll give it another chance with other languages as well.

  • I want a new gadget with less features

    Years ago I bought a Pebble smartwatch. I didn’t back the Kickstarter, but a few friends did and I liked the product. I wore mine for almost two years before it started to die. I can be rough on gadgets, so it’s possible I banged it and caused my own damage. I tried a Fitbit (original) briefly, but really liked having time on my wrist.

    I got a Pebble 2, which I really like, but I’m losing it. I got my son a Pebble 2 as well, but recently he fell and cracked the screen on his. He’s in college, but since I’ve had the use of his motorcycle, I decided to give him mine.

    That means I need a new watch. Since the Pebble watches aren’t being updated and maintained anymore (no thanks to Fitbit), I wasn’t sure I wanted to get another one. I could, as they are still for sale at various places. I decided to look at other devices, perhaps some that might have better data options.

    I put a few queries out to friends, but I’m not quite sure that I have a better choice. As I think about it, there are only a few things that I really use.

    • Clock/time – Especially important as I end up speaking in different time zones
    • Vibrating alarm – This is my alarm clock and allows me to wake up easily, without disturbing my wife.
    • Waterproof – I do not want to take this off for a shower or when I swim. So, most Fitbits are out.
    • Steps – I like step tracking. It’s a nice metric that I like to watch periodically.
    • Heart rate – I don’t check this too often, but it’s a good metric that I do want to watch as I get older.

    Some devices have these features (and many more), but many are also in the $200 range, which seems like a lot to me. Especially in this age of powerful, commodity hardware. The Pebble 2 did these things well, in a simple way.

    I’m looking at reviews and comparing items based on recommendations, but more and more, it seems like another Pebble 2 might be the best choice. Maybe I should just buy 2, in anticipation of the future.