Consolidating Life

Over the last year, I’ve been in consolidation mode at work with our SQL Server instances. The primary reason for the consolidation was driven by SQL Server 2008/2008R2 going out of support, but it was also a great exercise in reviewing all our SQL Server instances and asking the question “Does this instance need to live on its own?”. I was surprised by the number of instances that we could combine and databases that have lived on after an application was decommissioned. 


The great part about this project is it has bled into my personal life. Doing a review on life is a good way to trim the fat. I found junk around the house to send to Goodwill, extra credit cards that I didn’t need anymore and found a way to stick with my YNAB budget to reach some saving goals.
Take a walk through your house/apartment and see if you can find things that are collecting dust. Donate those items and give them a new life for someone else. Take stock in your finances and see if there are any advantages in consolidating your debt. As I learned from YNAB, give every dollar a job. Review your expenses and decide if everything is in check. Do you have software subscriptions that you don’t use anymore? Do you have multiple cloud storage providers and you could consolidate and make managing your data easier?


As the 1st quarter of 2019 comes to and end, now is a great time to consolidate things in your life and set yourself up for success with your goals in 2019.

Doug Purnell
@SQLNikon
sqlnikon@gmail.com
https://sqlnikon.com

T-SQL Tuesday #111 – Why do you do what you do?

This month’s #tsql2sday is being hosted by Any Leonard (b|t). He asks a simple question that gets at the heart of what motivates us, “Why do you do what you do?”.

For me, it is about helping and sharing with others. From the database administration point of view, I love helping others with solving business problems with data. I have a knack for data and enjoy understanding what the business issue is so that I can see how data can solve it. By getting involved in various projects, I get a better understanding of how the business operates and allows me to be proactive and start suggesting solutions.

Outside of the office, photography and cooking are my passions. I love sharing both of these with others. I used to have a small photography business but found the money got in the way of the joy of photography. Now I just use photography as a service project and share the results and it brings me a ton of joy. On the cooking side, watching someone enjoy a few ribs is the best feeling in the world. I’m starting to think about catering but worry about how the money will take away from the joy of cooking. I’m hoping I can get some help on that side so I can just concentrate on the grill.

Doug Purnell
@SQLNikon
sqlnikon@gmail.com
https://sqlnikon.com

Backup automation with MySQL

One of our vendor applications we host on-premises was moving from SQL Server to MySQL (don’t get me started). Our responsibility was to make sure the MySQL databases were being backed up on a daily basis. I didn’t know the first thing about supporting MySQL but was looking forward to learning a new RDBMS to see how things worked.

My first stop was Plural Sight, Pinal Dave had a few MySQL courses I wanted to review to start understanding what it takes to support MySQL. I watched the following courses:

  • MySQL Fundamentals
  • MySQL Backup and Recovery Fundamentals
  • MySQL Workbench Guided Tour

Pinal did a great job introducing me to MySQL and diving into all the areas I needed to understand how to support MySQL. Now that I had the basics, it was time to set up our MySQL backups. MySQL uses a command line tool to execute the backups, mysqldump.exe (insert joke here). MySQL backups are a bit different than SQL Server because the backup files are just text files with SQL statements to rebuild the database schema (DDL) and insert the data (DML).

I knew I could just create a simple Windows Tasks to run each night but I wanted something with some smarts. We have other RDBMS systems send us nightly emails with the status of the backup so we can review it during our morning checklist. My goals were to have the backup file have the date/time stamp within the filename, remove backups older than 30 days, and send an email with success/failure message. Time to hit the Google…

I found a great post with a sample Windows batch file that I started from. I forgot how powerful the Windows batch language was, you can do some pretty cool things (but PowerShell is much easier). I didn’t want to use ComMail from Microsoft, so I did another search for ways to send emails from Windows batch, and sure enough, PowerShell was the ticket. Looking back at this project, I should have started with PowerShell to build the backup script.

My next search was how to process return codes from the mysqldump.exe process. Now I had everything to build the process I needed. I took me a few hours of trial and error, but at the end of the day, we had a production-ready process. We have been running the scripts for a few weeks now and we have not had any issues. Remember, your backup is only as good as your restore.

Here is our batch file to manage the backups:

@echo off

c:
cd\
cd “Program Files\MySQL\bin”
 
For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set dt=%%c-%%a-%%b)
For /f “tokens=1-4 delims=:.” %%a in (‘echo %time%’) do (set tm=%%a_%%b_%%c_%%d)
 
set bkupfilename=%dt% %tm%.sql
set logdir=E:\MySQLBackups
 
