Thursday, December 2, 2010

Corrupt Database Adventures

Ever notice how a “quick question” can turn into a major project? A coworker IM’d me earlier today with a “quick question” asking whether I knew how to get a database out of Emergency Mode.

Uh oh…

She then reassured me that it was a DEV box and not production. Whew! That meant that we didn’t have to worry about losing important customer data and at worst we could restore from back up without too much pain. I decided to investigate since it’s not often that one gets to fiddle with a genuinely corrupt database that’s not critical to the bottom line.

I did a quick web search and found an article by Paul Randal that talked about the last resorts that people try first with a corrupted database. It mentioned that one thing people try is rebuilding the transaction log  using  DBCC REBUILD_LOG. I tried it, but it’s not a valid DBCC command for SQL 2005 (in fact, if I’d read a few more paragraphs in Paul’s article BEFORE trying it, I would’ve seen him mention that very fact – that should teach me the folly of skimming articles).

The next item mentioned was to perform a DBCC CHECKDB using the REPAIR_ALLOW_DATA_LOSS setting. What better time to try this than when you have a broken dev box to play with? Take a deep breath and see what happens.

DBCC CHECKDB (testdb, repair_allow_data_loss) WITH NO_INFOMSGS;

The results said:

Msg 605, Level 12, State 3, Line 1

Attempt to fetch logical page (1:2576) in database 5 failed. It belongs to allocation unit 72057594060406784 not to 281474980642816.

Msg 8921, Level 16, State 1, Line 1

Check terminated. A failure was detected while collecting facts. Possibly tempdb out of space or a system table is inconsistent. Check previous errors.

That didn’t sound promising.I tweeted #sqlhelp quoting the text of the Msg 605 to see if anyone else had any suggestions. Meanwhile, I searched for other possible tricks to try.

One posting I found on a SQL newsgroup (forgot which one and can’t find it again) stated that Msg 605 indicates a physical drive failure. I didn’t verify that, but since the dev box had been troublesome for quite some time, it didn’t sound too inaccurate.

Meanwhile, I got some suggestions from #sqlhelp to try DBCC DBREINDEX and DBCC CHECKTABLE on all the indexes and tables. I snagged a script from SQLServerCentral that loops through every table and performs a DBCC DBREINDEX on all indexes. Lots of black text scrolled through in the results pane, interspersed with some shocks of red. The red means something was wrong – but at least the black text following the red text indicated that things were repaired.

I then ran the DBCC CHECKTABLE using the same script as above to loop through all tables. It crunched through the tables happily for about 75% of the database, then it stopped with an error:

Msg 211, Level 23, State 51, Line 13

Possible schema corruption. Run DBCC CHECKCATALOG

Sweeeeeeeeeeeeeeeeeeeeet. An “Improvement”? No. I ran DBCC CHECKCATALOG as suggested. It completed successfully. THAT seemed promising. I tried rerunning

DBCC CHECKDB (testdb, repair_allow_data_loss) WITH NO_INFOMSGS;

Same results. One more time with gusto – this time I noticed that I’d lost the SQL connection. Reconnect, retry, and it disconnected before completing the command. The server had degraded sufficiently that there certainly was no hope of resuscitating it, so I logged off. A short while later, I received a message stating that they’d located the backup image of the dev box and were ready to rebuild it.

Although I spent several hours working on this, it was a great learning experience for me – most importantly, I learned that if DBCC CHECKDB can’t repair it, then likely you’re best off restoring the database from backup.

Before you find yourself in a situation with a corrupt database, take a look at Paul Randal’s “CHECKDB from Every Angle: Emergency Mode Repair”, which is an update to his article mentioned above. I wish I’d found that one first, but one uses the tools that the search engines return. Actually, the better choice would be to simply read through Paul Randal’s “Corruption” Category in his blog – this is the ever-growing set of articles that he’s written about database corruption. I’m going to spend a lot of time reading through those posts, and you should, too. It’ll certainly make you life easier when someone asks you a “quick question” on how do you fix a database in Emergency mode. 

