trusted online casino malaysia

Upgrading to 11gR2 – DOUG Presentation Materials

I re-did my Upgrade to 11gR2 talk at the DOUG meeting in Dallas this afternoon. (I originally did it at the Cowboys Stadium for an Oracle Tech Day around Halloween). I promised that I’d post a link to the presentation, so here it is (just click on the image):

It’s the same presentation as the one from the original talk, although I got twice as much time to do it this time (worked out a lot better). Here’s a link to the post about that original Tech Day event with a bunch of pictures of the stadium, including a couple of Jerry’s data center: Cowboy Stadium Pictures

Fixing Bad Index Hints in SQL Profiles (automatically)

I’ve written before on the change Oracle made to their Hint based mechanisms (Outlines/Profiles/Baselines) in 10g here: Why Isn’t Oracle Using My Outline / Profile / Baseline. To quickly recap, prior to 10g, the design goal for Outlines appears to have been to “lock” execution plans. That is to allow the optimizer as little flexibility as possible. With 10g and 11g, it appears the goal has swung away from the “locking” concept and towards allowing the optimizer more flexibility. I’ll show you an example of what I mean in a minute, but I must say that I find this decision to be irritating at best. It seems to me that the whole reason for implementing one of these objects is to try to keep the optimizer from changing its mind. After all, it was originally called “Plan Stability” by the Oracle marketing guys.

One of the main offenders in this regard is the use of a new format available for index hints as of 10g. Prior to 10g, the index looked basically like this:

INDEX(TABLE_NAME INDEX_NAME)

Translation: If possible, use this index on this object.

As of 10gR2, there is a new possible format which appears to be used (at least most of the time) when Outlines/Profiles/Baselines are created. The new format looks like this:

INDEX(TABLE_NAME (TABLE_NAME.COLUMN_NAME TABLE.NAME.COLUMN_NAME …))

Translation: If possible, use any available index on any of these columns.

As you can see, this format leaves a lot more to the optimizer’s discretion than the older format. (Note: the older format is still valid)

Update 01/03/11: Thanks to Tony Hasler for making me get the syntax right (see comments below).

In my previous post I published a script for changing an individual SQL Profile hint, but recently I had a situation where there was a SQL Profile that had 20+ index hints where the statement was suffering from plan instability, despite the fact that it was using a SQL Profile. Rather than manually look up the correct index names and change the hints one by one (a very error prone proposition), I decided to write a script that would automatically change all the INDEX hints from the “non-specific column oriented” format to the “specific index name” format.

But before I give you the script – a little history. Here are Outline hints for the same statement from 9.2.0.8, 10.1.0.?, 10.2.0.4, and 11.2.0.1:

Continue reading ‘Fixing Bad Index Hints in SQL Profiles (automatically)’ »

I Love the Smell of Asparagus in the Morning

I went to the Dallas 100 awards banquet last night at the Morton Meyerson Symphony Center. The Dallas 100 is an annual award for the fastest growing privately held companies that are based in the Dallas / Fort Worth area. Enkitec was number 81 this year – not that great, but still not too bad considering the state of the economy over the last couple of years (we were 42nd last year by the way).


Sam Wyly was the guest speaker at the presentation. He didn’t actually give a speech, but rather gave an interview which was interesting. He’s best known as the founder of Michael’s Stores which sold for around $4,000,000,000 a few years back.


As usual, there was a dinner after the presentation. And as usual it was some kind of meat with asparagus. I guess asparagus must be one of those things that can be cooked a little bit ahead of time or kept warm without too much trouble because it seems to be standard fare at these types of events. Anyway, it’s always nice to have a dinner with asparagus because you get reminded of it the next morning. I won’t go into the details here but if you’re interested I highly recommend this article on the Discovery web site. Whew!

11g Release 2 Technology Day – Dallas Cowboy Stadium

Well the talk went pretty OK. I did feel pressed for time though. Mainly because I had 53 slides for a 45 minute talk, but we also were running behind schedule by the time I got to do my bit. But we got through it. I didn’t get to go into nearly as much detail as I would have liked but that may not have been such a bad thing. The one thing I didn’t say that I had intended to was that 11g looks very similar to 10g unless you actively implement some of the new features. So DBA’s that are familiar with 10g should quickly begin to feel comfortable with 11g. By the way, I’m quite happy to entertain any questions on the presentation here since we ran out of time.

So anyway, without further ado, here is the link to the power point presentation: Upgrading to Oracle Database 11g Release 2