For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set dt=%%c-%%a-%%b)
For /f “tokens=1-4 delims=:.” %%a in (‘echo %time%’) do (set tm=%%a:%%b:%%c:%%d)
set logtime=%dt% %tm%
 
echo Beginning MySQLDump Process > %logdir%\MySQLBackupLog.txt
echo Start Time = %logtime% >> %logdir%\MySQLBackupLog.txt
echo ————————— >> %logdir%\MySQLBackupLog.txt
echo Backing up to file: %bkupfilename% >> %logdir%\MySQLBackupLog.txt
 
mysqldump.exe –user=backup –password=backup –all-databases –single-transaction –flush-privileges >e:\mysqlbackups\”%bkupfilename%” 2>e:\mysqlbackups\DatabaseError.txt
 
if %errorlevel%==0 echo Backup success! >> %logdir%\MySQLBackupLog.txt
if %errorlevel%==0 del e:\mysqlbackups\DatabaseError.txt >> %logdir%\MySQLBackupLog.txt
if %errorlevel%==1 echo Backup warning, check DatabaseError.txt >> %logdir%\MySQLBackupLog.txt
if %errorlevel%==2 echo Backup error, check DatabaseError.txt >> %logdir%\MySQLBackupLog.txt
if %errorlevel%==3 echo Backup error, check DatabaseError.txt >> %logdir%\MySQLBackupLog.txt
if %errorlevel%==4 echo Backup error, check DatabaseError.txt >> %logdir%\MySQLBackupLog.txt
if %errorlevel%==5 echo Backup error, check DatabaseError.txt >> %logdir%\MySQLBackupLog.txt
if %errorlevel%==6 echo Backup error, check DatabaseError.txt >> %logdir%\MySQLBackupLog.txt
echo Errorlevel returned by mysqldump.exe %errorlevel% >> %logdir%\MySQLBackupLog.txt
 
For /f “tokens=2-4 delims=/ ” %%a in (‘date /t’) do (set dt=%%c-%%a-%%b)
For /f “tokens=1-4 delims=:.” %%a in (‘echo %time%’) do (set tm=%%a:%%b:%%c:%%d)
set logtime=%dt% %tm%
 
echo Done with MySQLDump >> %logdir%\MySQLBackupLog.txt
 
echo ————————— >> %logdir%\MySQLBackupLog.txt
echo MySQLDump Process Finished >> %logdir%\MySQLBackupLog.txt
echo End Time = %logtime% >> %logdir%\MySQLBackupLog.txt
echo ————————— >> %logdir%\MySQLBackupLog.txt
 
echo Deleting old backups >> %logdir%\MySQLBackupLog.txt
 
forfiles /p e:\mysqlbackups /s /m *.* /d -30 /c “cmd /c del @file : date >= 30days” >> %logdir%\MySQLBackupLog.txt
 
echo ————————— >> %logdir%\MySQLBackupLog.txt
dir %logdir%\*.* >> %logdir%\MySQLBackupLog.txt
echo Send email via PowerShell >> %logdir%\MySQLBackupLog.txt
 

powershell -executionpolicy Unrestricted -File “c:\software\SendEmail.ps1”

Here is our PowerShell file to send an email:

$smtp = “smtp.mysql.com
$from = “mysql@mysql.com
$attachment1=”e:\mysqlbackups\mysqlbackuplog.txt”
$attachment2=”e:\mysqlbackups\DatabaseError.txt”
 
if (Test-Path -path $attachment2)
{
    $subject = “MySQL Backup FAILED!!!!”
    $body = “MySQL Backup failed, see attached logs for errors
”    
    send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Body $body -BodyAsHtml -Attachments $attachment1, $attachment2
}
else
{
    $subject = “MySQL Backup Successful”
    $body = “MySQL Backup Succedded
    send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Body $body -BodyAsHtml -Attachments $attachment1

}

If you run into any MySQL DBA responsibilities, I hope this gives you a starting point for managing your backups.

Doug Purnell
@SQLNikon
sqlnikon@gmail.com
https://sqlnikon.com

A little SQL Curry goes a long way

We hired a Director of Information Security a while back. One of the things that excited me the most about this new position was the ability to exchange ideas around security under SQL Server. Our initial discussion was over lunch at a local Indian restaurant, Taaza Bistro (w|t), and I found it very beneficial. We talked about our best practices and from that we agreed that there wasn’t any immediate need for us to alter our course (that was good news).

From that initial conversation, we continue to get together at the same restaurant every other month or so to talk about new ideas, active and future projects, or changes in the industry. The nice part about these lunches is the ability to bounce around ideas from a pure security standpoint. I leave each lunch with a better take on how to architect more secure solutions with SQL Server.