Friday, November 19, 2010

Un-SQL Friday 001: Branding - What's Your Brand?

In answer to MidnightDBA's  challenge for Un-SQL Friday 001, I humbly submit this simple post.

For some of us, Brand is all-important. In the case of corporations, Brand is vital becuase it implies a certain amount of trust and loyalty. Companies work very hard to protect their brands from genericization - how many of us call facial tissues "Kleenex" despite the fact that there are many other manufacturers of little folded rectangles that function as disposable hankies? We also see a vast amount of brand-loyalty - "I only wear <brand-x>* jeans because they are the only ones that fit right" (I happen to disagree - <brand-y>* fits MY figure better).

Certain individuals are also fighting to establish or maintain their "Brand". I'll point you to Brent Ozar, who frequently talks about how he is striving to make and maintain his "brand". I suppose part of that is why people like me keep coming back to his blog. Well, that and the various articles like "Plagarism Week: Finding the Slimy Slimeballs" where his discusses his latest experience with having his content plagarized (for additional fun, browse through his archive of plagarism articles. There will be a quiz later).

Other bloggers I frequently read - they're listed in the sidebar on the right - all have their own "brands" in that each is a blog I turn to for a specific reason be it entertainment, or excellent information on SQL server specifics.

So what is my "Brand"? I'm not sure. I know I'm working on building it. I feel a little like General Mills which has brands for various products. I have a brand for the me who is a costumer that attends various Science Fiction and Anime conventions; for the me who is a family memeber; and another for the me who works as a database professional. Each "me" has her own specialties and few are mixed together.