I also took a bunch of pictures during the tour of the stadium which I’ll post later. Here’s the most interesting part of the stadium for a bunch of computer nerds like us though, the data center!

Apparently, even the computer operators get to watch TV in Jerry’s house!

Update: – here’s a few more pictures!

Video monitors everywhere – including some just to show the logo …

Here’s my co-presenter Cary Millsap:

… just before we got to go into the Dallas Cowboy Cheerleaders dressing room. That explains the look on his face!

Continue reading ‘11g Release 2 Technology Day – Dallas Cowboy Stadium’ »

11g Upgrade Talk

I am signed up to do a talk next week at the Dallas Cowboys’ new stadium (known affectionately around here as “Jerry World”).


The stadium cost approximately 1.8 billion dollars to build. It’s supposed to be pretty impressive, I guess we’ll find out. U2 played in the stadium last week. Jerry had to move the big jumbo-tron screen above the floor in order for U2 to get their elaborate stage set up. The rumor was that it cost about $1 million to move it. Small change compared to the overall cost of the project.


We’re supposed to be in the press room which only seats about 100. This should be a fun event not only because of the interesting venue, but because the list of presenters includes a couple of good friends (Cary Millsap of Method R and Sean Turner now with Oracle). The theme is 11g R2. I had been told the event was full for a while and originally the sign up page just had a number to call for overflow seating, but there is a link to register on the page now, so get in while you can. Here’s the link to the info page:

11g Release 2 Technology Day

Hope to see you there.

11gR2 – My Top Ten List of Interesting New Features

Well it’s been a few weeks since Oracle made 11gR2 available for general use. After looking through the new features document, I made a short list of new features that I thought would be worthy of further investigation. As I spent a little time looking at them though, there turned out to be very little that was all that exciting. There were a couple of exceptions, but for the most part it seems that Oracle concentrated on stability rather than drastically new features. That’s not necessarily a bad thing and is probably an indication of the product (and the development process at Oracle) maturing. Nevertheless, here are a few things that I think are interesting:

  1. Edition Based Redefinition – Rolling out new code that requires schema changes has always been a challenge. Keeping up with the changes, providing a mechanism to roll them back if things don’t go well, and allowing some code to continue to work as is, instead of having to change every single piece of code that accesses a changed object – these are a few of the challenges that come along with making schema changes. It’s a bit a chicken and egg thing. One way to mitigate the risk of these types of changes has been to use views to provide an abstraction layer that allows the code to be changed over time as opposed to the big bang approach of all code that accesses an object being forced to change at the same time. Edition Based Redefinition is designed to allow Oracle to manage that complexity via a new thing called an Edition. It’s pretty cool and in my opinion is hands down the best new feature of 11gR2.
  2. File Watcher – The job scheduler has been enhanced to be able to monitor a directory and kick off a job when a file shows up. No more writing the same shell script over and over.
  3. Stored Outline Migration – There is now a utility to migrate Outlines into 11g’s SQL Plan Management framework. This feature may actually be useful for migrating from older versions of Oracle directly to 11g. It basically converts Outlines to Baselines.

And here’s the list of things I initially thought might be interesting but that I have really not warmed up to (yet anyway).

  1. Instance Caging – Putting multiple instances on a single machine is attractive from a licensing standpoint but can cause problems from a performance perspective. Instance caging is a new feature for controlling the amount of resources (CPU) that an instance can use. It is a good idea; however, there are already numerous options available from most of the major hardware vendors that can accomplish the same thing (think AIX LPARs, Solaris Zones/Containers, HPUX vPars, etc…).
  2. ACFS – A true clustered file system? This one may be more interesting after I get a chance to play with it more, but come on, file systems just aren’t that exciting.
  3. ASM FS Snapshot – Snapshoting capabilities have been added to ASM. Looks like an attempt to compete with the SAN guys. There are lots of people that use Snapshot technology for backup and disaster recovery scenarios, so maybe this will grow on me as well.
  4. OCR Enhancements – OCR files may be stored in ASM, ho hum. At least we don’t need a separate Lun.
  5. Cluster Time Service – There have been problems with RAC nodes getting evicted because of clock drift. But there are other ways to deal with this (NTP for example). But this is a nice addition, just not that interesting.
  6. Segment Creation on Demand – No need to pre-build segments. Maybe useful by saving some storage for a while. But presumably you’ll be needing the space eventually or you wouldn’t have built the objects in the first place. Delaying the allocation of space just seems to me like an opportunity for a user to get an error when dynamic allocation of space occurs “automatically”. I think I’d prefer to do it ahead of time in most cases.
  7. Hybrid Columnar Compression – This feature is actually very interesting. It has been hyped a little as Column Oriented Storage, but is in fact simply a compression technique (see Kevin Clossan’s post: Oracle Switches To Columnar Store Technology ). It may be highly effective though as the compression possibilities provided by column oriented storage models are a big part their advantage. Unfortunately, the fact that it’s only available as part of the Exadata storage hardware, means it is not going to be very widely applicable unless the Exadata product really takes off.