Our latest project is using a proxy server for all of our SSIS SFTP transmissions to vendors. The advantage of using proxies is they can lower your risk footprint by not have egress connections directly from your secure network. This allows you to place the proxy box under the DMZ for outbound connections.

The one thing I wanted to relay from this experience is how these lunches can be helpful for other databases administrators. It may not be with your Security Director, but it could be with the service desk, SAN/Domain admins, or any other department in your organization that you don’t normally speak to daily basis. It’s a great way to bounce ideas and understand pain points from other co-workers.

Here’s to plenty more SQL Curry lunches!

Doug Purnell

Accountability Partner

The #tsql2sday topic in December 2017 was around goal setting. I wrote about my trouble with keeping some of the goals I set. There were some really good posts if you want to look through the roundup for some inspiration. The issue I have with goals is I’m an obliger, always helping others before myself. The best outcome of the blog post was having Glenda Gable (b|t) reach out to me about being an accountability partner.

This has been the best thing for my goals this year. We talk every few weeks about how our goals are going and accomplishments since the last time we talked. Knowing there is going to be someone to hold me accountable for my goals is the type of motivation I need.

Blogging was one of our shared goals for 2018. Glenda had the great idea of reaching out to MVPs in the SQL Server Community each quarter for guidance. For the 1st quarter, we enlisted Tim Michell (b|t). We scheduled a call to talk about how he approaches blogging and some of the goals we were working on. This had two benefits, because of his consistent blogging we wanted to get some tips and tricks and it also served as someone else to hold us accountable.

The 1st quarter of 2018 was a success. I reached my blogging goals and am working on making it a habit as I move on to other goals for the year. I’m excited about the 2nd quarter and keeping my momentum going strong.

Doug Purnell

Weekly Routines

The key part to keeping my Getting Things Done (GTD) methodology up to date is the weekly review. Having all your projects and tasks under a single trusted system has its advantages, but you need to make sure and view everything so nothing slips through the cracks. The weekly review is a time where you give your projects a tune-up. This is a more in-depth exercise than the daily routine. At a high level, you review each project and make sure they each have a next action to keep them moving forward.

Reviewing the projects is just a single step in the weekly review. As you work through your tasks during the day it is often best to get out of the weeds and review everything from a higher level. This is the key thing for me as I try to manage operations, projects, and my yearly goals. In 2017 I spend most of my time in the weeds and lost track of the key goals for the year. Here are the items I perform during my weekly review:

  • Collect loose papers and materials
  • Get inbox to zero
  • Empty your head
  • Review previous calendar
  • Review upcoming calendar
  • Review waiting for list
  • Review agenda list
  • Review quarterly/monthly goals
  • Review projects for next action
  • Review someday maybe lists
  • Update The ONE thing

Let’s review each one in more detail:

Collect loose papers and materials
This is the heart of GTD, getting everything under your trusted system. Look around your desk, home, and anywhere else that you might have papers lying around. Now is the time to get them put into your trusted system.

Get inbox to zero
Review all your ‘inboxes’ for items that need to be brought into your trusted system. Inboxes might include post-it notes on your desk, your email inbox(es), or the pile of bills that need to be paid at home. As you review your inboxes, if the item is going to take less than 2-minutes to complete, go ahead and complete it.

Empty your head
Has there been anything on your mind taking your attention away from your priority tasks, if so now is the time to get that item into your trusted system as a project or task? Quick note, my definition of a project is two or more tasks related to each other. I have a generic bucket/project for all one-off tasks that don’t belong under an official project.

Review previous calendar
This is the time to review your previous week and decide if there are any items that need to be followed up on. This is your chance to play catch-up on any tasks that didn’t make it to your trusted system.

Review upcoming calendar
Looking forward to the week ahead, are there any events (business or personal) that require some preparation? Add a project/task so it can be accounted for as a priority for the week.

Review waiting for list
Do you have any tasks that are waiting for someone else? By keeping track of items that you are waiting for someone else to complete, this allows you to address them during a meeting or a hallway conversation. You may be responsible for the project as a whole, so it is a good idea to keep tabs on delegated tasks so they don’t get lost.

Review agenda list
I like to keep up with agenda items that need be addressed in project and department meetings. I use this list to keep them organized so the next time we meet together I have agenda items ready so I don’t forget them. Make sure each all the items are still relevant or take the time to add a few more things stuck in your head.