I first really noticed my "Brand" (for the Costumer) at a Anime & Gaming mini-convention just before Halloween. I'd neglected to bring a costume, having completely forgotten that there was going to be a costume competition. I did, however, bring a bag full of fabric because I was planning to spend the day cutting out some shirts and pants that I'd recently drafted the patterns for. While I was finishing up gluing together the patterns, I noticed they were having a costume competition, and about 10 contestants were left (they'd had about 40 and were moving through the line one at a time). I dumped out the rolls of fabric I brought, pondered a moment, then draped myself a quick Greek-style toga-ish costume. Arming myself with scissors, a spare piece of fabric and my tape measure, I hopped to the back of the line, which by that time had gotten down to 5 contestants (yup, 5 minute assembly there). When it came my turn, I presented myself as "Glitzlandia, Goddess of Costuming". I walked up to one of the judges and attempted to drape the fabric around her amidst laughter and giggling from the audience.

After all that silliness, I was awarded the "Best Use of Materials" prize.

As I picked up my prize, one of the judges commented that although the costume was very creative and looked very nice, it wasn't up to my "usual" standards. I laughed and informed him that not only did I spend merely 5 minutes assembling it, but I hadn't even looked at myself in the mirror and had no idea what it looked like.

So, my "Brand" at Science Fiction Conventions / Anime Conventions is "Costumer who makes really great costumes" (or something like that). Yey. I can live with that one.

I'm still working on building my "Brand" in the SQL server commmunity. I'm not really known yet as the one who knows <cool SQL thing that no one else is expert at>, but someday I will be know that way. Right now, I think the SQL Server Community thinks of me as that DBA who can sew. Maybe that's enough for now, but it certainly isn't helping my salary any.

In case you were wondering, my goats are not branded; yet everyone who lives near me know who they are and who they belong to. Of course, it helps that there aren't all that many goats in my neighborhood besides mine.
 
*brand names removed just becase this is an illustration and not an actual statement.

Tuesday, November 16, 2010

Reflections on SQL PASS Summit 2010

Attending Orycon immediately following SQL PASS Summit was not exactly the best thing for me to do especially since I managed to lose my voice part way though SQL PASS and still haven’t managed to fully recover from the damage despite taking both Monday and today as vacation days from work.
SQL PASS Summit was very educational, and I wish I had the time to personally document all that I learned. However, thanks to my bout with illness, I do not have the time to write all that I should. Fortunately for the rest of us, many SQL PASS Summit attendees already blogged about the highlights and they write much more coherently than I do.
Here is a brief list of the live blogging of SQL PASS Summit events, classes, keynotes and suchlike (in the order I stumbled upon them, rather than in any order of priority or importance)
Various neat things were announced at SQL PASS Summit, including
  • New path to obtaining the Microsoft Certified Master (MCM) certification for SQL Server 2008.
    • Brent Ozar wrote a summary of the changes for those who want a quick bulleted list of the changes rather than the full program description.
    •  Paul Randal and Glen Berry also blogged on the MCM announcement.
    • Many posted the all-important link to the MCM readiness videos, which is required viewing for all MCM candidates.
  • SQL Server Denali Community Technology Preview was released, and all attendees received a CD containing SQL Server Denali CTP1. Brent Ozar was one of the first to post a blog about Denali and its high availability features.
  • SQL Server Tools code named “Juneau” – SSMS BI functionality now available in BIDs.
  • SQL Server 2008 R2 Parallel Data Warehouse
  • Microsoft “Atlanta” (online service providing proactive alerts for SQL server 2008+). Official site here. Brent Ozar expresses his concerns about Atlanta in a blog he posted within minutes of Atlanta being announced (fast blogger!).
  • Project Crescent – web-based reporting tool
Random photos from SQL PASS Summit 2010. Generally speaking, the photos were taken outside the hours of the classes at social events because we ALL were actually paying attention to the speakers rather than snapping photos. The following are photo albums posted by various attendees.
Wednesday was SQLKilt day. Many of the male attendees showed up wearing kilts in support of the PASS WIT (Women In Technology):
Stuff from other evening happenings
SQL Karaoke:
I got to sit next to Brent Ozar in a panel at SQL Pass. He snapped my picture as I was trying to peek into his birthday gift bag:
LadyRuna(hyperlink to original of photo)  He tagged it “Celebrity  Sighting at #sqlpass and tweeted my photo to everyone. I guess I’m a Celebrity now. Wowza.

Thursday, November 4, 2010

Girls Need Good Mentors

Although frequently in elementary schools, girls are ahead of the boys in math, Why is it that by the time they go to junior high school or high school so many girls shy away from or even declare they hate math? I suspect that to some degree what pushes them away from mathematics is what I'd call "bad role models". That is, they meet various older women who are anxious about math and they copy the behavior of those women.

Who are these role models? Females in their family and teachers. Most elementary school teachers are female - in fact, in the elementary school I attended, the only male teacher there was the gym teacher (this may have changed over the years.). Just for fun, I googled something similar to "Gender profile of teachers" and got back a number of interesting articles. One from Florida was a 2003 report showing approx 90% female elementary and approx 60% female secondary teachers. Boston.com talked about Massachusetts schools becoming desperate to recruit male teachers to provide role models for boys since so few men teach these days.

I also found a report that backed up my theory about female teachers passing math anxieties on to their female students. The report also stated that for some reason the boys were not influenced by the math-phobic teachers)

How did my interest in math and science survive the bad influence of the math-phobic teachers / role models? I was fortunate that both my parents were math / science teachers and they continuously reinforced not only the value of knowing math and science but also the fun (can you say "home chemistry experiments"?) of it all.

What can we do for those who don't have good math/science female role models in their lives? What else can we do to help influence the young girls to encourage them to pursue technical professions? Where are the highly technical females hiding?

One good place to not only find strong female role models but also something that appeals to youngsters is in Japanese Anime. Unlike American cartoons - where the smart and competent characters are portrayed using negative stereotypes -- thick glasses, ugly, terrible in sports -- Anime heroines are beautiful and amazingly competent in everything from sports to music to academics. Best of all, they are astoundingly competent with computers.