Anyway, that’s my thoughts on 11gR2 so far. I really don’t mean to be negative. I like getting my hands on new toys as much as the next guy, but I do believe that concentrating on improving stability and incremental performance gains is absolutely the right approach. It looks to me like Oracle has made a change to a more mature and disciplined development / release model. And I think that’s a good thing.

Let me know if you have another favorite new feature that I may have overlooked.

How to Attach a SQL Profile to a Different Statement – Take 2

I posted on this topic a while back (How to Attach a SQL Profile to a Different Statement – Take 1), but wasn’t really happy with my solution. So here’s another shot at it. The basic idea is to be able to create a profile on one statement using hints or whatever other tricks you can come up with, and then attach the profile to a production statement on which you cannot modify the code. The basic steps of this technique are as follows:

The main reason I became dissatisfied with my previous approach was that it’s often necessary to fix one or more of the hints (see this post for the most common reason: Why Isn’t Oracle Using My Outline / Profile / Baseline?). The preceding steps allow the Profile to be tweaked before attaching it to the target statement. My previous approach created the profile and moved it all in one step. So there was no chance to modify the Profile before it was attached to the production statement. Anyways, here’s an example (note the examples are on a 10.2.0.4 database, but all the SQL should work on 11g as well):
Continue reading ‘How to Attach a SQL Profile to a Different Statement – Take 2’ »

Worlds Greatest Guitarist

I am constantly amazed by how people, myself included, occasionally over exaggerate. It’s pretty common in normal speech but it seems to be almost required in marketing material. Words like Greatest, Biggest, Most Effective, Fastest, Fluffiest, Zestiest, etc… I sometimes wonder how people come up with this stuff. For example, I ran across this video on utube:

Best Guitar Improvisation Ever

Entertaining no doubt, but “Best Guitar Improvisation Ever”???

Who voted on that? Were professionals allowed to compete, like say Mark Knopfler, Eric Clapton, Slash, Stevie Ray Vaughn, Carlos Santana, Buckethead, Jeff Beck, Peter Frampton, Eddie Van Halen, Jimi Hendrix, Roy Clark, Django Reinhardt, Chet Atkins, B.B. King, Jimmy Page, Andres Segovia,  …  ? (sorry if I left off you’re favorite, but you get the idea)

Some of it is shameless self promotion, but I blame most of this stuff on marketing guys. I don’t hold it against them, they have to make a living too. But they do a couple of things that amuse me.

  1. They make the previously mentioned exaggerated claims.
  2. They make up official sounding statistics to support their exaggerated claims.
  3. They write their own quotes (and attribute them to people that they wish had said them).
  4. They are obsessed with “look and feel” stuff (“It’s more important to look good, than to feel good”).

Let’s begin with bullet number one (exaggerated claims):

Here’s a couple of outrageous claims I ran across (names altered or withheld to protect the guilty).

  • “Joe and Bill are recognized as the two best-selling Oracle Authors in the world.  With combined authorship of over 25 books, Joe & Bill are the two most respected Oracle authorities on the planet.  For the first time ever, Joe & Bill combine their talents in this exceptional handbook.”

  • Did you know that there’s a way to burn 3 to 15 pounds of fat PERMANENTLY and SAFELY . . . WHILE YOU SLEEP?! 100% Guaranteed!
  • “Because you haven’t just found people who know a little bit about what you’re going through – you’ve found the undisputed heavyweight Oracle experts.”

That last one was bad enough without emphasizing the outrageous claim by using a bold font. And just to show I’m not playing favorites, that one is from the web site of the company I work for!

Continue reading ‘Worlds Greatest Guitarist’ »

Quotes in Strings (Oracle Q-quote)

