Apologies to all those referenced in this story. No disrespect is meant. I got the idea for this while driving in to work this morning. Perhaps some thoughts are better left un-acted upon. This is not the nerdiest thing I have done, but it ranks pretty close to the top.
Jr. DBA was worried about the quest he just accepted. It sounded difficult, perhaps beyond his abilities. But the thought of the XP he’d get for completing it got the better of his fears. He wouldn’t be able to solo this one, but he could find others and form a party. Sharing the spoils was better than getting none.
He found his mentor, Sr. DBA, in her usual spot at the tavern, reading the bulletin board and dozens of posts from other adventurers. In the flickering firelight that threw shadows about the dark tavern, he could see his mentor was deeply engrossed. He approached and stood by her side until she spoke.
“You seem worried. What is it?”
Jr. DBA looked down. His mentor always made him nervous. He was scared of making a mistake. “I have accepted a quest that I need assistance with.”
Sr. DBA nodded. She was secretly pleased, both with her student’s eagerness to take on quests and his willingness to ask for help. “Very well. I will be glad to lend you my services. What is this quest?”
“King Paul and Queen Kimberly were travelling abroad to CorporateLand. The orcs there pleaded for their help in removing a log that was growing out of control and threatening to take over all the available space in their farms. But during their travels, something happened to the king and queen’s tools. Though they travel with many, some were lost, some got broken, and the rest just won’t work for some reason.”
Sr. DBA nodded. It sounded like an easy quest, but she knew Jr. DBA was wise to seek help. He didn’t have the skills yet to properly handle an out of control log. But it was a good time to learn. “Come. Let us start out at once!”
The two of them left the tavern and stepped into the busy cobblestone street that ran north and south through the town. They headed north, towards CorporateLand. It was a fair way away and they would need mounts to get there. The town’s stable was on the way and they stopped in.
“We require two mounts for a few days,” Sr. DBA said. “Preferably Harleys, if you have them.” She liked to travel in style.
“Aye,” the rugged stablemaster replied. “We do.” He looked Sr. DBA up and down with doubt apparent in his eyes. Females seldom rode Harleys. “Are you sure you can handle such creatures, though?”
Sr. DBA sighed quietly. She was tired of people doubting her skills because of her gender. “I can handle them. All you need to be concerned about is the quality of my gold. And I assure you it is good.”
She handed the stablemaster 2 gold pieces and he led them to a stable with a pair of the largest mounts Jr. DBA had ever seen. They were both a deep ebony and the sunlight seemed to be sucked into the inky blackness of their coats. Their huge hooves stamped the ground, making a deep rumble Jr. DBA felt in his bones. Their nostrils flared with each thunderous breath. They were magnificent.
Sr. DBA and Jr. DBA mounted the beasts and headed off to the north. After an hour’s ride, the town had faded far behind them and they were now in a thick forest. Tress towered over them and the sunlight filtering down was tinted green from the canopy overhead. A short while later, they came across an elf sitting on the side of the road.
“Greetings,” Jr. DBA said as they approached.
“Well met,” the elf replied. “What brings you two this way?”
“We are on a quest,” Sr. DBA replied. “We are off to help King Paul and Queen Kimberly vanquish a log that grows out of control.”
The elf seemed taken aback. “I know them well. I am surprised they need assistance with such a matter.”
Sr. DBA nodded. “Agreed. But their tools have been compromised and they cannot do their work.”
“I see,” the elf said, standing up. “My name is Ozar. I would like to join your quest.”
“We would welcome your skills,” Sr. DBA said politely. “Please join us.”
They set off again, with the elf easily keeping pace with the Harleys. Soon, they had reached CorporateLand. An orc guard took them to the king and queen, who were at a farm on the east side of the village. As they approached, they could see a huge, twisting tree lying horizontally in the field. The tree was crushing the crops, destroying everything in its path. Jr. DBA tried to see the source of the tree, but it was so big and so twisted, its beginning could not be ascertained. All that he could see was lengths and lengths of log, covering dozens of fields of both this farm and the neighboring farms in the distance.
“We are glad you are here,” King Paul said to the party.
Sr. DBA bowed slightly. “We are honored to help. My student here answered your quest.” She gestured to the elf. “We met Ozar along the way. He says he is an acquaintance of yours.”
“Indeed!” Queen Kimberly said. “Well met, Ozar.”
“Well met, Queen.” Ozar replied with a slight bow. “When I heard where these travelers were going, I had to come along so that I might see my friends once more.”
“It has been too long,” King Paul agreed. “Now,” he said, turning back to Sr. DBA. “Can you help us with this out of control log?” The king gestured to the tree, which had grown another 5 feet while they had been talking.
“Certainly,” Sr. DBA said. “I would like to give my student a chance to learn how to handle this.” She turned to Jr. DBA. “When you are ready…”
Jr. DBA was nervous. It was bad enough trying to perform tasks in front of your mentor. But to do so in front of your mentor, the king and queen, and an elf, was almost too much. His hands were sweating. Drawing on every ounce of courage he had, he took a breath and cast his spell.
“BACKUP LOG Corptree WITH TRUNCATE ONLY!”
The spell failed and the tree grew another five and a half feet.
Sr. DBA stepped closer to Jr. DBA. “It was a good thing that spell failed. Had it worked, you would have lost all the valuable wood stored in this log. There is a better way. Use this.” Sr. DBA handed him a sword.
Immediately, Jr. DBA knew what it was. It was his mentor’s Sword of Backup +2. Why had he forgotten about this? How many times had he seen his mentor draw this very tool? He vowed to remember it in the future. Now he raised the sword over his head and, with a mighty blow, struck the log. It immediately stopped growing.
“Well done,” Sr. DBA said, taking back her sword and putting it carefully in its sheath.
The queen nodded as well. “You have learned a valuable lesson today. And to remind you of that lesson in the future, I present you with this.” She withdrew a small triangular piece of cloth from a satchel she had tied around her waist. The number 3231 was written on it. “It is a trace flag,” she explained. “When you use it, TRUNCATE_ONLY will never do any harm.”
Honored, Jr. DBA accepted the flag.
Ozar, who had been watching the proceedings with a smile, spoke up. “Well done, my friend. And now, I must take my leave, for other duties call. Fare thee well.” And with those words, Ozar left the Quest and set off towards the Kingdom of SQLSkills.
As Sr. DBA and Jr. DBA watched the elf leave, Queen Kimberly spoke. “There is still another matter to take care of. Do you know what it is?” she asked Jr. DBA.
Jr. DBA thought. There was a log growing out of control. The growth had been stopped. What else should be done? He thought hard. Then it came to him. “The virtual logs must be reduced.”
Queen Kimberly smiled. “Proceed.”
Jr. DBA nodded and turned towards the log. This one he knew from his training with his mentor. Curiously, this spell used TRUNCATEONLY, a slight variant of the TRUNCATE_ONLY he tried originally. He was beginning to appreciate the nuances of SQL magic.
“DBCC SHRINKFILE(CorporateLog, TRUNCATEONLY)!”
“ALTER DATABASE Corporate MODIFY FILE (Name=CorporateLog, SIZE=40000KB)!”
The log that had wound through dozens on fields began to recede. As they watched, it got smaller and smaller, until at last, it was no longer visible.
Sr. DBA smiled. Her student had indeed learned well today. “Jr. DBA. In recognition of your work here today, I grant you 200 XP.”
Jr. DBA swelled with pride. 200 XP! That was enough to advance a level! That put him at the rank of MSDB! Soon, he’d be at rank MODEL!
An orc guard approached King Paul, whispered in his ear, and then left quickly. King Paul cleared his throat. “It appears the log has left some damage behind. I have gotten word of some corruption in nearby fields. Jr. DBA, would you like to handle this as well?”
Jr. DBA, still feeling euphoric from his recent level up, nodded. He cast another spell.
“DBCC CHECKDB (Corporate, REPAIR_ALLOW_DATA_LOSS)!”
“WHAT?!?!” King Paul yelled. “That’s your first choice?!”
The king grew furious and, the next thing Sr. DBA knew, the king had turned Jr. DBA into a sheep. She sighed. Her student still had so much to learn.
10 thoughts on “A SQL Quest”
Fabulous. You truly are very geeky and win this month’s award for person with most free time (apparently). You must come up and say hi at PASS or somesuch event.
I had a couple boring meetings today :-)
But I won’t show it to non db people. They already think I am a nerd.
Now I see why this was mentioned so much on twitter today. Quite glad I decided to click through and see what all the fuss was about. The only problem is my wife called me a giggle-box for laughing so much while reading it. Very well done!
Wow..Maybe I should try out this Twitter thing.. Thanks!
Btw – that’s a great looking sheep! :-)
I love this! Fantastic!