Download ORISNOOP_*.tar.Z

 

Why ORISNOOP?

The empirical 80/20 rule is well known in IT : quite often, 20% of processes account for 80% of activity. With Oracle, you quite often encounter worse cases, for instance 2% of statements accounting for 95% of costs or executions.

The smaller the number of statements involved, the higher the potential gain if you succeed in improving them, even only a little. ORISNOOP can help.

Some statements can put a heavy load on the system because they need to access a huge number of blocks to run, or because they are executed very often, or both. If you succeed in tuning the statements which put the heaviest load on the system, you are sure to improve the overall throughput. However, sometimes some relatively costly but very often executed statements 'hide', as it were, statements which are executed less often but which nonetheless require some tuning. ORISNOOP can help you to identify all of these situations

.

ORISNOOP

 

Oracle and SQL*Net are registered trademarks of Oracle Corporation. All other products or company names are used for identification purposes only, and may be trademarks of their respective owners.

Purpose

ORISNOOP is a utility which identifies the most resource consuming statements running on an Oracle database. It has no pretense to being an 'expert system': it doesn't make any attempt at rewriting statements or suchlike. What it does, is to provide all the information available to pinpoint the, most often surprisingly few, statements which bog down your system, including execution plan, statistics, indexes available and indications about their relevance, hidden costs (such as triggers...) - everything which is required by a reasonably competent SQL programmer to improve performance, often dramatically.

Installing ORISNOOP on your machine

What you download from the Oriole Corporation web-site is a compressed tar file, named ORISNOOP_for_<operating system>.tar.Z

You first have to uncompress it on your machine :

then extract the files from the archive (it will create an ORISNOOP directory under the current directory) :

You must then change directory to ORISNOOP where you will find 6 files :

The free trial version

To use the time limited free trial version you will need a software key which will be issued on request. Please see below under the section 'Buying the license for ORISNOOP' for the information you will need to supply to us.

ORISNOOP operating mode

ORISNOOP has three modes of operation :

  1. it takes a snapshot of all the valid statements currently stored in the SGA, irrespective of how long they have been there. As most statements, even when their execution was very short, stay in the SGA for a long time, this usually gives a fair idea of what happened on the database,
  2. it collects statements for a given period (defined as a parameter), in which case only the statements executed during this period are taken into account for finer tuning,
  3.  

  4. (Oracle 7.3 and above) it takes a snapshot of all the statements currently executing or most recently executed by the current sessions.

The overhead induced by orisnoop when collecting the statements is fairly negligible, however, the analysis which follows is a relatively heavy process (chiefly because all indexes are validated). Both phases can be run separately and on separate databases if one is a copy of the other; note that the data collected is stored in a (local) file which is removed after the analysis.

Running ORISNOOP

You can control how ORISNOOP runs by entering the orisnoop command followed by various arguments; the program has been designed to give it an Oracle utility look-and-feel, which should give it a flavor familiar to any Oracle DBA.

To specify parameters, you use keywords:

Format: orisnoop KEYWORD=value or KEYWORD=(value1,value2,...,valueN)

Example:

Keyword

Description (Default)

Keyword

Description (Default)

USERID

username/password

CURRENT

current sessions only (N)

PARFILE

parameter filename

FILE

data file (orisnoop.dat)

HELP

display this screen (N)

COLLECT

collect the data (Y)

TIMESPAN

duration in mn

ANALYZE

analyze the data (Y)

INTERVAL

mn between probes (AUTO)

EXPLAIN

pct of costs analyzed (80)

SORT

LOAD, COST or EXEC (LOAD)

TOP

max statements analyzed (25)

FEEDBACK

indicate activity (N)

KEEPFILE

keep data after analysis (N)

ORISNOOP parameters

ANALYZE

COLLECT

CURRENT

EXPLAIN

FEEDBACK

FILE

HELP

INTERVAL

KEEPFILE

PARFILE

SORT

TIMESPAN

TOP

USERID

