Pavlovian and Operant Conditioning

In my last post, [[post-restore process]], I outlined a process my DBAs use to ensure a restored database is always setup properly (TRUSTWORTHY, ENABLE_BROKER, sync logins/passwords, etc).  The actual proc is ridiculously simple and there's nothing new there as far as TSQL goes.  The point is that the process is so patently obvious (to me), yet I see so many environments where things are not sync'd properly after a restore.  And this is at every client engagement.  So, why did I post something so obvious?  The hardest part of implementing a process change like this is the TRAINING.  Your DBAs have probably been following the same processes for years and are resistant to change. 

So how do you get behavior modification quickly and cheaply in Corporate America?  Use Pavlovian and Operant Conditioning.  I knew when I rolled out PostRestore at my company that our 30-year veteran DBAs would be resistant to a process change.  I've seen this behavior at many companies.  Just mention "agile" at a legacy software company and you'll hear the moans and groans, yet they'll be receptive to the underlying ideas if they are not presented as being "agile".  That is resistance to change.  When trying to affect change in the past I tried training sessions, being overly nice, hootin' and hollerin', documentation, wikis, blogs...nothing worked.  So when I rolled out PostRestore a number of years ago for my last company, I decided to try a new approach.  

Pavlovian vs Operant Conditioning?

You've likely heard of Pavlov's dogs.  Pavlov rang a bell and followed it with a treat.  Pretty soon if Pavlov just rang the bell the dogs began salivating in anticipation of the treat.  Operant conditioning is reinforcing good behavior, or punishing bad behavior, to affect change, likely also by providing or removing a treat.  BF Skinner is most associated with operant conditioning.  The main difference is pavlovian responses are more automatic, reflexive actions outside of the subjects control (salivation) and operant conditioning applies a reward or punishment ex post facto.  

How to Use Conditioning to Your Advantage

Grab a bag of candy.  It should be your favorite candy (might as well be something in this for you too).  It should be one type of candy, maybe even one brand.  A grab bag of miscellaneous Halloween candy may work, but not as quickly nor as well.  Your candy can be Smarties, Snickers, Skittles, pretzels, whatever.  But pick one.  We want our people to associate a behavior with this candy.  I used Snickers bite-sized candies (my favorite).  

When I most recently presented PostRestore (a number of years ago actually) I wanted to use Pavlovian and operant conditioning to get the DBAs to use this immediately.  There were too many non-prod envs that weren't properly setup, causing delays and hard-to-dissect bugs.  I passed around a Snickers to every participant every time I executed the proc during my demo.  Now, really, how hard is it to execute a stored proc after you restore a database?  It didn't take long before the subjects, er DBAs, were getting antsy.  They clearly felt I was wasting their time.  No matter, the goal is not training, rather behavior modification.  I then had a handful of the DBAs each try executing the proc for the group by coming up to my laptop and pressing F5 while I projected the image to the group and providing positive reinforcement...and I gave each subject a Snickers for being a good assistant.  As people were leaving I gave them another Snickers as I reminded them to, "remember to always run PostRestore."  By now I was getting strange looks from the DBAs...why so much candy?  

This is a bit Pavlovian and a bit operant.  But I was just getting started.  I knew that invariably I would still have to deal with support issues for a few weeks because Service Broker was disabled (which was the hardest to diagnose due to its asynchronous, non-GUI nature).  The cause was always, of course, PostRestore not being run.  This meant I still had some behavior to modify.  I would then walk over to the DBA and tell him he didn't earn his Snickers today.  The first few times I did this I got a blank stare, followed quickly by that unmistakable lightbulb going off over his head...indicating he just remembered he forgot to run PostRestore.  This was followed by perfuse apologies and guarantees that this would never happen again.  As I would leave I would toss a piece of candy at him.  This is obviously operant conditioning.  

So I had operant conditioning covered, but why not got a little Pavlovian too?  Right after my first training session I arrived at the office a bit early and place a bowl of Snickers right in the middle of the DBA bullpen.  No note attached.  My hope was the visual image of Snickers sitting in the middle of the room would subconsciously help at least one DBA to run PostRestore.  I would pop over every morning for a few weeks and top off the bowl.  

Within a month, using the Pavlovian and operant conditioning steps I mentioned above, I never had to troubleshoot a problem due to a disabled broker on a restored db.  NEVER.  

That's behavior modification.  It didn't require and hootin' and hollerin'.  It didn't require a line item on an annual review.  It didn't require nasty emails.  It only required a little effort on my part and a sawbuck's-worth of Snickers.  

You may find this story funny, you may find it degrading...but you will find that a little conditioning will affect behavior modification.  


Here's a few reasons I know conditioning works.  

  1. We recently got a new batch of interns in our department and they were sitting through Basic Training with the DBAs.  I happened to be in the room for another meeting that was boring me to tears.  I overheard one of the DBAs say, "and every time you restore a database to refresh an environment make sure you run PostRestore."  I then saw him subconsciously reach over to the candy bowl and grab a piece of candy.  I did a spittake with my iced coffee.  This occurred 3 years AFTER the initially training session.  
  2. I swear our DBAs have all gained weight.  
  3. One day I was passing through the DBA team room and I swiped a piece of candy from the bowl.  One of the smart alecky DBAs yelled after me, "Hey, if you're not gonna stay and help us restore these environments don't bother taking our candy!"  I just chuckled and kept walking


You may find this funny, you may find this degrading...but you will find this works.  I once saw one of our