We interrupt my learning series on SQL Nexus to bring you my blog live from SQL Server 2012 Technology Days here at Microsoft Tampa with David Pless, Sr Premier Field Engineer.
If you are reading my blog regularly then you know all about my love for SQL Server learning, so obviously I had to attend this event. So far I have learned a few things to make this outing worth the drive for me. Oh who am I kidding, this is SQL Server training that in itself was worth the drive and a day out of the office.
Here are some things that I have learned today:
1. Server Core for 2012 is amazing and I am ready to deploy it when I return to the office!
2. PowerShell for 2012 will add functionality that makes it more attractive than the current GUI tools.
3. PowerShell is not the horrible tool that I thought it was….there is no reason for me not to use it more to be more efficient.
The day is not over yet so maybe there is still more awesomeness to come! Enjoy!
When I returned to work this morning after my excellent getaway I learned of a power outage on Friday afternoon that took down the desktops in the Systems Administration area. Oh great!
When I logged into my machine, the login screen was different and then all of my files were missing. Oh no, my profile is hosed. No wait, there are no files under a previous profile. Oh crap!
After getting thoroughly pissed off that my day would be filled with installing software and recreating my machine, a sinking reality set it. I have a bunch of project files on my desktop that have not been saved to my share drive. I know better, but sometimes we don’t always take heed to our own best advice. Today, I thought was a good day to correct that.
The practical joke was that my buddies switched out the hard drive so no files were lost. This time!
I found a PowerShell Script to Backup Files Using Windows PowerShell and set it to backup my desktop to share drive automagically using task scheduler. I’m still testing it to see if it is the script to do what I need it to do. I could write one myself, but I am a PowerShell newbie and why reinvent the wheel.
The script above did not work out too well as it did not copy over folders. I created a simple script with the following line:
Copy-Item c:\Users\ewatson\desktop s:\ -recurse
That did the trick!
So yesterday afternoon I received a management request to provide some statistics on our SQL Servers, probably to justify our positions for the next budget year. No problem, I thought, because I know how many total servers, how many clusters, how many physical boxes and how many are virtual. I also know which ones are production, acceptance, and development and I know how much RAM, how many processors and cores, how many drives and how big they all are. I also know how many licenses we own and which ones are Enterprise versus Standard, which ones are 2008R2 and which ones are 2005.
I also have a script (thanks to Pinal Dave) to tell me pretty much everything I need to know when I run it on each of my servers. However, that was not the information they requested. Wait for it, wait for it.
They wanted to know how many records or rows we maintained on how many tables. In all of my years working with SQL Server, Progress RDBMS, MS Access, and MySQL (in order of awesomeness), I do not think I have ever had anyone ask for that level of information. The quick stat that everyone wants to know is usually how many servers and how many terabytes. In our environment, they also want to know how many dot net applications are we supporting on those database servers.
Much to my dismay, my frantic google session showed many people who had a script that was essentially similar to Pinal’s script (although most were not nearly as fabulous). So I did what every DBA should do, I sent up a distress call to the #SQLHelp Twitter tag! Lo and behold who should come to my rescue, why SirSQL ((blog|twitter), who else would you expect? Although, I was not a damsel in distress so maybe that was a poor analogy, but hey it made me giggle, so why not?
Here is his solution, which is really quite elegant. I am thinking of automating it on one of my servers so that I can have this handy in case they ask for the information again. It is inevitable that they will ask for it again when you give it to them once, unless of course I spent hours writing the script myself. Thanks again, SirSQL!