Interpreting the ORISNOOP output

ORISNOOP doesn't provide a magic wand which automatically improves everything but it does identify where performance problems lie - usually a complicated and tedious process in itself.

Summary tables

We can have three cases for a high total cost query :

Elementary cost

Executions

 

High

High

Ideal case ! If you manage to improve the elementary cost, the result will be dramatic.

Very high

Low

Not very good. We could improve the query a lot and it still wouldn't have a major impact in terms of throughput. However, if it concerns a very important process, the improvement may be quite noticeable and, if nothing else, impress the end-user.

Low

Very high

If the elementary cost is very low (5 and under) there is unfortunately not much which can be done (reviewing the algorithms, perhaps). However, updates, inserts and deletes may be improved by eliminating useless indexes (see below). A low to medium cost can however still provide scope for spectacular improvement, as a gain of a few cost units can bring a huge overall boost of performance.

Statement details

For each statement, the text is displayed - note that ORISNOOP automatically recognizes that statements in which only constant values are different are basically the same (although of course specific constant values can yield quite different response times), so the text is rather a sample or pattern -, the execution plan is given, hidden costs (indexes to update/triggers) are shown where appropriate and a bevy of details is given for all tables involved in the statement.

Tables :

Full scan cost : this is the number of blocks used to store the table, so it is, at most, the number of blocks we have to access when doing a full scan (at most because everything which is allocated may, and quite often does not, contain data).

Indexes :

Avg search cost : number of blocks to access when we select with a condition such as WHERE KEY=value, where KEY is the indexed column (one or several of course). Usually there are 2 or 3 blocks accessed to go down the index (a tree), and then there is a number of accesses to the data blocks in the table which contains values which match the key. If the index is very selective (a unique index is of course the most selective) very few lines in the table match the key and therefore you will have to access one, or perhaps two, data blocks to return all you need. On the other hand, if the index is not selective at all (such as an index on two values which both occur roughly equally) using the index will mean accessing all the blocks in the table (as a block usually contains several rows, you will find lines containing all possible values), usually several times each (there is no reason why lines in the same data block should have their addresses clustered together in the index), plus the additional (admittedly relatively minor) cost of accessing the index itself. Quite often, people who do tuning are quite obsessed by full scans and try to suppress all of them.

In fact, it is quite common that the full scan cost is less than the average index search cost (experiments show that the limit is around 7 different key values - under this, full scan always costs less). This is why, when an index is not unique, there is the 'one key value = n% of rows on average' to see whether the index is really useful (up to 10% it is OK, but the bigger the table, the lower the limit).

However, distribution may blur the picture, since if some often queried values match a very limited number of lines, although on the face of it and on average the index would seem to be totally uninteresting, it can be in practice very efficient because the values are unevenly distributed. Hence the distribution table, which gives you 'key%' and '% of rows matched'. If you have key values which match a very small percentage of the rows, the index may be useful - if most WHERE clauses actually refer to these key values.

General guidelines :

The idea is to give you a complete picture of what exists and to compare it with what is used. If indexes are inefficient and unused, drop them : it will speed up inserts, updates and deletes. If they are efficient and unused, try an alternative way to write the query and possibly try using 'Hints' (refer to Oracle specific tuning documentation)

It is quite difficult to say here what does and what doesn't work, it's mainly trial and error.
Things to watch for :

etc.

Buying the license for ORISNOOP

To run the fully functional orisnoop, you need to buy a license from Oriole Corporation; orisnoop is protected by a software key (a string of digits and letters) which will be forwarded to you on receipt of your payment. As this key depends on the machine on which you will run orisnoop, you must provide Oriole Corporation with:

Once you have received your software key, you just have to set the environment variable ORISNOOP_KEY to this value, by a command such as :

or

This is best done in a command file which is run when you log on, such as .profile, .login or .cshrc, depending on your environment. Once the environment variable is set, you can enjoy orisnoop in all its glory.

 

Download ORISNOOP_*.tar.Z