trusted online casino malaysia

Archive for the ‘Oracle’ Category.

Autotuned DB_FILE_MULTIBLOCK_READ_COUNT

This topic keeps coming up so I decided to write a little blurb on it. Mainly so I could stop repeating myself (I think I’ve written the same email about 10 times now). So here goes:

First the short version:

  • If you are on 10gR2 or later you should probably not set DB_FILE_MULTIBLOCK_READ_COUNT.

Now the long winded discussion:

A fairly significant change to the Oracle optimizer was rolled out in 10gR2 with regards to the parameter DB_FILE_MULTIBLOCK_READ_COUNT (from here on out I’ll just refer to as DBFMBRC as it’s too long to type). Prior to 10gR2, this parameter was used for multiple purposes – namely:

  • Representing the avg number of blocks that a multi-block read would return (used in the costing estimate when parsing)
  • The number of blocks to attempt to read when a multi-block read is executed

Unfortunately, these two uses often worked against each other. Increasing the DBFMBRC in order to improve the throughput of multi-block reads generated by operations such as full table scans, would have the side effect of causing the optimizer to favor access paths that resulted in multi-block reads. I think that was probably the main driver for the introduction of the OPTIMIZER_INDEX_COST_ADJ and OPTIMIZER_INDEX_CACHING parameters – which allowed the optimizer’s preference for full table scans to be dialed down, but that’s a topic for another post.

The costing value and the execution value need not necessarily be related (and in 10gR2 they aren’t unless you make it so). For example, the estimate for costing purposes could be set to a relatively low value (so that the optimizer would not unduly favor multi-block read type operations) while the value used when actually requesting a multi-block i/o could be set relatively high (to maximize throughput in cases where a multi-block read was actually performed). 10gR2 accomplishes this by adding a couple of so called hidden parameters (you know, the one’s that start with an underscore). The parameters are:

  • _db_file_optimizer_read_count – this is the one that’s used for costing
  • _db_file_exec_read_count – this is the one that’s used when an i/o request is issued

If you leave DB_FILE_MULTIBLOCK_READ_COUNT set to its default value, these two parameters will be set to two different values. For example, on my 10.2.0.4 database using 8K blocks, the values are 8 and 128 respectively. So the optimizer should do it’s costing with a value of 8 but attempt to read 128 blocks, if it does indeed choose a full table scan. Let’s take a look:


> !sql
sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Jan 13 17:21:55 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@LAB1024> select     pname, pval1
  2  from       sys.aux_stats$
  3  /

PNAME                               PVAL1
------------------------------ ----------
STATUS
DSTART
DSTOP
FLAGS                                   1
CPUSPEEDNW                     526.069569
IOSEEKTIM                              10
IOTFRSPEED                           4096
SREADTIM
MREADTIM
CPUSPEED
MBRC
MAXTHR
SLAVETHR

13 rows selected.