Review quarterly/monthly goals
Before we dive into each project on your list, do you have any quarterly or monthly goals that need to be accounted for during the upcoming week? This was my major fault in 2017, I spend most of the year in the weeds (operations) and didn’t take time to look at my goals and plan time around them. I like to take the yearly goals and plan our quarter and month goals to keep the yearly goals on track.

Review projects for next action
This the heart of the weekly review. This is where you review all projects on your plate. Whether they are on hold or almost complete, you need to spend time reviewing each action and decide if you need to plan for time in the upcoming week or add the next action if the project is stalled.

Review someday maybe lists
We all have projects that we would love to work on but are not a priority at this point in time. This is a great place to store all those projects and each week, decide if this is a good time to start working on them.

Update The ONE thing
The ONE Thing is a book written by Gary Keller and Jay Papasan. The main point of the book can be summed up by this quote, “What’s the ONE Thing you can do such that by doing it everything else will be easier or unnecessary?”. This is a powerful statement. Think through all the projects you just reviewed and decide if there is one thing that would make things easier. Create a task for this ‘one thing’ and act on it during the week.

As you can see there are quite a few steps to perform for a weekly review. Having a trusted system helps you track all these items. Whether you follow GTD or not, this is a great way to stay on top of your projects and manage your time effectively. I generally plan around 1 hour to perform my weekly review. If I have the time, Friday afternoon is my preferred time to complete my weekly view. This allows me to make a plan for the weekend and know that on Monday morning I can hit the ground running.

 

Doug Purnell

Daily Routines

I’m a big fan of Getting Things Done (GTD) by David Allen (t|b). I follow the GTD principals both at work and personal life. The key part of making GTD successful are routines. In this post, I’m going to review my daily routine that keeps my GTD system running like a well-oiled machine.

For the daily routine, the morning fits my personality the best. I love getting up early and setting a goal for the day. You have to find the best time that works for you. Others like the evening to reflect on the day and set goals for the next, it is entirely up to you. Regardless of the time of day, the daily routine needs to hit on a few key areas: inbox zero, your calendar, and tasks for the day.

Inbox Zero
I’ve been a fan of this approach for over a year. I used to keep ‘to-do’ items in my email inbox that were usually just read emails that require some additional action. It got to be overwhelming and I found myself with hundreds of emails that required my time. By using Inbox Zero, I treat my email inbox as just another entry point into my trusted system (OmniFocus). I have multiple inboxes in my life, mail from home, drive by tasks at work, meetings, and blog posts or websites that I want to read. Once you realize that there are virtual inboxes everywhere in your life, you quickly understand that you need one system to organize them all.

Calendar
Each day your time is being demanded by multiple sources. 8am-5pm is usually your work commitments and after 5 pm is family/personal time. By reviewing your calendar ahead of the day you are able to better estimate what you can accomplish that day. If you have a big block of time available, that might be a perfect place to work on your big project or start working on one of your goals for month/quarter/year. Smaller blocks of time might be best for quick tasks or phone calls that need to be returned.

Tasks
Now that you have an understanding of what time you have available, you can decide which tasks you can work on for the day. Most people have hundreds of little tasks that need to be completed, but which ones are the key tasks that keep you moving in the direction of your goals? Those are the tasks that you want to prioritize first. By reviewing your tasks each day, you stay current on your most important tasks.

If you would like to know more about GTD, start with David’s book. He did a second revision a few years ago and this will give you the foundation of GTD and the advantages it gives you in your life. The key advantage of GTD for me is clearing my head of those ‘things’ that I can’t forget to do that will keep me up at night or cause me to go into firefighting mode when those ’things’ are due. GTD gives me the freedom to be creative with my brain instead of using it as a storage device that it wasn’t meant to be used for.

Doug Purnell
@SQLNikon
sqlnikon@gmail.com
https://sqlnikon.com

T-SQL Tuesday #97 – I am an Obliger

Goal Setting