Here's a brief list of anime with strong female leads (character name when I can think of it in parens) :
  • Serial Experimanets Lain (Lain)
  • Suzumiya Haruhi no Yuuustu (Nagato Yuki)
  • Rideback
  • Mission E (*not* the 1st series, 'Code E,' but the second series called "Mission E")
  • Black Lagoon (Revy)
  • Ghost in the Shell (Kusanagi Motoko)
  • Pumpkin Scissors (Alice)
(I’ll add more as I think of them. )
I’d also recommend David Weber’s Honor Harrington series as something for young ladies to read in their spare time.

Friday, October 22, 2010

Alice Costume (from “Alice: Madness Returns” Game)

I just completed sewing the Alice costume I need for various events:

  • I’m Alice in Orycon’s Opening Ceremonies skit “Alice in Oryconland”
  • I’m Alice at the Greater Portland Area Costumer’s Guild Orycon Party where the theme is “Alice in Slumberland”
  • Halloween

I chose to do the Alice from the “Alice: Madness Returns” game because I had sufficient leftover fabric in appropriate colors to make it. (we will NOT discuss the size of my stash. The fabric reproduces on its own – REALLY).

Front and Back Pictures. I digitized and embroidered the symbols on the apron. The skull was a $1.19 decoration I found at a grocery store.

018 019

Tuesday, October 5, 2010

Win2K Book Purse

Given that I have advertised myself as both a SQL Server person and a seamstress, I think it’s about time that I show the project I most recently completed.
 SAM_0208This purse was made using scrap upholstery fabrics and the cover of “Inside Microsoft Windows 2000, Third Edition,” which has served its purpose and is now destined to live its second life as a purse.
The idea of making a purse from a book is not my original idea – I met a lady at an American Sewing Guild (ASG) meeting who had one. The instructions for making your own book purse can quickly be found using a simple web search, so I won’t bother looking up the link.
The main changes I made to the “standard” version of theSAM_0203 purse are:
  • I didn’t measure anything with a ruler – I simply wrapped the fabric around the book pages and pinned it to fit, then sewed it together
  • The clasp is one of those turn-buckle clasps that you attach by putting a hole through the book cover where you want it to be.
  • The strap leading to the clasp and the outer side gussets were made from leftover raincoat fabric.
  • I glued it together using Aleene’s Tacky Glue (craft glue), stuffed the soon to be discarded pages inside, placed it on the floor and covered it with a large tote bag full of books (I think the full tote bag weighs about 40 pounds) while waiting for the glue to dry.
SAM_0201
I plan to bring this to SQL PASS Summit. It may become a door prize for one of the WIT presentations if they decide that it’s “worthy”.
* Note: I will leave the CD from the book inside the purse as a “bonus gift”. 

Monday, October 4, 2010

SQL Pass Chalk Talk

In Mid-November, I’ll be debuting at my first professional presentation at the SQL PASS Summit in Seattle, WA. During the last SQL PASS  Women In Technology (WIT) Virtual Chapter meeting (we meet monthly via telephone), Meredith Ryan-Smith asked for volunteers to be panelists with her at the Chalk Talk she would be leading. I volunteered hoping that I would have some useful tidbits to contribute to the 40-minute session entitled "Energizing the Next Generation: Encouraging and Inspiring Young Women to Choose Tech Careers,”  which is scheduled for Noon on Tuesday 9 November.

If you look at the statistics from recent years, fewer women are choosing technical careers than ever before. We’re hoping that through this Chalk Talk, we can steer more women toward choosing technical careers.

As the date of the SQL PASS Summit approaches, I’ll be posting some of my thoughts on this topic, so stay tuned!

Lady Runa dressed as Ada Lovelace

Lady Runa dressed as Ada Lovelace, a lovely lady who was also one of the first computer programmers.

How to Turn Off Smart Charging

After a recent update, I discovered that my battery was down to 80% while plugged in, which I hadn't expected to see. I also noticed tha...