SYS@LAB1024> -- default values
SYS@LAB1024> 
SYS@LAB1024> select name, value, isdefault, ismodified, isset
  2  from
  3  (
  4  select flag,name,value,isdefault,ismodified,
  5  case when isdefault||ismodified = 'TRUEFALSE' then 'FALSE' else 'TRUE' end isset
  6  from
  7     (
  8         select
  9              decode(substr(i.ksppinm,1,1),'_',2,1) flag
 10              , i.ksppinm name
 11              , sv.ksppstvl value
 12              , sv.ksppstdf  isdefault
 13  --            , decode(bitand(sv.ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE') ismodified
 14              , decode(bitand(sv.ksppstvf,7),1,'TRUE',4,'TRUE','FALSE') ismodified
 15           from x$ksppi  i
 16              , x$ksppsv sv
 17          where i.indx = sv.indx
 18     )
 19  )
 20  where name like nvl('%¶meter%',name)
 21  and upper(isset) like upper(nvl('%&isset%',isset))
 22  and flag not in (decode('&show_hidden','Y',3,2))
 23  order by flag,replace(name,'_','')
 24  /
Enter value for parameter: read_count
Enter value for isset: 
Enter value for show_hidden: Y

NAME                                               VALUE                                                                  ISDEFAUL ISMODIFIED ISSET
-------------------------------------------------- ---------------------------------------------------------------------- -------- ---------- ----------
db_file_multiblock_read_count                      128                                                                    TRUE     FALSE      FALSE
_db_file_exec_read_count                           128                                                                    TRUE     FALSE      FALSE
_db_file_noncontig_mblock_read_count               11                                                                     TRUE     FALSE      FALSE
_db_file_optimizer_read_count                      8                                                                      TRUE     FALSE      FALSE
_sort_multiblock_read_count                        2                                                                      TRUE     FALSE      FALSE

SYS@LAB1024> -- default values again
SYS@LAB1024> 
SYS@LAB1024> -- let's turn on 10046 trace
SYS@LAB1024> 
SYS@LAB1024> set echo on 
SYS@LAB1024> @find_trace
SYS@LAB1024> col tracefile_name for a120
SYS@LAB1024> SELECT rtrim(k.value,'/')||'/'||LOWER(d.instance_name)||'_ora_'||p.spid
  2  ||DECODE(p.value,'','','_'||p.value)||'.trc' tracefile_name
  3  FROM v$parameter k, v$parameter p, v$instance d,
  4       sys.v_$session s, sys.v_$process p,
  5       (SELECT sid FROM v$mystat WHERE rownum=1) m
  6  WHERE p.name = 'tracefile_identifier'
  7    AND k.name = 'user_dump_dest'
  8    AND s.paddr = p.addr
  9    AND s.sid = m.sid
 10  /

TRACEFILE_NAME
------------------------------------------------------------------------------------------------------------------------
/u01/app/admin/LAB1024/udump/lab1024_ora_24004.trc


SYS@LAB1024> alter session set events '10046 trace name context forever, level 8';

Session altered.

SYS@LAB1024> set echo off
SYS@LAB1024> select avg(pk_col) from kso.skew a where col1 > 0;
select avg(pk_col) from kso.skew a where col1 > 0
                            *
ERROR at line 1:
ORA-01013: user requested cancel of current operation


SYS@LAB1024> -- bombed out with ctl-C 
SYS@LAB1024> -- now find the sql_id and verify the plan
SYS@LAB1024>
SYS@LAB1024> @find_sql
Enter value for sql_text: select avg(pk_col) from kso.skew a where col1 > 0
Enter value for sql_id: 

SQL_ID         CHILD  PLAN_HASH      EXECS     AVG_ETIME      AVG_LIO SQL_TEXT
------------- ------ ---------- ---------- ------------- ------------ ------------------------------------------------------------
05cq2hb1r37tr      0  568322376          1        183.30       35,082 select avg(pk_col) from kso.skew a where col1 > 0


SYS@LAB1024> @dplan
Enter value for sql_id: 05cq2hb1r37tr
Enter value for child_no: 0

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  05cq2hb1r37tr, child number 1
-------------------------------------
select avg(pk_col) from kso.skew a where col1 > 0

Plan hash value: 568322376

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |       |       | 45254 (100)|          |
|   1 |  SORT AGGREGATE    |      |     1 |    11 |            |          |
|*  2 |   TABLE ACCESS FULL| SKEW |    32M|   335M| 45254   (3)| 00:09:04 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("COL1">0)

SYS@LAB1024> -- we can verify that it read 128 blocks at a time by looking at the trace file
SYS@LAB1024>
SYS@LAB1024> !cat /u01/app/admin/LAB1024/udump/lab1024_ora_24004.trc

...

PARSING IN CURSOR #6 len=49 dep=0 uid=0 oct=3 lid=0 tim=1233806813773567 hv=3279003447 ad='7e81b9b4'
select avg(pk_col) from kso.skew a where col1 > 0
END OF STMT
PARSE #6:c=213967,e=209976,p=27,cr=287,cu=0,mis=1,r=0,dep=0,og=2,tim=1233806813773550
EXEC #6:c=0,e=77,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=2,tim=1233806813773842
WAIT #6: nam='SQL*Net message to client' ela= 10 driver id=1650815232 #bytes=1 p3=0 obj#=472 tim=1233806813773941
WAIT #6: nam='db file sequential read' ela= 81 file#=4 block#=181290 blocks=1 obj#=54141 tim=1233806813791873
WAIT #6: nam='db file scattered read' ela= 5218 file#=4 block#=181291 blocks=128 obj#=54141 tim=1233806813800264
WAIT #6: nam='db file scattered read' ela= 3239 file#=4 block#=181419 blocks=128 obj#=54141 tim=1233806814404594

Note 1: Very nice! Maximum i/o without making the optimizer think that full table scans are better than index access paths.

Note 2: Setting the parameter to the default value is not the same as resetting it. If you were to change the value to 16 for example and then set it back to 8 (which was the value it defaulted to) you would see the costing and the execution done with 8. That is, the _db_file_optimizer_read_count and the _db_file_exec_read_count would both be set to 8. You have to unset the DBFMBRC parameter to get it to go back to automatic split of 8 and 128. See my previous post on that here: Resetting Oracle Parameters Here’s another quick demonstration:

SYS@LAB1024> @parms
Enter value for parameter: read_count
Enter value for isset: 
Enter value for show_hidden: Y

NAME                                               VALUE                                                                  ISDEFAUL ISMODIFIED ISSET
-------------------------------------------------- ---------------------------------------------------------------------- -------- ---------- ----------
db_file_multiblock_read_count                      128                                                                    TRUE     FALSE      FALSE
_db_file_exec_read_count                           128                                                                    TRUE     FALSE      FALSE
_db_file_noncontig_mblock_read_count               11                                                                     TRUE     FALSE      FALSE
_db_file_optimizer_read_count                      8                                                                      TRUE     FALSE      FALSE
_sort_multiblock_read_count                        2                                                                      TRUE     FALSE      FALSE

SYS@LAB1024> alter system set db_file_multiblock_read_count=16;

System altered.

SYS@LAB1024> @parms
Enter value for parameter: read_count
Enter value for isset: 
Enter value for show_hidden: Y

NAME                                               VALUE                                                                  ISDEFAUL ISMODIFIED ISSET
-------------------------------------------------- ---------------------------------------------------------------------- -------- ---------- ----------
db_file_multiblock_read_count                      16                                                                     TRUE     TRUE       TRUE
_db_file_exec_read_count                           16                                                                     TRUE     FALSE      FALSE
_db_file_noncontig_mblock_read_count               11                                                                     TRUE     FALSE      FALSE
_db_file_optimizer_read_count                      16                                                                     TRUE     FALSE      FALSE
_sort_multiblock_read_count                        2                                                                      TRUE     FALSE      FALSE

SYS@LAB1024> alter system set db_file_multiblock_read_count=128;

System altered.

SYS@LAB1024> @parms
Enter value for parameter: read_count
Enter value for isset: 
Enter value for show_hidden: Y

NAME                                               VALUE                                                                  ISDEFAUL ISMODIFIED ISSET
-------------------------------------------------- ---------------------------------------------------------------------- -------- ---------- ----------
db_file_multiblock_read_count                      128                                                                    TRUE     TRUE       TRUE
_db_file_exec_read_count                           128                                                                    TRUE     FALSE      FALSE
_db_file_noncontig_mblock_read_count               11                                                                     TRUE     FALSE      FALSE
_db_file_optimizer_read_count                      128                                                                    TRUE     FALSE      FALSE
_sort_multiblock_read_count                        2                                                                      TRUE     FALSE      FALSE

SYS@LAB1024> alter system set db_file_multiblock_read_count=0;

System altered.

SYS@LAB1024> @parms
Enter value for parameter: read_count
Enter value for isset: 
Enter value for show_hidden: Y

NAME                                               VALUE                                                                  ISDEFAUL ISMODIFIED ISSET
-------------------------------------------------- ---------------------------------------------------------------------- -------- ---------- ----------
db_file_multiblock_read_count                      128                                                                    TRUE     FALSE      FALSE
_db_file_exec_read_count                           128                                                                    TRUE     FALSE      FALSE
_db_file_noncontig_mblock_read_count               11                                                                     TRUE     FALSE      FALSE
_db_file_optimizer_read_count                      128                                                                    TRUE     FALSE      FALSE
_sort_multiblock_read_count                        2                                                                      TRUE     FALSE      FALSE

So once you set the value of DBFMBRC, the exec and read parms will be the same.

Note 3: The _db_file_noncontig_mblock_read_count has to do with index block pre-fetching. There is an excellent description on this oracle-l post by Tanel Poder

Note 4: Everything I’ve said so far assumes that System Statistics have not been set or gathered. If System Stats are set, then a completely different set of rules kick in – basically DBFMBRC is ignored.

And speaking of System Stats, I must say that I think the default no-workload System Stats work pretty well. In most cases, I prefer not to gather or set System Statistics, for a couple of reasons:

In the first place, I generally don’t believe in fixing things that aren’t broken. You could argue that System Statistics are not meant to “fix” anything, but are merely designed to give the optimizer more specific information about the particular system. And this is true, but the standard method of gathering Workload System Statistics often results in less than accurate results and at best they only represent an average over some period of time which may or may not be representative of what happens when the system is really under stress. And I guess we could have a few sets of values and change them regularly (like one set for batch processing and one for day time on-line processing), but that seems like a lot of complexity for little potential benefit. So unless there really is a specific problem that needs to be solved, I probably wouldn’t do that (in fact I have not ever done that).

Second, I would venture to guess that the majority of databases out there have not gathered or set System Statistics. I could be way off on that assumption, but most of the systems that I’ve looked at over the last couple of years have not had anything other than the default NOWORKLOAD values. Staying in the middle of the pack means we’re less likely to run into weird behavior that someone else hasn’t already run across.

Third, the interaction between the various flavors of System Statistics and the DBFMBRC are complicated. Randolf Geist has an excellent series of posts which discusses the interaction between System Stats and DFMBRC here: RG on System Stats
But it takes 3 fairly long and detailed posts to cover the topic. I am not going to discuss it here since he has already done a very thorough job.

Fourth, System Statistics is (are) a really big knob. What I mean by that is that a small change can have a profound effect. Since they control the costing of every single statement that runs through your system, changes to them could potentially affect every statement. So from a stability stand point, this is not something that you would want to change without careful thought and certainly not something that you would want to change on a regular basis.

Now for a couple of references:

Jonathan Lewis has several posts on his blog about System Stats. Here are links to a couple:

JL on System Stats
JL on System Stats 2

Be sure and read through the comments as there is some excellent information there including how the default values for the read and exec parameters are arrived at.

Finally, Tom Kyte has a good discussion on the subject here: TK on DBFMBRC

Hotsos Symposium 2010

The best Oracle conference in the universe.

Well this will make 5 years in row that I’ve attended the Hotsos Symposium (this will be my third time as a speaker). As I’ve said before, it’s been far and away the best conference or training event that I’ve ever participated in. Add to that the extremely high quality of the people in attendance and you get an awesome event. There are always a fair number of people in the audience that could be delivering the presentations. One of the best things about it is the impromptu conversations that invariably pop up after (or sometimes during) a presentation.

The 2010 Symposium will be held in Dallas (as usual), March 7-11. Tom Kyte will be giving the key note address. Tom is well known, and rightly so, as he is always thought provoking and entertaining. Tanel Põder will be delivering the optional training day. If you haven’t heard of him yet you should do yourself a favor and check out his blog. There are only a handful of guys in the world that understand Oracle internals as well as Tanel.

I must say I am extremely honored to be able to present again at this years symposium. Here’s a link to the speakers page for this years event which has links to the abstracts for their presentations.  And here’s a link to the main Symposium page where you can find info on how to sign up.

Here’s the list of speakers (in case it’s too much trouble to click the link above):

Alex Gorbachev – Battle Against Any Guess & Run-Time Load Balancing in Oracle RAC
Alex Haralampiev – When a Good Design Goes Bad
Andrew Zitelli – Oracle 11g “Partitioning by Reference” – The Advantages and Annoyances
Bryn Llewellyn – Edition-Based Redefinition: the Key to Online Application Upgrade
Cary Millsap – Lessons Learned – Version 2010.03
Christian Antognini – Diagnosing Parallel Executions Performance
Dan Norris – Consolidation Strategies for Oracle Database Machine
Dave Abercrombie – End-to-End Metrics for Troubleshooting and Monitoring
Doug Burns – Odyssey Two: Parallel Query in 2010
Henry Poras – Diminishing Resource Utilization and Saturation Limits Using AWR History and Queueing Theory
Kerry Osborne – Controlling Execution Plans (without Touching the Code)
Kevin Closson – TBA
Kevin Williams – How We Dealt with the Chronic Problem of Too Much Data on a Large OLTP System
Kyle Hailey – Modern Approaches to SQL Tuning
Marco Gralike – The Ultimate Performance Challenge: How to Make XML Perform.?!
Mark Bobak – A Closer Look at Parsing: Possible Application Optimizations
Monty Orme – TBA
Neil Gunther & Peter Stalder – TBA
Ric Van Dyke – TBA
Richard Foote – Oracle Indexing Myths & Oracle Indexing Tricks and Traps
Richard McDougall – Performance and Sizing of Oracle on VMware
Riyaj Shamsudeen – A Close Encounter with Real World (and Odd) Performance Issues & Why Does Optimizer Hate My SQL?
Stephan Haisley – Streams, Xstreams and Golden Gate
Tanel Põder – TBA
Tom Kyte – All About Metadata; Why Telling the Database About Your Schema Matters
& Efficient PL/SQL — Why and How to Use PL/SQL to Its Greatest Effect
Vlado Barun & Edwin Putkonen – Deploying Database Changes: Performance Matters
Wolfgang Breitling – Anatomy of a SQL Tuning Session & Seeding Statistics

Just as a side note, I got an opportunity to speak at last years Hotsos Symposium. One of the functions at the Symposium is a social gathering which provides a great opportunity to talk to a bunch of really smart guys in a less formal setting. Unfortunately, a few of the participants over indulge at the party. Fortunately, many of them have a room at the host hotel (so no driving). Unfortunately, I ended up speaking at the first session the morning after the party. The audience looked a little like this:

Actually it wasn’t that bad, but I am looking forward to a better time slot this time around!

Hope to see you there!

Tracking Parameter Changes

I was in a meeting yesterday and a guy asked if there was a way to track changes to database parameters (sometimes called init.ora parameters by us old guys). I thought for a second and said I didn’t think there was any sort of built in mechanism for doing that, no history table that I was aware of. Then one of the other guys in the meeting said, “oh yeah, we do that by looking at the AWR table that has the list of non-default parameter settings” (that table is WRH$_PARAMETER by the way).

Hmmm, interesting approach. AWR runs every hour by default. Not a bad idea. They had a script that prompted for a parameter name and did a dump of all entries for the specified parameter. So you could easily see where a change had occurred.

Looks like this:

SYS@LAB1024> @parm_hist 
Enter value for pname: star_transformation_enabled

   SNAP_ID TIME            PARAMETER_NAME                                     VALUE
---------- --------------- -------------------------------------------------- --------------------
      2232 25-SEP-09 00    star_transformation_enabled                        FALSE
      2233 25-SEP-09 01    star_transformation_enabled                        FALSE
      2234 25-SEP-09 02    star_transformation_enabled                        FALSE
      2235 25-SEP-09 03    star_transformation_enabled                        FALSE
      2376 01-OCT-09 00    star_transformation_enabled                        FALSE
      2377 01-OCT-09 01    star_transformation_enabled                        FALSE
      2378 01-OCT-09 02    star_transformation_enabled                        FALSE
      2379 01-OCT-09 03    star_transformation_enabled                        FALSE
      2380 01-OCT-09 04    star_transformation_enabled                        FALSE
      2381 01-OCT-09 05    star_transformation_enabled                        FALSE
      2382 01-OCT-09 06    star_transformation_enabled                        FALSE
      2383 01-OCT-09 07    star_transformation_enabled                        FALSE
      2384 01-OCT-09 08    star_transformation_enabled                        FALSE
      2385 01-OCT-09 09    star_transformation_enabled                        FALSE
      2386 01-OCT-09 10    star_transformation_enabled                        FALSE
      2387 01-OCT-09 11    star_transformation_enabled                        FALSE
      3900 02-DEC-09 23    star_transformation_enabled                        TRUE
      3901 03-DEC-09 00    star_transformation_enabled                        TRUE
      3902 03-DEC-09 01    star_transformation_enabled                        TRUE
      3903 03-DEC-09 02    star_transformation_enabled                        TRUE
      3904 03-DEC-09 03    star_transformation_enabled                        TRUE
      3905 03-DEC-09 04    star_transformation_enabled                        TRUE
      3906 03-DEC-09 05    star_transformation_enabled                        TRUE
      3907 03-DEC-09 06    star_transformation_enabled                        TRUE
...

Of course my first thought was “that’s nice, but most systems only have a few weeks of history in AWR”. I’ll come back to that issue in a minute, but for now let’s go on to the part where my brain started working on ways to make use of this idea and to maybe improve on it a little bit.

To begin with, I didn’t want to see a record for every snapshot if nothing had changed. I would prefer to just see a single record with both the old and new value when there was actually a change. Easy enough to do with the an analytic query using the lag function. I also thought I’d like to be able to wild card the parameter – no problem there. Then I decided I wanted it to be RAC aware and let me specify a single instance (since some of the parameters have different values depending on the instance). And finally, I found the calculated hidden parameters to be annoying (the ones that start with 2 underscores like “__shared_pool_size”). Several of them get reset on a regular basis, and I am not usually all that interested in those. So I added a switch to turn them off (or not). I called the script parm_mods.sql.

Here’s a quick example:


SYS@LAB1024> @parm_mods
Enter value for parameter_name: 
Enter value for instance_number: 
Enter value for show_calculated: 

  INSTANCE    SNAP_ID TIME            PARAMETER_NAME                      OLD_VALUE            NEW_VALUE
---------- ---------- --------------- ----------------------------------- -------------------- --------------------
         1       2376 01-OCT-09 00:00 db_recovery_file_dest_size          26843545600          42949672960
                 3900 02-DEC-09 23:00 db_file_multiblock_read_count       16                   128
                 3900 02-DEC-09 23:00 parallel_execution_message_size     2148                 8192
                 3900 02-DEC-09 23:00 hash_area_size                      131072               200000000
                 3900 02-DEC-09 23:00 large_pool_size                     0                    536870912
                 3900 02-DEC-09 23:00 workarea_size_policy                AUTO                 MANUAL
                 3900 02-DEC-09 23:00 shared_pool_reserved_size           12582912             24326963
                 3900 02-DEC-09 23:00 shared_pool_size                    0                    419430400
                 3900 02-DEC-09 23:00 sort_area_size                      65536                100000000
                 3900 02-DEC-09 23:00 star_transformation_enabled         FALSE                TRUE
                 4085 10-DEC-09 15:02 _spin_count                         2001                 2002




11 rows selected.

SYS@LAB1024> /
Enter value for parameter_name: 
Enter value for instance_number: 
Enter value for show_calculated: Y

  INSTANCE    SNAP_ID TIME            PARAMETER_NAME                      OLD_VALUE            NEW_VALUE
---------- ---------- --------------- ----------------------------------- -------------------- --------------------
         1       2376 01-OCT-09 00:00 __shared_pool_size                  251658240            285212672
                 2376 01-OCT-09 00:00 db_recovery_file_dest_size          26843545600          42949672960
                 2376 01-OCT-09 00:00 __db_cache_size                     1275068416           1241513984
                 3900 02-DEC-09 23:00 db_file_multiblock_read_count       16                   128
                 3900 02-DEC-09 23:00 __shared_pool_size                  285212672            486539264
                 3900 02-DEC-09 23:00 __large_pool_size                   16777216             536870912
                 3900 02-DEC-09 23:00 workarea_size_policy                AUTO                 MANUAL
                 3900 02-DEC-09 23:00 __db_cache_size                     1241513984           520093696
                 3900 02-DEC-09 23:00 hash_area_size                      131072               200000000
                 3900 02-DEC-09 23:00 large_pool_size                     0                    536870912
                 3900 02-DEC-09 23:00 parallel_execution_message_size     2148                 8192
                 3900 02-DEC-09 23:00 shared_pool_reserved_size           12582912             24326963
                 3900 02-DEC-09 23:00 shared_pool_size                    0                    419430400
                 3900 02-DEC-09 23:00 sort_area_size                      65536                100000000
                 3900 02-DEC-09 23:00 star_transformation_enabled         FALSE                TRUE
                 4085 10-DEC-09 15:02 _spin_count                         2001                 2002




16 rows selected.

So back to the issue of AWR retention…

Continue reading ‘Tracking Parameter Changes’ »

Oracle 11gR2 Now Available for Solaris

I just noticed that 11g Release 2 for the Solaris Operating System is now available for download:

Oracle 11g R2 Download Page

It didn’t lag the Linux release by too long!

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)’ »

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’ »