This month’s T-SQL Tuesday (#tsql2sday) host is Malathi Mahadevan (b|t).
Goal setting has always been a difficult process for me. I always do a great job of researching/organizing my goals for the upcoming year but fall short in the execution phase. I tend to help others with their projects & tasks before mine; I have a hard time holding my self-accountable. For this reason, I decided to take advantage of a professional development program at work that allows us to talk with a career/life coach for a few sessions.

The timing of Malathi’s T-SQL Tuesday post was perfect. I had my coaching session scheduled and it’s review time at work so all these things coincided to make this a perfect time to understand why I have a hard time setting goals before I started building another list of for 2018.

During my coaching session with Barbara Demarest (http://www.barbarademarest.com) she mentioned a book by Gretchen Rubin (b|t) “The Four Tendencies”. Each of us can be grouped into four categories when it comes to completing goals; I’m an Obliger. You can take a 5-minute quiz and see which category you fall in. Go ahead, I’ll wait…

Any surprises? Now that you have an understanding of your tendencies (Upholder, Obliger, Questioner, & Rebel), will you change your strategy for setting/completing your goals for 2018? I know I’m going to. I need external accountability to complete my goals. Because of my tendencies, I now know that I just can’t build a list of goals and hope to complete them. For 2018 I’m working on finding others to help me be accountable. It may be my supervisor, friend, or relative. By having external accountability I’ll be more successful in completing my goals. How about you?

Doug Purnell

Work Stoppage Events (Meetings)

As the calendar reminder comes up with the dreaded 15 minute warning for another work stoppage event, it occurred to me how import it is to prepare for meetings to make them as productive as possible.  I like to use Evernote to document all meetings and projects.  Each morning I take a look at the scheduled meetings and start a new note for each of them by creating three sections:

  1. Items to Discuss
  2. Notes
  3. To Do

Based on the meeting, I go through my master to do list and create bullets under ‘Items to Discuss’ to update the status of each item.  I also comb through my inbox and add any issues that might be relevant to the meeting.  It is important to spend time updating this section of meeting preparation, this can ultimately serve as a personal agenda so you can get all you points across to the rest of the attendees.

During the meeting I use the ‘Notes’ section to record items that pertain to my responsibilities and if actionable, they are recorded under the ‘To Do’ section.  Once I have time to review my notes from the meeting, I’ll create new tasks in my master to do list from the ‘To Do’ section and give each item a priority based on the other tasks.  I like to follow Brian Tracy’s (b|t) approach to prioritizing tasks based on his book Eat That Frog.

Frogs taste like chicken!

This is a great book that talks to procrastination and how to prioritize your biggest tasks (frogs) first instead of the smaller and easier tasks.  By using his system, I’m able to knock out my big frogs and feel the weight being lifted off my shoulders.   Before using his system, I would go through the day completing lots of smaller tasks, feeling great, but always knowing that the ‘big frog’ was always going to be sitting on my desk staring at me.

On a weekly basis I sit down with my manager for a one on one status meeting to talk through my priorities.  I would suggest this for everyone to make sure your priorities line up with what is expected of you.  Before each status meeting I’ll prepare the same way as any other meeting by creating a meeting template with in Evernote.  For my one on one meetings, I like to review completed tasks for the week and set priorities for the upcoming week.  Going over completed tasks is a great way to start the meeting off.  It will give your manager an update of items you’ve accomplished for the week and set the tone for the upcoming week.  Starting off on a good note leads to much more productive meeting in my opinion.

While I’m not in meetings and keeping my instances of SQL Server running their best, I like to use Thomas A. Limoncelli’s (b|t) recommendations in his book Time Management for System Administrators.  This is a great book for those just getting started or the seasoned veterans looking for ways to maximize their day.  One of his points in the book is to how to handle interruptions.  Interruptions can be handled in three ways:

  1. Delegate It
  2. Record It
  3. Do it

Everyone dreads that simple question, “You got a minute?”, that rarely lasts under a minute.  You get two or more of these questions a day, and you can throw a wrench into any plans you had for completing your priority tasks.  When someone asks you for help, they just want to be acknowledged.  This is where Tom’s process helps, first you acknowledge the question, then determine where it lies with your other priorities.

Monkeys don’t make good co-workers

If you have the opportunity to delegate it, this is always your best option, get the monkey off your back! If it needs your attention and can wait, record it as a tasks, give the person asking the question an estimate to complete and go back to doing your higher priority items.  The last option, and the most damaging, is doing the task at that instance.  This is the best outcome for the person asking the question because they receive instant gratification, but requires you to break your concentration on your current task and shift your focus to something new.  Don’t forget to record this as a completed item in your master to do list.  These ‘little’ interruptions can push other tasks out, so make sure your manager is updated on interruptions during your one on one.

I hope these tips and two book recommendations help you prioritize your day and take control of interruptions!

The Wonderful World of Blogging!

Welcome to my blog.  My name is Doug Purnell and I live in Greensboro, NC.  I’ve been in the technology world for the last 20 years ever since graduating from Appalachian State University with a Computer Science degree.  I started in the Visual Basic 4.0 & SQL Server 6.5 world back in the early 90’s and have loved IT ever since.

My goal is to try to convey my experiences in the IT world from SQL Server, VMware, and the data center.  I’ll even try to throw in a few thoughts on Apple products, Nikon Photography and my weekend cookouts on the smoker.