Monday, 16 August 2010

MR Trace: SQL Developer Add-In Gets Trace Files for You

Cary Millsap and the folks at Method R have devised a cute add-in to Oracle SQL Developer.  It's called Method R Trace (MR Trace or "Mister Trace" for short) and it does a very simple thing elegantly: when you run PL/SQL code, it automatically turns tracing on and off at the right times, fetches the trace file for you, and presents it in a list right there on the screen.


I read about it on Cary's blog.  Here's a short video demo with Cary at the keyboard:  


He's proud of it because it's the "smallest software tool we've ever designed," but it's usefulness seems way out of proportion to its size.  Just not having to bug the DBA to get your trace files seems worth it to me!


(I'm going to start a new policy here that I hope will catch on among all bloggers: anytime I talk about a product, I'm going to disclose whether or not I received anything of value for the mention.  I didn't, though I did win a Method R door prize at an Oracle User Group meeting once.)



Wednesday, 11 August 2010

Simple Oracle Practices

Sometimes, it's the simple things that get us into trouble -- or can save us big time.


Any experienced UNIX admin will tell you to always do an "ls" (list structure) command with your wildcards before you use them in a "rm"  (remove) command.  Similarly, you should test your WHERE criteria in a SELECT statement (perhaps with COUNT) before you use them with a DELETE.


Here are some more very simple practices to develop as a habit, and which will save you at some future time.


1.  After you set ORACLE_HOME manually, test it by changing your current directory to it.  In Unix/Linux, the command is "cd $ORACLE_HOME"; in Windows, it's "cd %ORACLE_HOME%".  If the cd command succeeds and you list the contents of the directory, you should see a standard ORACLE_HOME.  If the cd command fails, or doesn't have the usual subdirectories in it, you've mistyped the pathname and can fix it before relying on it in other commands.


2.  After you connect to the database using "/ AS SYSDBA", test it by the following query:


SELECT instance_name, status FROM v$instance;


You'd be surprised how many times you THINK you connected to one instance, but in reality, you've connected to a different one. This only takes a second, and can save you a LOT of grief.


3.  After a SHUTDOWN ABORT for any reason, immediately follow with STARTUP RESTRICT.  This lets the SMON process perform instance recovery, so that the database is consistent; but it doesn't allow non-privileged users into the database.  Then do a SHUTDOWN IMMEDIATE and continue with whatever corrective action you need.


Three simple things, which if made into a habit, can help prevent gunshot wounds in your feet.



Thursday, 5 August 2010

Apologies for my Blackberry

Well, not mine.  I don't have a Blackberry.  What I'm referring to is a trend I've begun to see in emails from my Blackberry-toting friends and associates at work: adding a signature line apologizing for the fact that the email was sent from their Blackberry.


Originally, the tag line "Sent by Blackberry" was probably RIM's strategy for viral adoption of the device: promoting that this email was sent by someone with a cool new technology gadget.


But lately, I'm seeing signature lines more like the following:  "Please excuse misspellings, sent by Blackberry."   Or "Sent by Blackberry, excuse typos and terse replies."


Am I crazy to think that if you have to apologize for a technology, you might have to rethink why and how you're using it in the first place?



  • Are you misspelling things because you're trying to text and drive? Pull off the road before replying so you can focus on your typing (and on keeping the rest of us alive).
  • Are you sending such a terse reply because it's hard to type on the tiny keyboard? Could your reply wait until you get back to the office, when you could send a more thorough reply? Just because you CAN respond immediately, does every incoming email require an immediate reply at the risk of offending the recipient?
  • Are you sending a short reply because you're in a meeting or with someone else? Is the person you're replying to that much more important than those sitting with you, that it's worth disrespecting those in the room?


Text is such an unforgiving medium, that people are forced to read between the lines when interpreting the messages they receive. Right or wrong, a very short reply is often seen as a sign that the sender is angry or upset.  Right or wrong, typos make the sender look like someone who doesn't care enough to correct them before sending, or worse, doesn't know how to spell in the first place.


Granted that the Blackberry is a very useful device, and judging by its nickname ("Crackberry") highly engaging to use. But if you have to apologize for it, maybe you're using it wrong.