tag:blogger.com,1999:blog-118393652009-07-08T15:09:56.304-04:00The Tom Kyte BlogThomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.comBlogger584125tag:blogger.com,1999:blog-11839365.post-39741265469390564472009-05-28T08:40:00.001-04:002009-05-28T10:58:53.348-04:00Collaborate09 thoughts...<p>I've been meaning to write up my thoughts from this years IOUG Collaborate event.  Ian Abramson, the president of the IOUG, has a nice series of write ups on the event itself - starting with <a href="http://blogs.ioug.org/?p=105">day 1</a> through day 3 and then a wrap-up post.  He describes it as a three day event - but to me it is more of a four day thing.  For the last couple of years, I've done a university day at Collaborate - so once again I spent all day Sunday May 3rd in a conference center talking about Oracle for eight hours.  This year I talked about Encryption, all of the Flashback technologies, Read & Write Consistency (a really nice way to introduce the flashback stuff actually, sort of a pre-requisite) and Database Reorganizations (when to, when not to and when you have to - how to).</p> <p>I also had a one hour "regular" session on Monday where I presented on "What's new in Oracle Application Development" where I touched on general database enhancements, ODP.Net, PHP/Ruby/Python, Java/JDBC, SQL Developer and APEX advances.  This is the session where I got most of the questions/comments this year.</p> <p>I think I might have scared away some of the DBA crowd with my session title, they see "Application Development" and stay away - but I know for sure at least one DBA was in the audience.  He came up to me afterwards and commented on how glad he was to have attended - for a pretty simple reason.  In each of the tools I discussed (mostly .NET, SQL Developer and APEX) - I pointed out how they easily tied the application into AWR (automatic workload repository) and ASH (active session history) facilities and how they could be used as an interface to the tuning/diagnostic packs.  He is sure the developers he supports are unaware of this tie in and he himself certainly was - but his first course of action upon getting back to the office would be to expose them to it.  The problem he has had in the past is that many people consider tuning "a DBA task" - when in fact - it is really a developer's thing to do.  Since most developers don't have access to, or don't want access to Enterprise Manager - they assumed the advanced tuning features were not available to them.  Not any more - all of the development tools now have tie in's to AWR/ASH and various features of the tuning/diagnostic packs.</p> <p>One of the areas of large interest is the new (in beta) SQL Developer <a href="http://www.oracle.com/technology/products/database/sql_developer/files/Modeling.html">data modeling features</a>.  A lot of people (self included) still find the good old ERD (entity relationship diagram) a good way to envision/model your schema.  SQL Developer now has an engine to do just that - with the ability to spit out various different physical models from the same logical model - either in support of different databases (yes, it does not just do Oracle), or in support of different environments (simple storage characteristic changes).</p> <p> </p> One thing I find interesting/good about an event like Collaborate is the ability to learn something new.  Even after using Oracle for going on 22 years, I still learn something new often (almost every day).  Regardless of your skill level, there is the opportunity to expand your knowledge of the stuff you use.  For example - Jonathan Lewis (a pretty smart guy when it comes to Oracle knowledge) posted about some things he discovered for the <a href="http://jonathanlewis.wordpress.com/2009/05/08/ioug-day-4/">first time</a>.  I strongly encourage everyone to attend at least one event if possible every year - to network, to learn and..... to present.  IOUG Collaborate is a good venue for doing that - UKOUG is another - and the call for papers for the UKOUG event in November is <a href="http://jonathanlewis.wordpress.com/2009/05/27/call-for-papers/">currently happening</a>....  Take a chance - go for it.  It'll probably go much better than my <a href="http://tkyte.blogspot.com/2005/04/progression_29.html">first presentation</a> :) <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-3974126546939056447?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com22tag:blogger.com,1999:blog-11839365.post-28731393379020853592009-05-13T21:16:00.001-04:002009-05-14T06:31:05.183-04:00An interview question...<p>A couple of days ago I read an article "<a href="http://asserttrue.blogspot.com/2009/05/one-of-toughest-job-interview-questions.html">One of the toughest job-interview questions ever</a>".  I was reminded of it by <a href="http://github.com/raganwald/homoiconic/blob/master/2009-05-13/tough_crowd.md#readme">this posting</a>... </p> <p>I found the original post interesting - mostly because I liked the answer the technical writer gave.  A bit of background - someone interviewing for a technical writing position is asked what is clearly a "hard core, heads down, write code programmer question".  The question seemed entirely inappropriate for the position - but - the answer given was great (I thought)</p> <p>The answer consisted of lots of questions - in effect - a lot of push back.  Define this, specify that, clarify this - need more information.</p> <p>I can relate.  </p> <p>What surprised me was that a lot of the feedback was negative.  A lot of people said "would never hire you", "you missed the point".</p> <p>All of the time I was reading though, I was nodding my head saying "yeah, what about that".  I would have hired him on the spot.  Critical thinking, push back, give me the details, tell me what you are really trying to do.  </p> <p>The programmer that rolls over and just answers the question - without enough information to actually answer the question - should send the interviewer running away.  But that is apparently what a lot of interviewers are looking for.</p> <p>I've been known to have <a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:495221712170#3391464934880">three to four very simple interview questions for "Oracle people"</a>.  They are designed to test the simple to the sublime.  They are:</p> <p><em>I have a table: </em></p> <p><em>create table t ( .....,  month number, ..... ); </em></p> <p><em>Month is always a number between 1 and 12. </em></p> <p><em>I ask three questions about this table: </em></p> <p><em>1) how many rows are in the table </em></p> <p><em>2) how many rows BY MONTH are in the table (i want to  know how many rows for month one, month two <br />and so on) </em></p> <p><em>3) what MONTH has the most rows (and for a special bonus, tell me why this question is ambiguous)</em></p> <p><em>The fourth question is more of a "do something for me" - and that is "go to the white board, draw a picture of Oracle and tell me how it works".</em>  </p> <p>As the link says - a surprising number of people *struggle* (seriously) with the first question.  The second - gets *most* (seriously) of the rest.  The third question freaks them out mostly.  Especially the parenthetical part.  The fourth question - sends people running out of the room.</p> <p>That is why I liked the article I originally read - the author was poking around, developing derived requirements, fleshing it out, figuring out what really needed to be done, <strong>not rolling over and saying "you got it, I'll be right on it, we'll do that straight away"</strong>.  Developers (DBA's, whatever) that don't push back, that don't dig into the question, that don't try to convey "this is more complex than you think, we need to go a bit into this to figure out what you really need" - well, I don't have any patience for them.  They do not belong (in our profession).</p> <p>Will that person (the interview-e) annoy you?  Sure, from time to time (I'm sure that every now and then - someone is annoyed by me, <em>probably</em>).</p> <p>Will you ultimately be really happy they were there? <strong>Absolutely</strong>.</p> <p>Will the person that rolls over annoy you? Absolutely - every time - most of the time probably. Especially after they really mess you up the first time they are so "flexible".  Will you ultimately be even a little happy they were there?  I doubt it.</p> <p>I've said many times - there are only TWO answers to all technical questions.  They are:</p> <ol> <li>WHY (why do you want to do that) </li> <li>IT DEPENDS (it really does, and it requires <strong>digging around, poking, probing</strong> to figure out what it depends on...) </li> </ol> <p>poke, probe, ask, discuss, dive deep, play stupid (it works, really) - but get the information...</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-2873139337902085359?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com44tag:blogger.com,1999:blog-11839365.post-27892313147036519302009-04-01T19:54:00.001-04:002009-04-01T19:54:28.120-04:00A unique opportunity...<p>Learn SQL from one of the original SQL'ers.  Chris Date is doing some a <a href="http://method-r.com/education/courses/43-course/107-cj-date-course">seminar</a> in conjunction with Cary Millsap's company Method-R.  Unfortunately I cannot make it that week (I'd be there if I could) - but it is a rather unique and uncommon offering.  I've often said that if you want to be able to <a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1594885400346999596#1600003200346601869">"tune" SQL</a>, you need to understand what is happening underneath the covers, what is available.  You don't want a 10 step checklist, you want <em>knowledge.</em>  That is what this is all about.</p> <p><a href="http://carymillsap.blogspot.com/2009/03/last-call-for-c-j-date-course.html">This article</a> by Cary sums up the seminar as well as why it will be good (in his humble opinion)...  Give it a look see...</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-2789231314703651930?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com13tag:blogger.com,1999:blog-11839365.post-1476490829967160602009-03-13T10:30:00.001-04:002009-03-13T10:30:17.083-04:00Happy Birthday...<p>To both the <a href="http://www.itproportal.com/portal/news/article/2009/3/13/world-wide-web-20-years-old-today/">World Wide Web</a>, age 20 years this day and <a href="http://i.gizmodo.com/5169216/happy-15th-birthday-linux">Linux v1.0</a>, age 15 years this day. Two creations that have changed a lot of things. Sort of neat that they happened on the same day, albeit five years apart...</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-147649082996716060?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com10tag:blogger.com,1999:blog-11839365.post-29805125730656429242009-03-09T12:27:00.001-04:002009-03-09T12:27:11.037-04:00Very good advice...<p>I've been reading Seth Godin's <a href="http://sethgodin.typepad.com/">blog</a> for many years. He is a 'marketing' person, with a lot of good old fashioned common sense. I agree with most of what he writes - and he just did a longish post (for Seth Godin it was long). It was on <a href="http://sethgodin.typepad.com/seths_blog/2009/03/slack.html">Slack</a>.</p> <p>His two points in these unique times - if you find yourself unexpectedly with more free time than you had anticipated you should consider:</p> <p>a) Continuing your education, learn something new. As you go to interview and look around, people will ask you what you've been doing with your time. If you can arrive at an interview with "I've been learning X in my free time" and be really excited about it - be able to converse about it, that'll be a really positive thing.</p> <p>b) <a href="http://tkyte.blogspot.com/2005/05/success.html">Participate</a> - join the forums - become known. I've said that myself many times in the past.</p> <p> </p> <p>So think about that if you find you have more time on your hands than you anticipated having... Not bad ideas. Even if you don't have a sudden abundance of free time - maybe find the time to do these two things..</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-2980512573065642924?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com9tag:blogger.com,1999:blog-11839365.post-31993575676458235012009-02-09T20:26:00.001-05:002009-02-09T20:32:11.870-05:00Missing. The. Point....<p>I probably buy 80 to 90% of my non-grocery items online. Furniture, pictures, gifts, TV's, books, kitchen stuff - whatever I can - all online. I hate the "store" experience. Before I go into an actual physical store I usually know exactly what I want - buy it and leave. It took me about 5 minutes to buy shoes this weekend :)</p> <p>I buy online for the convenience - and the experience is fairly similar regardless where you shop. You typically have to create "that account" (even if you never intend to shop there again..) and you get that form to opt in or out of mailing. They almost always default to "opt in" and I invariably set it to "opt out"</p> <p>I just bought some shelves while sitting here in King of Prussia, PA (I live in VA, another benefit of shopping online, just do it when/where-ever you want)... I received two emails. Email 1 - my receipt (great). Email 2, well, it was in response to me opting out:</p> <blockquote> <p><em>While registering as a shopper with xxxxxx.com, you chose not to receive our promotional Email. <strong>This is being sent to confirm that yyyy@yahoo.com will not receive Email </strong>from xxxxxx.com. </em> <p><em>The decision to receive Email is personal and can be influenced for a variety of reasons. In an attempt to better understand and respond to our customers, we would appreciate it if you would answer a short survey on this topic.</em></p></blockquote> <p>That just strikes me as "missing the point" :) <p>Can you imagine what my survey comment field might have contained.... The survey did contain <blockquote> <p><em>We value your feedback and encourage you to give us candid answers. Are there any comments you would like to make to xxxx? (Note: Response is limited to 250 characters) </em></p></blockquote> <p>250 characters. I shall have to choose my words carefully... I should have it written in Kanji to see if they support multi-byte and truly support 250 characters. Or if it is really 250 bytes.</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-3199357567645823501?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com10tag:blogger.com,1999:blog-11839365.post-73346281468537386582009-02-05T21:59:00.001-05:002009-02-05T22:02:09.453-05:00A SQL Joke<p>I don't think I've seen one before.  An actual "joke" about SQL</p> <blockquote> <p><em>A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'</em></p> </blockquote> <p>It is about as funny as most of my jokes.  All the more funny to me since I just (as in a couple of minutes ago) <a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2168279457908#1476605100346847404">wrote</a>:</p> <blockquote> <p><em>Joins are what RDBMS's do for a living. </em></p> </blockquote> <p>Anyway - you can hit <a href="http://www.reddit.com/r/programming/comments/7v978/a_sql_query_walks_into_a_bar_and_sees_two_tables/">this link</a> to see if it gets any comments...</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-7334628146853738658?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com30tag:blogger.com,1999:blog-11839365.post-15711550122576337542009-02-05T14:03:00.001-05:002009-02-05T14:03:19.318-05:00A couple of links and an advert...<h3>Instrumentation</h3> <p><a href="http://carymillsap.blogspot.com/2009/02/on-usefulness-of-software.html">Cary Millsap has recently pointed</a> to a couple of postings and quoted some people on the fine art of <a href="http://tkyte.blogspot.com/2005/06/instrumentation.html">instrumentation</a>.  He quoted me (and got it pretty much 100% - dead on) a couple of times as well.  I'll add a quote/story to his list of quotes...</p> <p>When Oracle 10g first was released - I was out and about talking about new features.  One of the big ones was the ASH/AWR/ADDM set of functionality.  One time, while presenting it an audience member raised their hand and innocently asked:</p> <blockquote> <p><em>What is the overhead of this, what performance impact will this have on my system</em></p> </blockquote> <p>I paused for a second, thought about it, and said:</p> <blockquote> <p><em>Probably at least negative 10 percent or less</em> (meaning more - like negative 1000%, more negative)</p> </blockquote> <p>The audience now paused and we sort of looked at each other and then I explained.  The addition of this instrumentation/repository will allow your database to perform better than it currently is - any 'overhead' of the additional instrumentation is more than offset by the gain in performance. </p> <p>Instrumentation, using bind variables correctly, not swallowing exceptions (when others, not followed by RAISE), avoiding triggers (and side effects) and designing your system to perform in the first place - it is a really short list I have but everything on it has profound impact.</p> <h3> It's a small world</h3> <p>As it turns out - both Cary and I were in Utrecht, the Netherlands recently.  He was there one week, I was there the next (just missed each other).  We were both there to deliver seminars and he pointed out that someone who had been to both <a href="http://carymillsap.blogspot.com/2009/02/report-about-our-course-in-utrecht.html">posted a critique</a>.  It was neat to see how the two sessions seemed to have complimented each other.</p> <p>And since that is <a href="http://toinevanbeckhoven.wordpress.com/2009/02/04/i-had-a-great-two-weeks-listening-to-cary-millsap-jeff-holt-and-tom-kyte/">sort of a review of my seminar</a> - that brings me to the</p> <h3>Advert</h3> <p>You can see my scheduled on <a href="http://asktom.oracle.com/">http://asktom.oracle.com/</a> - there is a calendar there showing my public events.  I would like to point out that I'll be doing two day seminars in:</p> <ul> <li>Prague, Czech Republic - March 10th-11th</li> <li>Athens, Greece - April 7th-8th</li> <li>Rome, Italy - May 18th-19th</li> </ul> <p>Links to information regarding pricing, location and so on are on the the site.  Also, any and all user groups I'm attending for the next 2-3 months is posted there as well.  Hope to see you at one (or more) of the events.</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-1571155012257633754?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com2tag:blogger.com,1999:blog-11839365.post-67742868004588974582009-01-16T23:54:00.001-05:002009-01-16T23:54:44.934-05:00Ok, I feel old...<p>My kids couldn't/can't do it to me (make me feel old).</p> <p>Physical exertion doesn't do it to me.</p> <p>Nothing really did that - until I read <a href="http://www.retroist.com/2009/01/11/ibm-flowcharting-template/">this</a>.  Not the blog entry - but the comments that said things like:</p> <blockquote> <p><em>That being said, that thing is NEAT. <strong>I have no idea what it is though</strong>. Something to do with old punch card computers?</em></p> </blockquote> <blockquote> <p><em>Nice piece of computer history, though <strong>I have no clue what it is</strong>. =P</em></p> </blockquote> <p>I had an IBM flowcharting template once (more than once), and not as a hand me down.  I had the little paper pouch it went into as well.  Ouch.</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-6774286800458897458?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com31tag:blogger.com,1999:blog-11839365.post-81196131993267112592009-01-09T11:09:00.001-05:002009-01-09T11:09:55.043-05:00If this Oracle gig doesn't work out...<p>Maybe I can become a photographer :)  One of my pictures from a recent trip to Sydney Australia was chosen for inclusion in <a href="http://www.schmap.com/sydney/sights_historic/p=67111/i=67111_22.jpg">a travel guide</a>.  </p> <p>I don't think that picture is one of my "best", but it was of historic building they wanted to include in the guide.  I wish they would have picked a better shot - I like this one myself:</p> <a title="IMG_3240 by tom_kyte, on Flickr" href="http://www.flickr.com/photos/tkyte/2946880988/"><img height="375" alt="IMG_3240" src="http://farm4.static.flickr.com/3031/2946880988_20d3f3d9af.jpg" width="500" /></a> <p>And this one would have been pretty cool - if I had centered it just a little more to the left:</p> <a title="Queen Victoria Shopping Mall - very fancy (3) by tom_kyte, on Flickr" href="http://www.flickr.com/photos/tkyte/2931877677/"><img height="375" alt="Queen Victoria Shopping Mall - very fancy (3)" src="http://farm4.static.flickr.com/3043/2931877677_35fe67fcf6.jpg" width="500" /></a> <p>but it was nice to be chosen...</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-8119613199326711259?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com24tag:blogger.com,1999:blog-11839365.post-24378313928114887542009-01-08T08:51:00.001-05:002009-01-08T08:51:45.427-05:00Happy New Year...<p><a href="http://www.oracle.com/newsletters/information-indepth/database-insider/jan-09/kyte.html?msgid=7292207">Happy New Year</a> to everyone...</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-2437831392811488754?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com8tag:blogger.com,1999:blog-11839365.post-17164177834661298672009-01-07T18:15:00.001-05:002009-01-07T18:15:00.241-05:00Dr. Dobb's Journal...<p>Wow, a bit of my past is <a href="http://www.ericsink.com/entries/rip_dr_dobbs.html">going away</a>...  Funny enough - I referred to that magazine <em><strong>just today</strong></em> in a talk.  </p> <p>Without Dr. Dobb's Journal - there might not be an <a href="http://asktom.oracle.com/">asktom.oracle.com</a> site.</p> <p>Why not? What is the link?  Dr. Dobb's is just a programmers journal after all (it and the <a href="http://en.wikipedia.org/wiki/C/C%2B%2B_Users_Journal">C Users Journal</a> were two subscriptions that changed my life, I learned a lot from them both).  Well, the link is that without Dr. Dobb's I might not have learned Oracle - or learned it much later than I did - or learned it differently, less completely.</p> <p>I wrote about Dr. Dobb's in the <a href="http://tkyte.blogspot.com/2006/08/third-time-is-charm_04.html">foreword to a book</a> once and I'll reproduce it here:</p> <blockquote> <p><em>In 1987 I was just graduating from college and starting my career as a software developer. I started as a PL/I programmer on IBM mainframes using two databases – SQL/DS on VM/CMS and DB2 on MVS. I became familiar with SQL, but was limited as to what I could do on these production environments. </em></p> <p><em>One day while reading a magazine, Dr. Dobbs Journal, I noticed an advertisement for a relational database that ran on DOS – simple PC’s. It was a product named “Oracle”. I clipped out the coupon – filled it in and ordered this relational database for $99. About 2 weeks later – a dozen or so 5-1/4” floppy disks showed up in my mailbox and I had Oracle version 5.1.5c and all of the development tools I needed to start playing, learning and exploring with. I was hooked. </em></p> <p><em>That was then, this is now – and now, you have the ability to do in 10 minutes, for free what took me weeks and $99 ($166 in 2006 dollars!) in 1987 accomplish. With the introduction of Oracle Database Express Edition – you can download, develop, deploy and distribute your applications for free.</em> </p> </blockquote> <p> </p> <ul> <li>Dr. Dobb's Journal</li> <li>C Users Journal</li> <li>Borland's Turbo Pascal and Turbo C</li> <li>Oracle version 5.1.5c</li> </ul> <p>Things that changed everything for me... </p> <p>Slowly disappearing - well, except for Oracle of course - and C.  I haven't read Dr. Dobb's in a while, I still write a bit of C here and there, I definitely use Oracle everyday.</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-1716417783466129867?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com14tag:blogger.com,1999:blog-11839365.post-57799879197819418202009-01-07T11:06:00.001-05:002009-01-07T11:06:33.165-05:00This should be fun to watch...<p>On reddit - you can post a 'question' to the community. Someone just posted "<a href="http://www.reddit.com/r/programming/comments/7nzib/ask_proggit_what_is_the_worse_design_decision/">What is the worse design decision that you have made ?</a>" My favorite comment on that thread so far is this one:</p> <p> </p> <blockquote> <p><em>It started with an thought not unlike the following:</em> <p><em>"Nah, flat-file should be fine."</em> <p><em>It ended in tears. And a double digit load average.</em></p></blockquote> <p>Been there, seen that happen. My worst design decision I personally made was when I "invented" (see below for why I say "invented") the "funky data model" - better known as an EAV (entity-attribute-value). You know, the extensible model where all you need is four tables: <ul> <li>objects</li> <li>attributes</li> <li>object_attributes (objects is 1:M with object_attributes)</li> <li>links (links objects to objects, an association table)</li></ul> <p>Man, I could store *anything* in there. And it was very secure - because trying to retrieve anything was really hard. Not only really hard, but really slow.</p> <p>But the prototype/demo was awesome. It never worked in real life though.</p> <p>I used the term "invent" above. Of course I didn't "invent" the EAV - it has existed as a concept for a long long time. But, I see it get re-invented in relational database applications over and over and over again. And every developer thinks for a short period of time "hey, this is so cool - I wonder why no one else has thought of this - they must not have thought of it or everyone would be doing it - I'll be famous".</p> <p>And then they learn why not everyone is doing it :)</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-5779987919781941820?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com33tag:blogger.com,1999:blog-11839365.post-82362812640051486612009-01-02T10:19:00.001-05:002009-01-02T10:19:05.378-05:00All about joins...<p>I've pointed to an excellent youtube database posting by Stephane Faroult in the past - about <a href="http://tkyte.blogspot.com/2008/02/word-pathetic-never-sounded-so-good.html">worst practices in the entry "The word pathetic never sounded so good..."</a></p> <p>He has published another <a href="http://www.youtube.com/watch?v=SmDZaH855qE">short video (six minutes)</a> where he stuck me between Descartes and Kipling during the story telling.  As he wrote me, I could have been in worse company!</p> <p>As before, I enjoy his style of delivery. And to see my dance floor analogy animated was sort of amusing for me.</p> <p> </p> <p>Happy New Year all!</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-8236281264005148661?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com3tag:blogger.com,1999:blog-11839365.post-63888929923348242772008-12-11T19:44:00.001-05:002008-12-11T19:45:45.045-05:00Hey, they stole my line!<p>I've been known to say from time to time <a href="http://asktom.oracle.com/pls/ask/search?p_string=%22my+car+won%27t+start%22">"my car won't start, why not?"</a> (followed many times by a "I've given you as much information as you gave me regarding your problem so now we are even")</p> <p>Well, these guys stole my story!!! <a title="http://notalwaysright.com/diagnostics-through-osmosis/1379" href="http://notalwaysright.com/diagnostics-through-osmosis/1379">http://notalwaysright.com/diagnostics-through-osmosis/1379</a></p> <p>Very funny blog most of the time - I can feel their pain.</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-6388892992334824277?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com9tag:blogger.com,1999:blog-11839365.post-46476189553775796312008-12-11T19:06:00.001-05:002008-12-11T19:06:34.424-05:00Doing it wrong...<p>I hate queries of the following form:</p> <p>select count(*) from <anything else here></p> <p>The reason?  The code typically looks something like this around the count(*):</p> <pre>select count(*) into l_cnt from .....;<br />if ( l_cnt > 0 )<br />then<br /> process_the_data;<br />end if;</pre><br /><br /><pre><font face="Trebuchet MS">I've always wondered why that code isn't just:</font></pre><br /><br /><p>process_the_data; </p><br /><br /><p>Why bother counting - and then processing if that count was greater than zero.  Why not <strong>just process_the_data - that routine already knows how to stop when it runs out of data - just let it run out of data naturally on row zero if there is no data.</strong></p><br /><br /><p>Many people don't stop to consider that</p><br /><br /><ul><br /> <li>The count can change between the select count(*) and the process_the_data call - there might be nothing by the time you get into the process_some_data </li><br /><br /> <li>The count can change while you are running the process_some_data call itself - you cannot use the count as "this is how many times to iterate" (I've seen it done - it fails spectacularly when there are less rows than you counted, it fails silently when there are suddenly more and you never get to them, it also sometimes works by accident). </li><br /></ul><br /><br /><p>I've seen code like:</p><br /><br /><pre>select count(*) into :cnt from t;<br />allocate array of :cnt elements<br />open C for select * from t;<br />for i in 1 .. :cnt<br />loop<br /> fetch c into array(i);<br />end loop;<br />close c;</pre><br /><br /><p>You can just imagine the damage that could do in a language like C for example - interesting results when there are less than :cnt rows to get, segmentation fault - core dumped (we HOPE - we hope it crashes) if there are more than :cnt rows to get.</p><br /><br /><p> </p><br /><br /><p>Anyway, this isn't a post about "don't count and then process" (well, ok, it is in part) - this is a post about an interesting snippet of code a friend sent me.  They are on site doing some "tuning".  I've modified the variables and such to disguise it - but the "logic" is intact:</p><br /><br /><pre>FUNCTION count_em_up<br />( p_input1 in number, <br /> p_input2 in varchar2 <br />)<br />return number<br />IS<br /> CURSOR C <br /> IS<br /> SELECT actual_columns<br /> FROM some_table<br /> WHERE a_column = p_input1 <br /> AND another_column = p_input2;<br /><br /> l_the_cnt number default 0;<br />BEGIN<br /> FOR rec IN C <br /> LOOP<br /> l_the_cnt := l_the_cnt+1;<br /> END LOOP;<br /> RETURN l_the_cnt;<br />EXCEPTION<br /> WHEN OTHERS THEN<br /> RETURN NULL;<br />END;</pre><br /><br /><p>That hurts me in so many ways.  </p><br /><br /><ul><br /> <li>The dreaded "<a href="http://www.google.com/search?q=site%3Atkyte.blogspot.com+when+others+then+null">when others <no error raised here></a>"</li><br /><br /> <li>A loop to COUNT THE ROWS RETRIEVED BY A QUERY!!!</li><br /><br /> <li>Because I did not believe it: A loop to COUNT!!! (had to be said twice)</li><br /><br /> <li>A function to count rows - probably used in higher level code like this "if count_em_up(x,y) > 0 then process_some_data; end if;"</li><br /></ul><br /><br /><p>Well, at least there is the very real probability of tuning this particular application - there is probably lots and lots of low hanging fruit out there like this!</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-4647618955377579631?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com32tag:blogger.com,1999:blog-11839365.post-54664586351223999712008-12-09T20:34:00.001-05:002008-12-10T07:20:42.662-05:00It has been a while...<p>It has been a while since I've posted - so lots of things to talk about coming up.  </p> <p>For a long time, I've had two monitors at home.  I got them back in 2001 right after finishing the first book Expert One on One Oracle - it was my gift to myself for finishing...  They cost a lot back then, it was a huge investment - but worth it.  They are both still going today (you can see one of them down below on the left - the other is with a friend).  Not only do they still work - but the entire dual monitor concept just changes the way you work (more screen, more stuff).</p> <p>Two is no longer enough however - now I must have three.  But to get three video outputs was hard in my desktop - and I wanted to be able to plug into my TV to show pictures whenever I wanted as well (easily, not by ripping out the VGA cables and such).</p> <p>I had been looking at wireless USB connections - but they all seemed slow and low resolution.  Till I hit this one:</p> <p> </p> <p><iframe style="width: 120px; height: 240px" marginwidth="0" marginheight="0" src="http://rcm.amazon.com/e/cm?t=asktom03-20&o=1&p=8&l=as1&asins=B001FSMB0S&fc1=000000&IS2=1&lt1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" frameborder="0" scrolling="no"></iframe></p> <p><a href="http://www.amazon.com/gp/product/B001FSMB0S?ie=UTF8&tag=asktom03-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B001FSMB0S">IOGear GUW2015VKIT Wireless USB to VGA Kit</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=asktom03-20&l=as2&o=1&a=B001FSMB0S" width="1" border="0" /> </p> <p>It supports up to 1600x1200 and everything lower.  Pop it off the back of the monitor and put it on the TV and voila', I'm using the TV as a monitor.  And - it is not slow, and it was really easy to install - no worries about "did I have a free PCI slot, or was it APG, did I need a half height card or a full size - etc".  Seconds after plugging it in - I had three monitors going:</p> <p> </p> <a title="IMG_4095 by tom_kyte, on Flickr" href="http://www.flickr.com/photos/tkyte/3096946362/"><img height="375" alt="IMG_4095" src="http://farm4.static.flickr.com/3162/3096946362_665e928d14.jpg" width="500" /></a> <p>Linux in the middle :) That is a full screen VNC window to my server - for answering questions and testing on.  I keep my email/status windows on the right.  To the left is the 'windows' screen.   </p> <p>I'm really liking it.  Until I can figure out how to get more screens of course...</p> <p>It is amazing how the amount of screen real estate changes the way you work.  I cannot do real work on my single screen laptop anymore - web browser, email - sure.  But trying to write an article/paper and use the database and have the browser and email going - impossible.</p> <p>Apparently, I need a bigger desk at home...  For the fourth monitor.</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-5466458635122399971?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com27tag:blogger.com,1999:blog-11839365.post-81586353520085863732008-09-23T10:02:00.001-04:002008-09-23T10:02:20.611-04:00Podcast from OOW 2008<p><a href="http://streaming.oracle.com/ebn/podcasts/omag/6974830_Tom_Kyte_092208.mp3">Stirring Up Controversy</a></p> <p> </p> <p>...Tom Kyte sits down with Oracle Magazine editor Tom Haunert at Oracle OpenWorld 2008 and stirs things up in this conversation about Oracle OpenWorld happenings, a new approach to publishing, and the trouble with triggers. ...</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-8158635352008586373?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com27tag:blogger.com,1999:blog-11839365.post-11309531257594610862008-09-05T08:51:00.001-04:002008-09-05T08:51:21.337-04:00A new book on APEX coming out...<p></p> <p>There is a <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FPro-Oracle-Application-Express%2Fdp%2F159059827X%2F&tag=asktom03-20&linkCode=ur2&camp=1789&creative=9325">new APEX book</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=asktom03-20&l=ur2&o=1" width="1" border="0" /> coming out soon - I wrote a foreword for it.  There has been some discussion of it on <a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1136945600346245261">asktom</a> - and I thought I'd publish the foreword here:</p> <p>I consider myself a pragmatic person – one that uses the right tools for a job, one that employs the most straightforward and easy way to accomplish a task.  To that end, I’ve been a great supporter and fan of Oracle’s Application Express (APEX) from before the day it was introduced.  I say “before the day” because I’ve had the honor and pleasure of using APEX long before it was released to the public at large – my website, <a href="http://asktom.oracle.com/">http://asktom.oracle.com/</a>, is one of the first websites ever built with the software that was to become known as APEX. </p> <p>APEX is one of the most pragmatic database development tools I know of.  It does one thing and one thing well – it rapidly implements fully functional database applications – applications that are used to predominantly access, display and modify information stored in the database (you know, the important applications out there).  It facilitates using the database and it’s feature set to the fullest – allowing you to implement some rather complex applications, with as little work (code) as possible.  It is possible to build extremely scalable applications with a huge user base (<a href="http://metalink.oracle.com/">http://metalink.oracle.com/</a> for example is built with APEX).  It is possible to build extremely functional applications, with seriously powerful user interfaces (APEX itself is written in APEX, proof of this).  It is easy to build applications rapidly, the current version of <a href="http://asktom.oracle.com">http://asktom.oracle.com</a> was developed in a matter of days by two developers – in their spare time, it was not a full time job. </p> <p>While it all sounds wonderful and easy so far, APEX is a rather sophisticated tool with many bits of functionality and a large degree of control over how the generated application will look and feel.  To fully utilize the power of APEX – one needs to have a guide, a mentor show them how to do so; very much akin to what I do with people regarding the Oracle database. </p> <p>This book – Oracle Application Express – is that guide, the authors – Scott Spendolini and John Scott – are those mentors.  The book walks you through the steps you need to understand after you’ve installed and started using APEX, to go beyond the sample applications.  Covering diverse topics such as “Using the database features to full advantage” (one of my favorite topics) to “SQL Injection Attacks” – what they are and how to avoid them in APEX – to “Printing”; you’ll find many real world issues you will be faced with explained, demystified and solved in this book. </p> <p>For example, Chapter 5 “Data Security” covers a wide breadth of topics regarding securing your database application.  There is a section on URL injection issues – what they are, how they are exploited, why you care about them and finally how to protect yourself from them.  There is a section on Session State Protection – following the same format –what it is, how it is exploited, why you care and finally how to protect yourself.  The same mentoring occurs with data level access where the authors introduce how to use Virtual Private Database, a core database feature – not really an APEX feature, to protect your data from unauthorized access.  Lastly, a critical application feature – Auditing – is discussed in depth using the “what it is, why it is, why you care and then how to do it” approach.  Whilst some of the content in this chapter is not specific to APEX, it is needed to give you a holistic view to building database applications – which is what this book is about. </p> <p>This book covers not just the nitty gritty details of building a secure application, it covers all you need to build database applications with APEX.  When they are done with security, the authors move onto other necessary topics such as how to perform screen layout and application screen navigation, how to integrate reports and charts, how to integrate web services – enabling you to perform application integration – in an APEX environment, and much more. </p> <p>If you are an APEX developer just starting out, or an APEX developer with experience under their belt but want to learn more about the environment you are using – this book is for you.  It describes from start to finish how to build a secure, functional, scalable application using the APEX application development environment. </p> <p>Thomas Kyte <br /><a href="http://asktom.oracle.com/">http://asktom.oracle.com/</a></p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-1130953125759461086?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com20tag:blogger.com,1999:blog-11839365.post-31110371908729635742008-08-08T09:16:00.001-04:002008-08-11T02:44:04.190-04:00Interesting thought...<p>I <a href="http://blog.crankingwidgets.com/2007/10/30/digg-and-reddit-are-doomed-but-not-metafilter/">read this</a> yesterday...</p> <p>Got me thinking about Q&A sites...</p> <p>I believe the author there has something - if you introduce a barrier to entry, it will have it so that only those that really want in - are in. I don't know that metafilter is better/worse/same as reddit and digg - I do know that I used to follow digg, then it became a "not as good place" for me. I follow reddit - but it is becoming very much the same. I've never used metafilter (on my todo list now) so cannot compare it. But the *idea* proposed, the concept - it does seem to have merit.</p> <p>It would be neat to know if this has ever been studied before - does anyone know? Thoughts?</p> <p> </p> <p>ps: I'm not thinking about doing this in asktom. I was asking in general for "social sites" like digg, reddit and the like. Sites that start off nicely with a small focused community but then turn into a bit mess when they become 'cool'.</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-3111037190872963574?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com37tag:blogger.com,1999:blog-11839365.post-48387838494773900802008-07-10T21:50:00.001-04:002008-07-11T07:19:42.838-04:00Read this...<p>I read a lot of "stuff".  Yeah, I know, I'm writing less here - but that leaves more time to read over there...</p> <p>I read lots of blogs, lots of forums.  I lurk.  I observe.  I see what people are saying.</p> <p> </p> <p>I liked what <a href="http://carymillsap.blogspot.com/2008/07/christian-antogninis-new-book.html">Cary Millsap just said</a>:</p> <blockquote> <p><em>I don’t mean “show and tell,” where someone claims he has improved performance at hundreds of customer sites by hundreds of percentage points [sic], so therefore he’s an expert. <strong>I mean show your work, which means documenting a relevant baseline measurement, conducting a controlled experiment, documenting a second relevant measurement, and then showing your results openly and transparently so that your reader can follow along and even reproduce your test if he wants to.</strong></em></p> </blockquote> <p>Check out the entire posting - and the book he is talking about.  Also, check out his new <a href="http://carymillsap.blogspot.com/2008/06/performance-as-service.html">venture</a>.  A pretty good read...</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-4838783849477390080?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com58tag:blogger.com,1999:blog-11839365.post-33688309884774888942008-06-10T15:44:00.001-04:002008-06-10T15:44:19.818-04:00I don't know...<p>I don't know if </p> <p>a) I'm getting grumpier as I get older</p> <p>b) people are losing the ability to phrase a question.  </p> <p>It just seems to me that day by day, the quality of the questions goes down.  I don't remember people asking questions like this just 8 years ago.  I've been participating in forums since 1994.  "Back in the day", the questions were mostly thought out, with examples - with some background, with some thought.  In the last couple of years - this seems to be changing - universally.</p> <p>Oh well, it is probably related to both bullet points... Anyway here is the QOD - question of the day.</p> <p><em>Subject: query is not using particular partition and index despite use full table scan</em></p> <p><em>Entire question:</em></p> <p><em>SELECT count(*) <br />FROM <br />DIM_BANK RIGHT OUTER JOIN FACT_JRNL_ACTG ON (DIM_BANK.BANK_ID=FACT_JRNL_ACTG.BANK_ID) <br />LEFT OUTER JOIN DIM_BSA ON (FACT_JRNL_ACTG.BSA_ID=DIM_BSA.BSA_ID) <br />LEFT OUTER JOIN DIM_FY ON (FACT_JRNL_ACTG.FY_ID=DIM_FY.FY_ID) <br />LEFT OUTER JOIN DIM_APD ON (FACT_JRNL_ACTG.APD_ID=DIM_APD.APD_ID) <br />LEFT OUTER JOIN DIM_PSCD ON (FACT_JRNL_ACTG.PSCD_ID = DIM_PSCD.PSCD_ID) <br />WHERE <br />( <br />(DIM_BANK.BANK_ACCT_CD IN ('33') <br />OR '*' IN ('33')) <br />AND DIM_PSCD.PSCD_CLOS_CL_CD IN ('1', '4', '5') <br />AND CASE DIM_BSA.CASH_ACCT_FL WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' END = 'Yes' <br />AND DIM_APD.PER != 0 <br />AND DIM_APD.PER != 99 <br />AND DIM_APD.FY < 2008 <br />OR DIM_FY.FY = 2008 <br />AND DIM_APD.PER <= 6 <br />AND DIM_APD.PER != 0 <br />AND CASE DIM_BSA.CASH_ACCT_FL WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' END = 'Yes' <br />AND DIM_PSCD.PSCD_CLOS_CL_CD IN ('1', '4', '5') <br />AND (DIM_BANK.BANK_ACCT_CD IN ('33') <br />OR '*' IN ('33')) <br />); </em></p> <p> </p> <p>That's it folks.  "My query isn't doing partition elimination (probably, I'm sort of GUESSING) and isn't using some index (on some column of some table)"</p> <p>Before anyone says anything - this comes from the US.</p> <p>Some wows from reading the query: </p> <ul> <li>"(DIM_BANK.BANK_ACCT_CD IN ('33') OR '*' IN ('33')) - why would you do that?</li> <li>"CASE DIM_BSA.CASH_ACCT_FL WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' END = 'Yes'" - why would you do THAT?</li> <li>"CASE DIM_BSA.CASH_ACCT_FL WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' END = 'Yes'" - just in case you didn't believe us the first time</li> <li>wow, more duplicated predicates...</li> <li>outer joins to DIM_BSA, but we have that neat predicate using CASE - if we actually needed to outer join to DIM_BSA then all of the attributes would be NULL - the predicate would never be true - hence, we do not need or want to outer join to DIM_BSA</li> <li>Same comment about DIM_FY, we outer join to DIM_FY, but if we make up a row - then DIM_FY's attributes will all be null and DIM_FY.FY = 2008 cannot be true (or false, it is unknown)</li> <li>Ditto for DIM_APD</li> <li>and of course DIM_PSCD</li> <li>and just to make it 100% complete, the outer join to DIM_BANK - ditto. <strong>every single outer join in this query, should not be there.</strong></li> </ul> <p>I've responded with:</p> <p>My car won't start.  Now we are even, we have shared the same level of detail regarding our respective problems.</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-3368830988477488894?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com105tag:blogger.com,1999:blog-11839365.post-16123056968637731882008-06-05T19:43:00.001-04:002008-06-05T19:43:53.179-04:00when others then null, redux<p>It keeps happening.</p> <p>Over and over it keeps happening.</p> <p>Here is case 124,215,412,523 for your review.</p> <p>The user writes me:</p> <p><em>... I have a situation where I have started receiving the 'Cursor is Closed' SQLException from a stored procedure, say, SP_A, suddenly for last 5-6 weeks, since 2nd week of March. This happens only intermittently. If I take the same parameters and execute the sp again after a few minutes after getting the error, it does not generate the error and returns expected results back. </em></p> <p><em>...</em></p> <p><em>Additional details as requested: </em></p> <p> <br /><em>what ora-xxxx error are you getting <br /></em></p> <p><em>Unfortunately, it does not generate an ORA-???? error. I know that many a times, the 'Cursor is Closed' error is a coding issue, but in this case, <strong>that is not the case</strong>. I cannot create this error at will, I have not been able to create the error in our development or user acceptance environment. Even in production, I cannot recreate it with same parameters that have generated the error.</em></p> <p><em>...</em></p> <p><em>The reason I think this could be oracle memory issue is that we very recently moved from 9i to 10g RAC. This application - java code and stored procedures - have been working for about 5 to 6 years now. Even the errors of Cursor is closed we receive are not consistent i.e. The parameters that generate the error now will work with exact same code a few minutes later.</em></p> <p><em>...</em></p> <p><em></em></p> <p>Ok, here they are - they say "there is no ora-xxxx error, Oracle is just closing cursors on us - no fair.  We know this cannot be a bug in our code, this is a bug in Oracle.  </p> <p>The story ALWAYS goes that way.  I just finally gave up... closed the question.  They followed up:</p> <p> </p> <p><em>What was found that SP_A had exception clause of WHEN OTHERS that was masking the actual error. <br />When we removed that error, this is the error we see </em></p> <p><em>ORA-04068: existing state of packages has been discarded <br />ORA-04065: not executed, altered or dropped stored procedure "SP_A" <br />ORA-06508: PL/SQL: could not find program unit being called: "SP_A" <br />ORA-06512: at "SP_B", line 317 <br />ORA-06512: at line 1 </em></p> <p><em>This is what has been happening intermittently ( we just did not know, because the way the sp was <br />coded and the java code interacted with returned parameters, it manifested into Cursor Closed Error <br />).</em></p> <p> </p> <p>and now they want "insight" into why this is happening.... </p> <p> </p> <p>Remember everyone, everyone remember, keep in mind:</p> <p><strong><em><u>When others not followed by RAISE or RAISE_APPLICATION_ERROR is almost certainly, with 99.999999999% degree of accuracy, a bug in your developed code.  Just say "no" to when others not followed by raise or raise_application_error!</u></em></strong></p> <p><a title="http://www.oracle.com/technology/oramag/oracle/07-jul/o47asktom.html" href="http://www.oracle.com/technology/oramag/oracle/07-jul/o47asktom.html">http://www.oracle.com/technology/oramag/oracle/07-jul/o47asktom.html</a></p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-1612305696863773188?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com29tag:blogger.com,1999:blog-11839365.post-69113129380716680892008-06-02T14:47:00.001-04:002008-06-02T14:50:25.846-04:00Seems like a good idea...<p><a href="http://tylermuth.wordpress.com/2008/06/01/reusable-plsql/">Check it</a> out - and comment away...  Tyler has a good idea/thought going on over there.</p> <p>Also (total context switch here) this is the coolest new bit of SQL I've had the pleasure of writing for a while (11g and above only...)</p> <p> </p> <pre>ops$tkyte%ORA11GR1> with data<br /> 2 as<br /> 3 ( select when, thing, val<br /> 4 from t2<br /> 5 unpivot ( val for thing in<br /> 6 ( LF_ROWS, LF_BLKS, LF_ROWS_LEN, LF_BLK_LEN,<br /> 7 BR_ROWS, BR_BLKS, BR_ROWS_LEN, BR_BLK_LEN,<br /> 8 DEL_LF_ROWS, DEL_LF_ROWS_LEN, DISTINCT_KEYS,<br /> 9 MOST_REPEATED_KEY, BTREE_SPACE, USED_SPACE,<br /> 10 PCT_USED, ROWS_PER_KEY, BLKS_GETS_PER_ACCESS,<br /> 11 PRE_ROWS, PRE_ROWS_LEN, OPT_CMPR_COUNT, OPT_CMPR_PCTSAVE )<br /> 12 )<br /> 13 )<br /> 14 select THING, before, middle, coalesce, rebuild, rebuild-coalesce diff<br /> 15 from data<br /> 16 pivot( max(val) for when in ( 'before' as before, 'middle' as middle,<br /> 17 'coales' as coalesce, 'rebuil' as rebuild )<br /> 18 )<br /> 19 order by thing<br /> 20 /<br /><br />THING BEFORE MIDDLE COALESCE REBUILD DIFF<br />-------------------- ---------- ---------- ---------- ---------- ----------<br />BLKS_GETS_PER_ACCESS 4 4 4 4 0<br />BR_BLKS 6 6 6 4 -2<br />BR_BLK_LEN 8028 8028 8028 8028 0<br />BR_ROWS 2810 2810 1409 1405 -4<br />BR_ROWS_LEN 33639 33639 16856 16809 -47<br />BTREE_SPACE 22524924 22524924 11322528 11274488 -48040<br />DEL_LF_ROWS 0 238415 0 0 0<br />DEL_LF_ROWS_LEN 0 9601917 0 0 0<br />DISTINCT_KEYS 499999 488415 250000 250000 0<br />LF_BLKS 2811 2811 1410 1406 -4<br />LF_BLK_LEN 7996 7996 7996 7996 0<br />LF_ROWS 499999 488415 250000 250000 0<br />LF_ROWS_LEN 20121735 19665121 10063204 10063204 0<br />MOST_REPEATED_KEY 1 1 1 1 0<br />OPT_CMPR_COUNT 0 0 0 0 0<br />OPT_CMPR_PCTSAVE 0 0 0 0 0<br />PCT_USED 90 88 90 90 0<br />PRE_ROWS 0 0 0 0 0<br />PRE_ROWS_LEN 0 0 0 0 0<br />ROWS_PER_KEY 1 1 1 1 0<br />USED_SPACE 20155374 19698760 10080060 10080013 -47<br /><br />21 rows selected.</pre><br /><br /><p>I used pivot to turn my rows into columns and then unpivot to turn some of my columns into rows (I flipped this result side on its side!)</p><br /><br /><p>A bit of background, I wanted to compare the effects of:</p><br /><br /><ul><br /> <li>freshly built index (before) </li><br /><br /> <li>to an index that had lots of deletes done to it (middle) </li><br /><br /> <li>to an index that was just coalesced after those deletes (coalesce) </li><br /><br /> <li>to a rebuilt index (rebuild) </li><br /></ul><br /><br /><p>So, in order to capture the information I just did this:</p><br /><br /><pre>ops$tkyte%ORA11GR1> create index t_idx on t(x,object_name);<br />ops$tkyte%ORA11GR1> analyze index t_idx validate structure;<br /><br />ops$tkyte%ORA11GR1> create table t2<br /> 2 as<br /> 3 select 'before' when, index_stats.* from index_stats;<br /><br />delete data here....<br /><br />ops$tkyte%ORA11GR1> analyze index t_idx validate structure;<br />ops$tkyte%ORA11GR1> insert into t2<br /> 2 select 'middle' when, index_stats.* from index_stats;<br /><br />ops$tkyte%ORA11GR1> alter index t_idx coalesce;<br />ops$tkyte%ORA11GR1> analyze index t_idx validate structure;<br />ops$tkyte%ORA11GR1> insert into t2<br /> 2 select 'coales' when, index_stats.* from index_stats;<br /><br />ops$tkyte%ORA11GR1> alter index t_idx rebuild;<br />ops$tkyte%ORA11GR1> analyze index t_idx validate structure;<br />ops$tkyte%ORA11GR1> insert into t2<br /> 2 select 'rebuil' when, index_stats.* from index_stats;</pre><br /><br /><p>Now, index_stats has lots of columns... and my table T2 has very few rows - so, if I turn my rows into columns and columns into rows, I'd be able to better visualize this particular set of data on screen (in sqlplus of course...)</p><br /><br /><p>That is what that pivot/unpivot query did for me - I like it...</p><br /><br /><p> </p><br /><br /><p>Looks better than this did :)</p><br /><br /><p> </p><br /><br /><pre>ops$tkyte%ORA11GR1> select * from t2;<br /><br />WHEN HEIGHT BLOCKS NAME<br />------ ---------- ---------- ------------------------------<br />PARTITION_NAME LF_ROWS LF_BLKS LF_ROWS_LEN LF_BLK_LEN<br />------------------------------ ---------- ---------- ----------- ----------<br /> BR_ROWS BR_BLKS BR_ROWS_LEN BR_BLK_LEN DEL_LF_ROWS DEL_LF_ROWS_LEN<br />---------- ---------- ----------- ---------- ----------- ---------------<br />DISTINCT_KEYS MOST_REPEATED_KEY BTREE_SPACE USED_SPACE PCT_USED ROWS_PER_KEY<br />------------- ----------------- ----------- ---------- ---------- ------------<br />BLKS_GETS_PER_ACCESS PRE_ROWS PRE_ROWS_LEN OPT_CMPR_COUNT OPT_CMPR_PCTSAVE<br />-------------------- ---------- ------------ -------------- ----------------<br />before 3 2944 T_IDX<br /> 499999 2811 20121735 7996<br /> 2810 6 33639 8028 0 0<br /> 499999 1 22524924 20155374 90 1<br /> 4 0 0 0 0<br /><br />middle 3 2944 T_IDX<br /> 488415 2811 19665121 7996<br /> 2810 6 33639 8028 238415 9601917<br /> 488415 1 22524924 19698760 88 1<br /> 4 0 0 0 0<br /><br />coales 3 2944 T_IDX<br /> 250000 1410 10063204 7996<br /> 1409 6 16856 8028 0 0<br /> 250000 1 11322528 10080060 90 1<br /> 4 0 0 0 0<br /><br />rebuil 3 1536 T_IDX<br /> 250000 1406 10063204 7996<br /> 1405 4 16809 8028 0 0<br /> 250000 1 11274488 10080013 90 1<br /> 4 0 0 0 0</pre> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-6911312938071668089?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com10tag:blogger.com,1999:blog-11839365.post-41141079885042240622008-05-23T09:43:00.001-04:002008-05-23T09:44:27.348-04:00Hear, Hear<p><a href="http://sethgodin.typepad.com/seths_blog/2008/05/double-double.html">Double, double</a>...</p> <p> </p> <p>Been a while since I've pointed to his blog - but this one is one that resonated with me.</p> <p>I related to it for this reason:  when people describe what problems they are facing in technology - they very often assume the person they are describing it to have the same background, nomenclature, experiences.  What they forget is we don't work with them, we don't share the same jargon and most importantly - <strong><em>we haven't been staring at the problem like they have for the last 5 days - it is all new to us.</em></strong>  And therefore, we need lots of detail.  </p> <p>For me, this manifests itself in a question like this: I have this/these table(s).  I need a report that looks like this: .... This query is failing.  Please correct it.</p> <p>It won't matter how loud or long they say "Please correct it", it won't happen - we don't know what the question is yet!</p> <p>Double, double - indeed.</p> <div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11839365-4114107988504224062?l=tkyte.blogspot.com'/></div>Thomas Kytehttp://www.blogger.com/profile/00933377956793659534noreply@blogger.com17