In the “Learn Something New Every Day” category, I ran across this new feature (to me) of 10g today (on Eddie Awad’s Blog). I was trying to write a little script to help me create a rewrite rule using DBMS_ADVANCED_REWRITE and I wanted to be able to pass a string that had quotes embedded in it (i.e. a SQL statement). Of course you all know that quotes can be embedded in a string by doubling them like so:

SQL> select '''This is Kerry''s stuff.''' string from dual;

STRING
------------------------
'This is Kerry's stuff.'

Or perhaps using the chr function like so:

SQL> select chr(39)||'This is Kerry'||chr(39)||'s stuff.'||chr(39) string from dual;

STRING
------------------------
'This is Kerry's stuff.'

The new way is much more straight forward, especially if the goal is to paste in a long SQL statement with potentially lot’s of quotes. It looks like this:

SQL> select q'[What ever stuff you'd like to see, just as you'd like to see it.]' string from dual;

STRING
----------------------------------------------------------------
What ever stuff you'd like to see, just as you'd like to see it.

Not bad, huh? Much easier to read – but that’s not all. Suppose you want to prompt the user for a string that contains quotes.

SQL> select '&string' into :x from dual;
Enter value for string: this is text

'THISISTEXT'
------------
this is text

SQL> /
Enter value for string: where x = 'Y'
select 'where x = 'Y'' into :x from dual
                    *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

So it sees the first quote in the string and thinks it’s at the end of the string. To get around this you could paste your string into a text editor, replace every quote with two quotes (or with ‘||chr(39)||’), and then grab the whole new string and paste it back into your script. But it’s pretty messy. Obviously the Q-quote method makes the whole thing much simpler.

By way of example, here’s the little script I was working on:

SQL> !cat create_rewrite.sql

exec sys.dbms_advanced_rewrite.declare_rewrite_equivalence ( -
name => '&rewrite_name', -
source_stmt => q'[&from_sql_statement]', -
destination_stmt => q'[&to_sql_statement]', -
validate => FALSE, -
rewrite_mode => 'TEXT_MATCH' -
);

SQL> @create_rewrite
Enter value for rewrite_name: DODA
Enter value for from_sql_statement: select * from sapsr3.fkkvk where vkona <> 'Y'
Enter value for to_sql_statement: select * from sapsr3.fkkvk where vkona = 'N'

PL/SQL procedure successfully completed.

The syntax is really simple: Just select q'[ whatever_you_want_here_including_quotes ]’ and that’s it.
Of course there are a few options (such as using your choice of delimiters). Here’s a link to the docs if you want
further details.

Dan Morgan’s Oracle Library has a good example as well here.

I like using the square brackets as the delimiters because I don’t usually see them in strings (and it looks kind of like a regular expression) ;).

Common Sense Law

I read in the Fort Worth Star Telegram this morning that the Texas legislature had passed a law (Texas House Bill 171) which requires school administrators to use common sense. I guess there has been a problem with this in the past (actually the bill explicitly states that there has been a problem – “School administrators are allowed to consider mitigating factors but sometimes choose not to exercise common sense.”). At issue was strict “no tolerance” policies in some school districts whereby kids were getting sent to alternative schools for infractions as absurd as leaving a baseball bat in the car, leaving fishing tackle (including a knife) in the car, forgetting to take a pocket knife out of a pocket, getting beat up (that’s right – both participants in a fight get the same punishment).

Oddly enough, no one voted against this bill. How could you vote against “common sense”. Can’t you just see the negative political ad next election …

You know the unflattering black and white images, with the voice over saying something like:  “My illustrious opponent voted against Common Sense. Surely you don’t want to elect someone who doesn’t even believe in Common Sense!” …

During dinner, my daughter asked me what I was going to do at work tomorrow. I told her I was going to try to use common sense, even though it wasn’t required by law in my profession. At least it doesn’t yet… But imagine if we could just get a few more organizations in a few more states to start taking this idea seriously. Just imagine what could happen. Reminds me of that bit from Arlo Guthrie’s song – Alice’s Restaurant:

“… And can you, can you imagine fifty people a day,I said fifty people a day walking in singin a bar of Alice’s Restaurant and walking out. And friends they may think it’s a movement. …”

(by the way, if you’ve never heard “Alice’s Restaurant” you should go buy it from iTunes right now – I mean right now – don’t even finish reading this – do it now!)

Anyway, this common sense thing sounds like a great idea that could really catch on. I can think of a few organizations where common sense could really be valuable (a lot of them are in Washington). Although I’m not sure how they would enforce it… But that’s a job for another day.