V$undostat

hi,
Good day.
DB version is 10.2.0.4
SQL> select MAX(maxquerylen) from v$undostat;
MAX(MAXQUERYLEN)
           59389
1 row selected.
SQL> show parameter undo_retention
NAME                                 TYPE                           VALUE
undo_retention                       integer                        48000Do i have to increase the undo_retention parameter to MAX(maxquerylen)..?!
thanks,
baskar.l

Do you think you might have found a symptom of some unknown problem, so now you are trying to determine if your observation reflects reality?
I suggest that you assume all is OK when Oracle does not present to you any error code or message.
Edited by: sb92075 on Feb 2, 2010 6:12 PM

Similar Messages

  • V$undostat and maxqueryid

    Hi,
    Using Oracle 11.1.0.7 one of our customers had space problems with UNDO tablespace. We tried to get an overview of whats going on using v$undostat.
    One of the columns is MAXQUERYID and join to v$sqlarea we tried to pinpoint longrunning sql. But even on heavy used production system (or low used testsystems) we always see one statement: select 1 from obj$ where name = 'DBA_QUEUE_SCEDULES'
    Anyone knows why we always get this and/or maybe what it is? It is not running slow if tried in sqlplus, so we think we miss a point here!
    Best
    Jens

    MAXQUERYID SQL identifier of the longest running SQL statement in the period
    as shown in the following link
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2174.htm#i1422075
    but does not identify (necessarily) that this SQL statement uses UNDO.
    MAXQUERYID (in combination with MAXQUERYLEN) if anything you need to estimate correctly the UNDO_RETENTION.
    To get an idea about undo_retention and sizing of UNDO tablespace try looking here
    http://www.oracle.com/technology/oramag/code/tips2004/032904.html
    best regards
    Donatello Settembrino

  • V$UNDOSTAT - contains less than 1008 rows and last DB restart in 12/2007

    Hi all,
    Our version is single instance Oracle 9.2.0.7.0 on AIX 5.3:
    On our productive system (Datawarehouse with heavy data loads) the V$UNDOSTAT view contains not all rows for a 7-days cycle. When I step into the view there are less rows in it
    (about 20- 50 or so).
    On the other hand in our development system (separate server ,same OS, database) I can find all rows for the week. The only difference :-) seems to be the workload on the two different systems.
    Can you give me a clue?
    bb
    Message was edited by:
    berndboecker

    Hi Kim,
    the last instance start was on Dec. 15th, last year - so it has to contain 1008 rows.
    I agree with you: I can think of only for a restart that the cycle starts again.
    But this doesn't happen. But for some reason it cleans out the rows.
    I can see this occuring several times per day.Let's say I query
    Select count(*) from v$undostat
    time t1: count(*) 10 " we had already some intervals in it, but not 1008 :-(
    time t2 + 10 minutes count(*) 11 " fine
    time t3 + 10 minutes count(*) 12 " fine
    **** let's wait for an hour
    time t9 + 10 minutes count(*) 8 "oops, we lost some rows again
    In the Alert log I can see that the database did the usually checkpoints and archives
    at that time.
    The only implication I can think of is that the undo statistics are not really usefull for calculating a new undo retention time based on the workload in V$UNDOSTAT (you can get accurate values in the 7 days cycle but not with only some rows.

  • V$UNDOSTAT BEGIN)TIME GREATER THAN SYSDATE

    I have 18 rows in V$UNDOSTAT with begin_time greater than sysdate.
    what could have caused that?
    I noticed this anomaly when i was looking for some undo information.
    All that has happened recently is, I have restored the db (9.2.0.1 on REHL 3)
    on a different server as the original server had a bad disk (RAID5 rebuild was taking too long). So i shutdown the db and copied all files from the last cold backup to the new server(same config)and restored all the archlogs. Everything has been going fine since than.
    Would a db bounce reset the date anoamly??
    Any ideas !!!
    Thankyou

    Hello,
    Yes you are right, the MAXQUERYLEN of the query *60mwzy51cs6sx* is very high (213380 seconde = 2,5 day) :
    07-21-2010 16:48:2010 213380 60mwzy51cs6sx
    07-21-2010 20:07:2010 225213 60mwzy51cs6sxAnd more over, it seems that the same query repeat several time and the MAXQUERYLEN is higher and higher.
    You may get the offending query as follow:
    Select sql_text from v$sqltext where sql_id = '60mwzy51cs6sx'  /* MAXQUERYID value */It seems that the MAXQUERYLEN is never resetted for this query.
    If you are sure that this query is not still running for almost 3 days so, I don't know why there's this kind of behaviour and, if I were you, I'll ask to the support.
    Best regards,
    Jean-Valentin

  • V$undostat, maxquerylen varies during the intervals

    Hi,
    Oracle 10.2.0.4 with undo_retention=900 and no guarantee.
    I have been staring at this all day. I noticed that our current undo recommendation on one of our production databases was telling us the undo tablespace needs to be 2 times larger (+250GB). I got a little concerned because just last week the recommendation was well below half of that. Looking at v$undostat, I noticed where the problem must be. The maxquerylen is saying that there is a sql statement that ran on 7/19/2010 that v$undostat still, apparently, thinks that the query is active I guess. The job related to the query finished successfully in less than 40 minutes on the day it ran(on 7/19).
    So, to be clear... there is no active transaction, even now, that is more than 500 seconds old.
    Anybody have any clue as to why/how the maxquerylen would jump up and down as shown below?
    TO_CHAR(END_TIME,'MM- MAXQUERYLEN MAXQUERYID
    07-21-2010 16:38:2010 1839 9xvq4g6100pdy
    07-21-2010 16:48:2010 213380 60mwzy51cs6sx
    07-21-2010 16:58:2010 213987 60mwzy51cs6sx
    07-21-2010 17:08:2010 164 cbq154rd1rag1
    07-21-2010 17:18:2010 770 cbq154rd1rag1
    07-21-2010 17:28:2010 215807 60mwzy51cs6sx
    07-21-2010 17:38:2010 216414 60mwzy51cs6sx
    07-21-2010 17:48:2010 497 cbq154rd1rag1
    07-21-2010 17:58:2010 217627 60mwzy51cs6sx
    07-21-2010 18:08:2010 218233 60mwzy51cs6sx
    07-21-2010 18:18:2010 218842 60mwzy51cs6sx
    07-21-2010 18:28:2010 219448 60mwzy51cs6sx
    07-21-2010 18:38:2010 220055 60mwzy51cs6sx
    07-21-2010 18:48:2010 220662 60mwzy51cs6sx
    07-21-2010 18:58:2010 221269 60mwzy51cs6sx
    07-21-2010 19:08:2010 221876 60mwzy51cs6sx
    07-21-2010 19:18:2010 1003 ck24v2bkkru13
    07-21-2010 19:28:2010 1611 ck24v2bkkru13
    07-21-2010 19:38:2010 2217 ck24v2bkkru13
    07-21-2010 19:48:2010 2824 ck24v2bkkru13
    07-21-2010 19:58:2010 416 g9b1yvbnj8qbv
    07-21-2010 20:07:2010 225213 60mwzy51cs6sx
    Thanks!!

    Hello,
    Yes you are right, the MAXQUERYLEN of the query *60mwzy51cs6sx* is very high (213380 seconde = 2,5 day) :
    07-21-2010 16:48:2010 213380 60mwzy51cs6sx
    07-21-2010 20:07:2010 225213 60mwzy51cs6sxAnd more over, it seems that the same query repeat several time and the MAXQUERYLEN is higher and higher.
    You may get the offending query as follow:
    Select sql_text from v$sqltext where sql_id = '60mwzy51cs6sx'  /* MAXQUERYID value */It seems that the MAXQUERYLEN is never resetted for this query.
    If you are sure that this query is not still running for almost 3 days so, I don't know why there's this kind of behaviour and, if I were you, I'll ask to the support.
    Best regards,
    Jean-Valentin

  • Need help understanding a column in v$undostat

    Version: 9.2.0.4.0, Solaris
    Undo type: AUTO
    Undo size: 600 MB
    UNDO_RETENTION = 900 (15 min)
    When I do
    select * from v$undostat
    Column name: NOSPACEERRCNT
    The thing I don’t understand is that: when I get non-zero rows for that column does it mean that users got error since No Free undo space available?
    Issue is NO development users (of DB) complained with any error when the NOSPACEERRCNT had non-zero value?
    --- Oracle notes ---
    NOSPACEERRCNT (NUMBER)
    Identifies the number of times space was requested in the undo tablespace and there was no free space available. That is, all of the space in the undo tablespace was in use by active transactions. The corrective action is to add more space to the undo tablespace.

    Can we ignore that no space errors ? The application code should not because this error means involved queries got some ORA-XXXX errors and have been rolled back and normally the application code should have either retried to run the queries or rolled back the corresponding transactions.
    What this is ssolderrcnt,nospaceerrcnt columns means ?See the SQL Reference.
    Message was edited by:
    Pierre Forstmann

  • ORA-01555 and v$undostat

    <p>
    Hi,
    My application was getting ORA-01555 (this is confirmed in alert.log).
    When I query <strong>v$undostat </strong>for the involved period:
    </p>
    <blockquote>
    <p>
         select UnxpStealCnt, UnxpBlkRelCnt, UnxpBlkReuCnt, ExpStealCnt, ExpBlkRelCnt, ExpBlkReuCnt, NoSpaceErrCnt
         from v$undostat where SSoldErrCnt != 0
    </p>
    </blockquote>
    <p>
    I do not understand why all theses columns have a zero value.
    I was expecting to have at least 1 in ExpBlkReuCnt or in ExpStealCnt.
    How is it possible to have (because I have) ORA-01555 without any value in thoses columns ?
    Thanks for your bright explanations,
    Leo.
    </p>
    Edited by: Leo Anderson on 24 oct. 2008 10:28

    Leo Anderson wrote:
    During the "fatal" period, the MaxQueryLen = 6000 and the Tuned_UndoRetention = 6800
    All columns UnxpStealCnt, UnxpBlkRelCnt, UnxpBlkReuCnt, ExpStealCnt, ExpBlkRelCnt, ExpBlkReuCnt, NoSpaceErrCnt has zero value
    So, I presume increasing undo_retention parameter will have no effect ?
    But why no columns has non-zero value ? (in particular ExpBlkReuCnt)
    EDIT : The datafile underlying my UNDOTBS is autoextensible, and bytes/maxbytes is about 32% so it could still grow
    In this case I would assume that you might suffer from an ORA-01555 due to "delayed block cleanout". This errors occurs if delayed block cleanout is being performed, the transaction slot has been overwritten and some other conditions apply. For a very good explanation under what circumstances this could happen, read MetaLink note 45895.1 (although the note applies to manual rollback segment management the explanation of the "delayed block cleanout" case still applies to automatic undo management, but the solutions mentioned there do not)
    You can check if your query generates a lot of redo (and you can make sure that this redo is not generated by some other DML of the same session) then it performs "delayed block cleanout".
    The best solution to prevent this from happening is to attempt to generate "clean" blocks right from the start, e.g. by using direct-path inserts (APPEND hint) or Create Table As Select (CTAS). This way you prevent the "delayed block cleanout" from happening.
    Other means are performing full table scans on the modified object, e.g. by gathering statistics using DBMS_STATS or explicitly running a query on the object using a full table scan right after large modifications.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Package.......StatsPack...Error..

    Hi.. i m tuning my Oracle Database, for that i need to install Statspack package, when i compiled package... it returned following error.
    Warning: Package Body created with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY STATSPACK:
    LINE/COL ERROR
    2045/3 PLS-00201: identifier 'SYS.DBMS_SHARED_POOL' must be declared
    2045/3 PL/SQL: Statement ignored
    HOw to solve above error..Please check the following Package, and do help me.
    Note: I m connected perfstat user, no as SYS user.
    create or replace package body STATSPACK as
    /* Define package variables.
    Variables prefixed with p_ are package variables.
    p_snap_id integer; /* snapshot id */
    p_instance_number number; /* instance number */
    p_instance_name varchar2(16); /* instance name */
    p_startup_time date; /* instance startup time */
    p_parallel varchar2(3); /* parallel server */
    p_version varchar2(17); /* Oracle release */
    p_dbid number; /* database id */
    p_host_name varchar2(64); /* host instance is on */
    p_name varchar2(9); /* database name */
    p_new_sga integer; /* Instance bounced since last snap? */
    tmp_int integer; /* initialise defaults */
    p_def_snap_level number default 5; /* default snapshot lvl */
    p_def_session_id number default 0; /* default session id */
    p_def_ucomment varchar2(160) default null;
    p_def_pin_statspack varchar2(10) default 'TRUE';
    p_def_last_modified date default SYSDATE;
    /* Below are the default threshold (_th) values for choosing SQL statements
    to store in the stats$sqlsummary table - these statements will typically
    be the statements using the most resources.
    p_def_num_sql number default 50; /* Num. SQL statements */
    p_def_executions_th number default 100; /* Num. executions */
    p_def_parse_calls_th number default 1000; /* Num. parse calls */
    p_def_disk_reads_th number default 1000; /* Num. disk reads */
    p_def_buffer_gets_th number default 10000; /* Num. buf gets */
    p_def_sharable_mem_th number default 1048576; /* Sharable memory */
    p_def_version_count_th number default 20; /* Child Cursors */
    p_def_all_init varchar2(10) default 'FALSE';
    cursor get_instance is
    select instance_number, instance_name
    , startup_time, parallel, version
    , host_name
    from v$instance;
    cursor get_db is
    select dbid, name
    from v$database;
    procedure SNAP
    (i_snap_level in number default null
    ,i_session_id in number default null
    ,i_ucomment in varchar2 default null
    ,i_num_sql in number default null
    ,i_executions_th in number default null
    ,i_parse_calls_th in number default null
    ,i_disk_reads_th in number default null
    ,i_buffer_gets_th in number default null
    ,i_sharable_mem_th in number default null
    ,i_version_count_th in number default null
    ,i_all_init in varchar2 default null
    ,i_pin_statspack in varchar2 default null
    ,i_modify_parameter in varchar2 default 'FALSE'
    is
    /* Takes a snapshot by calling the SNAP function, and discards
    the snapshot id. This is useful when automating taking
    snapshots from dbms_job
    l_snap_id number;
    begin
    l_snap_id := statspack.snap ( i_snap_level, i_session_id, i_ucomment
    , i_num_sql
    , i_executions_th
    , i_parse_calls_th
    , i_disk_reads_th
    , i_buffer_gets_th
    , i_sharable_mem_th
    , i_version_count_th
    , i_all_init
    , i_pin_statspack
    , i_modify_parameter);
    end SNAP;
    procedure MODIFY_STATSPACK_PARAMETER
    ( i_dbid in number default null
    , i_instance_number in number default null
    , i_snap_level in number default null
    , i_session_id in number default null
    , i_ucomment in varchar2 default null
    , i_num_sql in number default null
    , i_executions_th in number default null
    , i_parse_calls_th in number default null
    , i_disk_reads_th in number default null
    , i_buffer_gets_th in number default null
    , i_sharable_mem_th in number default null
    , i_version_count_th in number default null
    , i_all_init in varchar2 default null
    , i_pin_statspack in varchar2 default null
    , i_modify_parameter in varchar2 default 'TRUE'
    is
    /* Calls QAM with the modify flag, and discards the
    output variables
    l_snap_level number;
    l_session_id number;
    l_ucomment varchar2(160);
    l_num_sql number;
    l_executions_th number;
    l_parse_calls_th number;
    l_disk_reads_th number;
    l_buffer_gets_th number;
    l_sharable_mem_th number;
    l_version_count_th number;
    l_all_init varchar2(5);
    l_pin_statspack varchar2(10);
    begin
    statspack.qam_statspack_parameter( i_dbid
    , i_instance_number
    , i_snap_level
    , i_session_id
    , i_ucomment
    , i_num_sql
    , i_executions_th
    , i_parse_calls_th
    , i_disk_reads_th
    , i_buffer_gets_th
    , i_sharable_mem_th
    , i_version_count_th
    , i_all_init
    , i_pin_statspack
    , 'TRUE'
    , l_snap_level
    , l_session_id
    , l_ucomment
    , l_num_sql
    , l_executions_th
    , l_parse_calls_th
    , l_disk_reads_th
    , l_buffer_gets_th
    , l_sharable_mem_th
    , l_version_count_th
    , l_all_init
    , l_pin_statspack);
    /* As we have explicity been requested to change the parameters,
    independently of taking a snapshot, commit
    commit;
    end MODIFY_STATSPACK_PARAMETER;
    procedure QAM_STATSPACK_PARAMETER
    ( i_dbid in number default null
    , i_instance_number in number default null
    , i_snap_level in number default null
    , i_session_id in number default null
    , i_ucomment in varchar2 default null
    , i_num_sql in number default null
    , i_executions_th in number default null
    , i_parse_calls_th in number default null
    , i_disk_reads_th in number default null
    , i_buffer_gets_th in number default null
    , i_sharable_mem_th in number default null
    , i_version_count_th in number default null
    , i_all_init in varchar2 default null
    , i_pin_statspack in varchar2 default null
    , i_modify_parameter in varchar2 default 'FALSE'
    , o_snap_level out number
    , o_session_id out number
    , o_ucomment out varchar2
    , o_num_sql out number
    , o_executions_th out number
    , o_parse_calls_th out number
    , o_disk_reads_th out number
    , o_buffer_gets_th out number
    , o_sharable_mem_th out number
    , o_version_count_th out number
    , o_all_init out varchar2
    , o_pin_statspack out varchar2
    is
    /* Query And Modify statspack parameter procedure, allows query
    and/or user modification of the statistics collection parameters
    for an instance. If there are no pre-existing parameters for
    an instance, insert the Oracle defaults.
    l_instance_number number;
    l_dbid number;
    ui_all_init varchar2(5);
    l_params_exist varchar2(1);
    begin
    if ((i_dbid is null ) or (i_instance_number is null)) then
    l_dbid := p_dbid;
    l_instance_number := p_instance_number;
    else
    l_dbid := i_dbid;
    l_instance_number := i_instance_number;
    end if;
    /* Upper case any input vars which are inserted */
    ui_all_init := upper(i_all_init);
    if ( (i_modify_parameter is null)
    or (upper(i_modify_parameter) = 'FALSE') ) then
    /* Query values, if none exist, insert the defaults tempered
    with variables supplied */
    begin
    select nvl(i_session_id, session_id)
    , nvl(i_snap_level, snap_level)
    , nvl(i_ucomment, ucomment)
    , nvl(i_num_sql, num_sql)
    , nvl(i_executions_th, executions_th)
    , nvl(i_parse_calls_th, parse_calls_th)
    , nvl(i_disk_reads_th, disk_reads_th)
    , nvl(i_buffer_gets_th, buffer_gets_th)
    , nvl(i_sharable_mem_th, sharable_mem_th)
    , nvl(i_version_count_th, version_count_th)
    , nvl(ui_all_init, all_init)
    , nvl(i_pin_statspack, pin_statspack)
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack
    from stats$statspack_parameter
    where instance_number = l_instance_number
    and dbid = l_dbid;
    exception
    when NO_DATA_FOUND then
    insert into stats$statspack_parameter
    ( dbid
    , instance_number
    , session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    , last_modified
    values
    ( l_dbid
    , l_instance_number
    , p_def_session_id
    , p_def_snap_level
    , p_def_ucomment
    , p_def_num_sql
    , p_def_executions_th
    , p_def_parse_calls_th
    , p_def_disk_reads_th
    , p_def_buffer_gets_th
    , p_def_sharable_mem_th
    , p_def_version_count_th
    , p_def_all_init
    , p_def_pin_statspack
    , SYSDATE
    returning nvl(i_session_id, p_def_session_id)
    , nvl(i_snap_level, p_def_snap_level)
    , nvl(i_ucomment, p_def_ucomment)
    , nvl(i_num_sql, p_def_num_sql)
    , nvl(i_executions_th, p_def_executions_th)
    , nvl(i_parse_calls_th, p_def_parse_calls_th)
    , nvl(i_disk_reads_th, p_def_disk_reads_th)
    , nvl(i_buffer_gets_th, p_def_buffer_gets_th)
    , nvl(i_sharable_mem_th, p_def_sharable_mem_th)
    , nvl(i_version_count_th, p_def_version_count_th)
    , nvl(ui_all_init, p_def_all_init)
    , nvl(i_pin_statspack, p_def_pin_statspack)
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack;
    end; /* don't modify parameter values */
    elsif upper(i_modify_parameter) = 'TRUE' then
    /* modify values, if none exist, insert the defaults tempered
    with the variables supplied */
    begin
    update stats$statspack_parameter
    set session_id = nvl(i_session_id, session_id)
    , snap_level = nvl(i_snap_level, snap_level)
    , ucomment = nvl(i_ucomment, ucomment)
    , num_sql = nvl(i_num_sql, num_sql)
    , executions_th = nvl(i_executions_th, executions_th)
    , parse_calls_th = nvl(i_parse_calls_th, parse_calls_th)
    , disk_reads_th = nvl(i_disk_reads_th, disk_reads_th)
    , buffer_gets_th = nvl(i_buffer_gets_th, buffer_gets_th)
    , sharable_mem_th = nvl(i_sharable_mem_th, sharable_mem_th)
    , version_count_th = nvl(i_version_count_th, version_count_th)
    , all_init = nvl(ui_all_init, all_init)
    , pin_statspack = nvl(i_pin_statspack, pin_statspack)
    where instance_number = l_instance_number
    and dbid = l_dbid
    returning session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack;
    if SQL%ROWCOUNT = 0 then
    insert into stats$statspack_parameter
    ( dbid
    , instance_number
    , session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    , last_modified
    values
    ( l_dbid
    , l_instance_number
    , nvl(i_session_id, p_def_session_id)
    , nvl(i_snap_level, p_def_snap_level)
    , nvl(i_ucomment, p_def_ucomment)
    , nvl(i_num_sql, p_def_num_sql)
    , nvl(i_executions_th, p_def_executions_th)
    , nvl(i_parse_calls_th, p_def_parse_calls_th)
    , nvl(i_disk_reads_th, p_def_disk_reads_th)
    , nvl(i_buffer_gets_th, p_def_buffer_gets_th)
    , nvl(i_sharable_mem_th, p_def_sharable_mem_th)
    , nvl(i_version_count_th, p_def_version_count_th)
    , nvl(ui_all_init, p_def_all_init)
    , nvl(i_pin_statspack, p_def_pin_statspack)
    , SYSDATE
    returning session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack;
    end if;
    end; /* modify values */
    else
    /* error */
    raise_application_error
    (-20100,'QAM_STATSPACK_PARAMETER i_modify_parameter value is invalid');
    end if; /* modify */
    end QAM_STATSPACK_PARAMETER;
    procedure STAT_CHANGES
    /* Returns a set of differences of the values from corresponding pairs
    of rows in STATS$SYSSTAT, STATS$LIBRARYCACHE and STATS$WAITSTAT,
    based on the begin and end (bid, eid) snapshot id's specified.
    This procedure is the only call to STATSPACK made by the statsrep
    report.
    Modified to include multi-db support.
    ( bid IN number
    , eid IN number
    , db_ident IN number
    , inst_num IN number
    , parallel IN varchar2
    , lhtr OUT number, bfwt OUT number
    , tran OUT number, chng OUT number
    , ucal OUT number, urol OUT number
    , rsiz OUT number
    , phyr OUT number, phyrd OUT number
    , phyrdl OUT number
    , phyw OUT number, ucom OUT number
    , prse OUT number, hprse OUT number
    , recr OUT number, gets OUT number
    , rlsr OUT number, rent OUT number
    , srtm OUT number, srtd OUT number
    , srtr OUT number, strn OUT number
    , lhr OUT number, bc OUT varchar2
    , sp OUT varchar2, lb OUT varchar2
    , bs OUT varchar2, twt OUT number
    , logc OUT number, prscpu OUT number
    , tcpu OUT number, exe OUT number
    , prsela OUT number
    , bspm OUT number, espm OUT number
    , bfrm OUT number, efrm OUT number
    , blog OUT number, elog OUT number
    , bocur OUT number, eocur OUT number
    , dmsd OUT number, dmfc OUT number -- begin OPS
    , dfcms OUT number, dfcmr OUT number
    , dmsi OUT number, dmrv OUT number
    , dynal OUT number, dynares OUT number
    , pmrv OUT number, pmpt OUT number
    , npmrv OUT number, npmpt OUT number
    , scma OUT number, scml OUT number
    , pinc OUT number, picrnc OUT number
    , picc OUT number, picrcc OUT number
    , pbc OUT number, pbcrc OUT number
    , pcba OUT number, pccrba OUT number
    , pcrbpi OUT number
    , dynapres OUT number, dynapshl OUT number
    , prcma OUT number, prcml OUT number
    , pwrm OUT number, pfpim OUT number
    , pwnm OUT number
    , dpms OUT number, dnpms OUT number
    , glsg OUT number, glag OUT number
    , glgt OUT number, glsc OUT number
    , glac OUT number, glct OUT number
    , glrl OUT number
    , gcge OUT number, gcgt OUT number
    , gccv OUT number, gcct OUT number
    , gccrrv OUT number, gccrrt OUT number
    , gccurv OUT number, gccurt OUT number
    , gccrsv OUT number
    , gccrbt OUT number, gccrft OUT number
    , gccrst OUT number, gccusv OUT number
    , gccupt OUT number, gccuft OUT number
    , gccust OUT number -- end OPS
    ) is
    bval number;
    eval number;
    l_b_session_id number; /* begin session id */
    l_b_serial# number; /* begin serial# */
    l_e_session_id number; /* end session id */
    l_e_serial# number; /* end serial# */
    function LIBRARYCACHE_HITRATIO RETURN number is
    /* Returns Library cache hit ratio for the begin and end (bid, eid)
    snapshot id's specified
    cursor LH (i_snap_id number) is
    select sum(pins), sum(pinhits)
    from stats$librarycache
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num;
    bpsum number;
    bhsum number;
    epsum number;
    ehsum number;
    begin
    if not LH%ISOPEN then open LH (bid); end if;
    fetch LH into bpsum, bhsum;
    if LH%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for stats$librarycache');
    end if; close LH;
    if not LH%ISOPEN then open LH (eid); end if;
    fetch LH into epsum, ehsum;
    if LH%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for stats$librarycache');
    end if; close LH;
    return (ehsum - bhsum) / (epsum - bpsum);
    end LIBRARYCACHE_HITRATIO;
    function GET_PARAM (i_name varchar2) RETURN varchar2 is
    /* Returns the value for the init.ora parameter for the snapshot
    specified.
    cursor PARAMETER is
    select value
    from stats$parameter
    where snap_id = eid
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    par_value varchar2(512);
    begin
    if not PARAMETER%ISOPEN then open PARAMETER; end if;
    fetch PARAMETER into par_value;
    if PARAMETER%NOTFOUND then
    raise_application_error
    (-20100,'Missing Init.ora parameter '|| i_name);
    end if; close PARAMETER;
    return par_value;
    end GET_PARAM;
    function GET_SYSSTAT (i_name varchar2, i_beid number) RETURN number is
    /* Returns the value for the System Statistic for the snapshot
    specified.
    cursor SYSSTAT is
    select value
    from stats$sysstat
    where snap_id = i_beid
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    stat_value varchar2(512);
    begin
    if not SYSSTAT%ISOPEN then open SYSSTAT; end if;
    fetch SYSSTAT into stat_value;
    if SYSSTAT%NOTFOUND then
    raise_application_error
    (-20100,'Missing System Statistic '|| i_name);
    end if; close SYSSTAT;
    return stat_value;
    end GET_SYSSTAT;
    function BUFFER_WAITS RETURN number is
    /* Returns the total number of waits for all buffers in the interval
    specified by the begin and end snapshot id's (bid, eid)
    cursor BW (i_snap_id number) is
    select sum(wait_count)
    from stats$waitstat
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num;
    bbwsum number; ebwsum number;
    begin
    if not BW%ISOPEN then open BW (bid); end if;
    fetch BW into bbwsum;
    if BW%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for stats$waitstat');
    end if; close BW;
    if not BW%ISOPEN then open BW (eid); end if;
    fetch BW into ebwsum;
    if BW%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for stats$waitstat');
    end if; close BW;
    return ebwsum - bbwsum;
    end BUFFER_WAITS;
    function TOTAL_EVENT_TIME RETURN number is
    /* Returns the total amount of time waited for events for
    the interval specified by the begin and end snapshot id's
    (bid, eid) by foreground processes. This excludes idle
    wait events.
    cursor WAITS (i_snap_id number) is
    select sum(time_waited_micro)
    from stats$system_event
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num
    and event not in (select event from stats$idle_event);
    bwaittime number;
    ewaittime number;
    begin
    if not WAITS%ISOPEN then open WAITS (bid); end if;
    fetch WAITS into bwaittime;
    if WAITS%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for stats$system_event');
    end if; close WAITS;
    if not WAITS%ISOPEN then open WAITS (eid); end if;
    fetch WAITS into ewaittime;
    if WAITS%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for stats$system_event');
    end if; close WAITS;
    return ewaittime - bwaittime;
    end TOTAL_EVENT_TIME;
    function LATCH_HITRATIO return NUMBER is
    /* Returns the latch hit ratio specified by the begin and
    end snapshot id's (bid, eid)
    cursor GETS_MISSES (i_snap_id number) is
    select sum(gets), sum(misses)
    from stats$latch
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num;
    blget number; -- beginning latch gets
    blmis number; -- beginning latch misses
    elget number; -- end latch gets
    elmis number; -- end latch misses
    begin
    if not GETS_MISSES%ISOPEN then open GETS_MISSES (bid); end if;
    fetch GETS_MISSES into blget, blmis;
    if GETS_MISSES%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for STATS$LATCH gets and misses');
    end if; close GETS_MISSES;
    if not GETS_MISSES%ISOPEN then open GETS_MISSES (eid); end if;
    fetch GETS_MISSES into elget, elmis;
    if GETS_MISSES%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for STATS$LATCH gets and misses');
    end if; close GETS_MISSES;
    return ( ( elmis - blmis ) / ( elget - blget ) );
    end LATCH_HITRATIO;
    function SGASTAT (i_name varchar2, i_beid number) RETURN number is
    /* Returns the bytes used by i_name in the shared pool
    for the begin or end snapshot (bid, eid) specified
    cursor bytes_used is
    select bytes
    from stats$sgastat
    where snap_id = i_beid
    and dbid = db_ident
    and instance_number = inst_num
    and pool in ('shared pool', 'all pools')
    and name = i_name;
    total_bytes number;
    begin
    if i_name = 'total_shared_pool' then
    select sum(bytes)
    into total_bytes
    from stats$sgastat
    where snap_id = i_beid
    and dbid = db_ident
    and instance_number = inst_num
    and pool in ('shared pool','all pools');
    else
    open bytes_used; fetch bytes_used into total_bytes;
    if bytes_used%notfound then
    raise_application_error
    (-20100,'Missing value for SGASTAT: '||i_name);
    end if;
    close bytes_used;
    end if;
    return total_bytes;
    end SGASTAT;
    function SYSDIF (i_name varchar2) RETURN number is
    /* Returns the difference between statistics for the statistic
    name specified for the interval between the begin and end
    snapshot id's (bid, eid)
    cursor SY (i_snap_id number) is
    select value
    from stats$sysstat
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    begin
    /* Get start value */
    open SY (bid); fetch SY into bval;
    if SY%notfound then
    raise_application_error
    (-20100,'Missing start value for statistic: '||i_name);
    end if; close SY;
    /* Get end value */
    open SY (eid); fetch SY into eval;
    if SY%notfound then
    raise_application_error
    (-20100,'Missing end value for statistic: '||i_name);
    end if; close SY;
    /* Return difference */
    return eval - bval;
    end SYSDIF;
    function SESDIF (st_name varchar2) RETURN number is
    /* Returns the difference between statistics values for the
    statistic name specified for the interval between the begin and end
    snapshot id's (bid, eid), for the session monitored for that
    snapshot
    cursor SE (i_snap_id number) is
    select ses.value
    from stats$sysstat sys
    , stats$sesstat ses
    where sys.snap_id = i_snap_id
    and ses.snap_id = i_snap_id
    and ses.dbid = db_ident
    and sys.dbid = db_ident
    and ses.instance_number = inst_num
    and sys.instance_number = inst_num
    and ses.statistic# = sys.statistic#
    and sys.name = st_name;
    begin
    /* Get start value */
    open SE (bid); fetch SE into bval;
    if SE%notfound then
    eval :=0;
    end if; close SE;
    /* Get end value */
    open SE (eid); fetch SE into eval;
    if SE%notfound then
    eval :=0;
    end if; close SE;
    /* Return difference */
    return eval - bval;
    end SESDIF;
    function DLMDIF (i_name varchar2) RETURN number is
    /* Returns the difference between statistics for the statistic
    name specified for the interval between the begin and end
    snapshot id's (bid, eid)
    cursor DLM (i_snap_id number) is
    select value
    from stats$dlm_misc
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    begin
    /* Get start value */
    open DLM (bid); fetch DLM into bval;
    if DLM%notfound then
    raise_application_error
    (-20100,'Missing start value for statistic: '||i_name);
    end if; close DLM;
    /* Get end value */
    open DLM (eid); fetch DLM into eval;
    if DLM%notfound then
    raise_application_error
    (-20100,'Missing end value for statistic: '||i_name);
    end if; close DLM;
    /* Return difference */
    return eval - bval;
    end DLMDIF;
    begin /* main procedure body of STAT_CHANGES */
    lhtr := LIBRARYCACHE_HITRATIO;
    bfwt := BUFFER_WAITS;
    lhr := LATCH_HITRATIO;
    chng := SYSDIF('db block changes');
    ucal := SYSDIF('user calls');
    urol := SYSDIF('user rollbacks');
    ucom := SYSDIF('user commits');
    tran := ucom + urol;
    rsiz := SYSDIF('redo size');
    phyr := SYSDIF('physical reads');
    phyrd := SYSDIF('physical reads direct');
    phyrdl := SYSDIF('physical reads direct (lob)');
    phyw := SYSDIF('physical writes');
    hprse := SYSDIF('parse count (hard)');
    prse := SYSDIF('parse count (total)');
    gets := SYSDIF('session logical reads');
    recr := SYSDIF('recursive calls');
    rlsr := SYSDIF('redo log space requests');
    rent := SYSDIF('redo entries');
    srtm := SYSDIF('sorts (memory)');
    srtd := SYSDIF('sorts (disk)');
    srtr := SYSDIF('sorts (rows)');
    logc := SYSDIF('logons cumulative');
    prscpu := SYSDIF('parse time cpu');
    prsela := SYSDIF('parse time elapsed');
    tcpu := SYSDIF('CPU used by this session');
    exe := SYSDIF('execute count');
    bs := GET_PARAM('db_block_size');
    bc := GET_PARAM('db_block_buffers') * bs;
    if bc = 0 then
    bc := GET_PARAM('db_cache_size')
    + GET_PARAM('db_keep_cache_size')
    + GET_PARAM('db_recycle_cache_size')
    + GET_PARAM('db_2k_cache_size')
    + GET_PARAM('db_4k_cache_size')
    + GET_PARAM('db_8k_cache_size')
    + GET_PARAM('db_16k_cache_size')
    + GET_PARAM('db_32k_cache_size');
    end if;
    sp := GET_PARAM('shared_pool_size');
    lb := GET_PARAM('log_buffer');
    twt := TOTAL_EVENT_TIME; -- total wait time for all non-idle events
    bspm := SGASTAT('total_shared_pool', bid);
    espm := SGASTAT('total_shared_pool', eid);
    bfrm := SGASTAT('free memory', bid);
    efrm := SGASTAT('free memory', eid);
    blog := GET_SYSSTAT('logons current', bid);
    elog := GET_SYSSTAT('logons current', eid);
    bocur := GET_SYSSTAT('opened cursors current', bid);
    eocur := GET_SYSSTAT('opened cursors current', eid);
    /* Do we want to report on cluster-specific statistics? Check
    in procedure variable "parallel".
    if parallel = 'YES' then
    dmsd := DLMDIF('messages sent directly');
    dmfc := DLMDIF('messages flow controlled');
    dmsi := DLMDIF('messages sent indirectly');
    dmrv := DLMDIF('messages received');
    dfcms := DLMDIF('flow control messages sent');
    dfcmr := DLMDIF('flow control messages received');
    dynal := DLMDIF('dynamically allocated enqueues');
    dynares := DLMDIF('dynamically allocated resources');
    pmrv := DLMDIF('gcs msgs received');
    pmpt := DLMDIF('gcs msgs process time(ms)');
    npmrv := DLMDIF('ges msgs received');
    npmpt := DLMDIF('ges msgs process time(ms)');
    scma := DLMDIF('gcs side channel msgs actual');
    scml := DLMDIF('gcs side channel msgs logical');
    pinc := DLMDIF('gcs immediate (null) converts');
    picrnc := DLMDIF('gcs immediate cr (null) converts');
    picc := DLMDIF('gcs immediate (compatible) converts');
    picrcc := DLMDIF('gcs immediate cr (compatible) converts');
    pbc := DLMDIF('gcs blocked converts');
    pbcrc := DLMDIF('gcs blocked cr converts');
    pcba := DLMDIF('gcs compatible basts');
    pccrba := DLMDIF('gcs compatible cr basts');
    pcrbpi := DLMDIF('gcs cr basts to PIs');
    dynapres := DLMDIF('dynamically allocated gcs resources');
    dynapshl := DLMDIF('dynamically allocated gcs shadows');
    prcma := DLMDIF('gcs recovery claim msgs actual');
    prcml := DLMDIF('gcs recovery claim msgs logical');
    pwrm := DLMDIF('gcs write request msgs');
    pfpim := DLMDIF('gcs flush pi msgs');
    pwnm := DLMDIF('gcs write notification msgs');
    dpms := SYSDIF('gcs messages sent');
    dnpms := SYSDIF('ges messages sent');
    glsg := SYSDIF('global lock sync gets');
    glag := SYSDIF('global lock async gets');
    glgt := SYSDIF('global lock get time');
    glsc := SYSDIF('global lock sync converts');
    glac := SYSDIF('global lock async converts');
    glct := SYSDIF('global lock convert time');
    glrl := SYSDIF('global lock releases');
    gcge := SYSDIF('global cache gets');
    gcgt := SYSDIF('global cache get time');
    gccv := SYSDIF('global cache converts');
    gcct := SYSDIF('global cache convert time');
    gccrrv := SYSDIF('global cache cr blocks received');
    gccrrt := SYSDIF('global cache cr block receive time');
    gccurv := SYSDIF('global cache current blocks received');
    gccurt := SYSDIF('global cache current block receive time');
    gccrsv := SYSDIF('global cache cr blocks served');
    gccrbt := SYSDIF('global cache cr block build time');
    gccrft := SYSDIF('global cache cr block flush time');
    gccrst := SYSDIF('global cache cr block send time');
    gccusv := SYSDIF('global cache current blocks served');
    gccupt := SYSDIF('global cache current block pin time');
    gccuft := SYSDIF('global cache current block flush time');
    gccust := SYSDIF('global cache current block send time');
    end if;
    /* Determine if we want to report on session-specific statistics.
    Check that the session is the same one for both snapshots.
    select session_id
    , serial#
    into l_b_session_id
    , l_b_serial#
    from stats$snapshot
    where snap_id = bid
    and dbid = db_ident
    and instance_number = inst_num;
    select session_id
    , serial#
    into l_e_session_id
    , l_e_serial#
    from stats$snapshot
    where snap_id = eid
    and dbid = db_ident
    and instance_number = inst_num;
    if ( (l_b_session_id = l_e_session_id)
    and (l_b_serial# = l_e_serial#)
    and (l_b_session_id != 0) ) then
    /* we have a valid comparison - it is the
    same session - get number of tx performed
    by this session */
    strn := SESDIF('user rollbacks') + SESDIF('user commits');
    if strn = 0 then
    /* No new transactions */
    strn := 1;
    end if;
    else
    /* No valid comparison can be made */
    strn :=1;
    end if;
    end STAT_CHANGES;
    function SNAP
    (i_snap_level in number default null
    ,i_session_id in number default null
    ,i_ucomment in varchar2 default null
    ,i_num_sql in number default null
    ,i_executions_th in number default null
    ,i_parse_calls_th in number default null
    ,i_disk_reads_th in number default null
    ,i_buffer_gets_th in number default null
    ,i_sharable_mem_th in number default null
    ,i_version_count_th in number default null
    ,i_all_init in varchar2 default null
    ,i_pin_statspack in varchar2 default null
    ,i_modify_parameter in varchar2 default 'FALSE'
    RETURN integer IS
    /* This function performs a snapshot of the v$ views into the
    stats$ tables, and returns the snapshot id.
    If parameters are passed, these are the values used, otherwise
    the values stored in the stats$statspack_parameter table are used.
    l_snap_id integer;
    l_snap_level number;
    l_session_id number;
    l_serial# number;
    l_ucomment varchar2(160);
    l_num_sql number;
    l_executions_th number;
    l_parse_calls_th number;
    l_disk_reads_th number;
    l_buffer_gets_th number;
    l_sharable_mem_th number;
    l_version_count_th number;
    l_all_init varchar2(5);
    l_pin_statspack varchar2(10);
    l_sql_stmt varchar2(3000);
    l_slarti varchar2(20);
    l_threshold number;
    l_total_sql number := 0;
    l_total_sql_mem number := 0;
    l_single_use_sql number := 0;
    l_single_use_sql_mem number := 0;
    l_text_subset varchar2(31);
    l_sharable_mem number;
    l_version_count number;
    l_sorts number;
    l_module varchar2(64);
    l_loaded_versions number;
    l_executions number;
    l_loads number;
    l_invalidations number;
    l_parse_calls number;
    l_disk_reads number;
    l_buffer_gets number;
    l_rows_processed number;
    l_address raw(8);
    l_hash_value number;
    l_version_count number;
    l_max_begin_time date;
    cursor GETSERIAL is
    select serial#
    from v$session
    where sid = l_session_id;
    PROCEDURE snap_sql IS
    begin
    /* Gather summary statistics */
    insert into stats$sql_statistics
    ( snap_id
    , dbid
    , instance_number
    , total_sql
    , total_sql_mem
    , single_use_sql
    , single_use_sql_mem
    select l_snap_id
    , p_dbid
    , p_instance_number
    , count(1)
    , sum(sharable_mem)
    , sum(decode(executions, 1, 1, 0))
    , sum(decode(executions, 1, sharable_mem, 0))
    from stats$v$sqlxs
    where is_obsolete = 'N';
    /* Gather SQL statements which exceed any threshold,
    excluding obsolete parent cursors
    insert into stats$sql_summary
    ( snap_id
    , dbid
    , instance_number
    , text_subset
    , sharable_mem
    , sorts
    , module
    , loaded_versions
    , executions
    , loads
    , invalidations
    , parse_calls
    , disk_reads
    , buffer_gets
    , rows_processed
    , command_type
    , address
    , hash_value
    , version_count
    , cpu_time
    , elapsed_time
    , outline_sid
    , outline_category
    select l_snap_id
    , p_dbid
    , p_instance_number
    , substr(sql_text,1,31)
    , sharable_mem
    , sorts
    , module
    , loaded_versions
    , executions
    , loads
    , invalidations
    , parse_calls
    , disk_reads
    , buffer_gets
    , rows_processed
    , command_type
    , address
    , hash_value
    , version_count
    , cpu_time
    , elapsed_time
    , outline_sid
    , outline_category
    from stats$v$sqlxs
    where is_obsolete = 'N'
    and ( buffer_gets > l_buffer_gets_th
    or disk_reads > l_disk_reads_th
    or parse_calls > l_parse_calls_th
    or executions > l_executions_th
    or sharable_mem > l_sharable_mem_th
    or version_count > l_version_count_th
    /* Insert the SQL Text for hash_values captured in the snapshot
    into stats$sqltext if it's not already there. Identify SQL which
    execeeded the threshold by querying stats$sql_summary for this
    snapid and database instance
    insert into stats$sqltext
    ( hash_value
    , text_subset
    , piece
    , sql_text
    , address
    , command_type
    , last_snap_id
    select st1.hash_value
    , ss.text_subset
    , st1.piece
    , st1.sql_text
    , st1.address
    , st1.command_type
    , ss.snap_id
    from v$sqltext st1
    , stats$sql_summary ss
    where ss.snap_id = l_snap_id
    and ss.dbid = p_dbid
    and ss.instance_number = p_instance_number
    and st1.hash_value = ss.hash_value
    and st1.address = ss.address
    and not exists (select 1
    from stats$sqltext st2
    where st2.hash_value = ss.hash_value
    and st2.text_subset = ss.text_subset
    IF l_snap_level >= 6 THEN
    /* Identify SQL which execeeded the threshold by querying
    stats$sql_summary for this snapid and database instance.
    Capture the plans which were used for the high-load SQL if
    don't already have this data.
    Omit capturing plan usage information for cursors which
    have a zero plan hash value.
    Currently this is captured in a level 6 (or greater)
    snapshot, however this may be integrated into level 5
    snapshot at a later date.
    hl - high load
    insert into stats$sql_plan_usage
    ( hash_value
    , text_subset
    , plan_hash_value
    , cost
    , snap_id
    , address
    , optimizer
    select hl.hash_value
    , hl.text_subset
    , hl.plan_hash_value
    , hl.cost
    , max(hl.snap_id)
    , max(hl.address)
    , max(hl.optimizer)
    from (select /*+ ordered use_nl(sq) index(sq) */
    ss.hash_value
    , ss.text_subset
    , sq.plan_hash_value
    , nvl(sq.optimizer_cost,-9) cost
    , ss.snap_id snap_id
    , ss.address
    , sq.optimizer_mode optimizer
    from stats$sql_summary ss
    , v$sql sq
    where ss.snap_id = l_snap_id
    and ss.dbid = p_dbid
    and ss.instance_number = p_instance_number
    and sq.hash_value = ss.hash_value
    and sq.address = ss.address
    and sq.plan_hash_value > 0
    ) hl
    where not exists (select /*+ no_unnest */
    from stats$sql_plan_usage spu
    where spu.hash_value = hl.hash_value
    and spu.text_subset = hl.text_subset
    and spu.plan_hash_value
    = hl.plan_hash_value
    and spu.cost = hl.cost
    group by hl.hash_value
    , hl.text_subset
    , hl.plan_hash_value
    , hl.cost
    , hl.optimizer;
    /* For all new hash_value, plan_hash_value, cost combinations
    just captured, get the optimizer plans, if we don't already
    have them. Note that the plan (and hence the plan hash value)
    comprises the access path and the join order (and not
    variable factors such as the cardinality).
    insert into stats$sql_plan
    ( plan_hash_value
    , id
    , operation
    , options
    , object_node
    , object#
    , object_owner
    , object_name
    , optimizer
    , parent_id
    , depth
    , position
    , cost
    , cardinality
    , bytes
    , other_tag
    , partition_start
    , partition_stop
    , partition_id
    , other
    , distribution
    , cpu_cost
    , io_cost
    , temp_space
    , snap_id
    select /*+ ordered use_nl(s) use_nl(sp.p) */
    new_plan.plan_hash_value
    , sp.id
    , max(sp.operation)
    , max(sp.options)
    , max(sp.object_node)
    , max(sp.object#)
    , max(sp.object_owner)
    , max(sp.object_name)
    , max(sp.optimizer)
    , max(sp.parent_id)
    , max(sp.depth)
    , max(sp.position)
    , max(sp.cost)
    , max(sp.cardinality)
    , max(sp.bytes)
    , max(sp.other_tag)
    , max(sp.partition_start)
    , max(sp.partition_stop)
    , max(sp.partition_id)
    , max(sp.other)
    , max(sp.distribution)
    , max(sp.cpu_cost)
    , max(sp.io_cost)
    , max(sp.temp_space)
    , max(new_plan.snap_id)
    from (select /*+ index(spu) */
    distinct
    spu.plan_hash_value
    , spu.hash_value
    , spu.address
    , spu.text_subset
    , spu.snap_id
    from stats$sql_plan_usage spu
    where spu.snap_id = l_snap_id
    and not exists (select /*+ nl_aj */ *
    from stats$sql_plan ssp
    where ssp.plan_hash_value
    = spu.plan_hash_value
    ) new_plan
    , v$sql s
    , v$sql_plan sp
    where sp.hash_value = new_plan.hash_value
    and sp.address = new_plan.address
    and s.hash_value = new_plan.hash_value
    and s.address = new_plan.address
    and s.hash_value = sp.hash_value
    and s.address = sp.address
    and s.child_number = sp.child_number
    group by
    new_plan.plan_hash_value
    , sp.id;
    END IF; /* snap level >=6 */
    END snap_sql;
    begin /* Function SNAP */
    /* Get instance parameter defaults from stats$statspack_parameter,
    or use supplied parameters.
    If all parameters are specified, use them, otherwise get values
    from the parameters not specified from stats$statspack_parameter.
    statspack.qam_statspack_parameter
    ( p_dbid
    , p_instance_number
    , i_snap_level, i_session_id, i_ucomment, i_num_sql
    , i_executions_th, i_parse_calls_th
    , i_disk_reads_th, i_buffer_gets_th, i_sharable_mem_th
    , i_version_count_th, i_all_init
    , i_pin_statspack
    , i_modify_parameter
    , l_snap_level, l_session_id, l_ucomment, l_num_sql
    , l_executions_th, l_parse_calls_th
    , l_disk_reads_th, l_buffer_gets_th, l_sharable_mem_th
    , l_version_count_th, l_all_init
    , l_pin_statspack);
    /* Generate a snapshot id */
    select stats$snapshot_id.nextval
    into l_snap_id
    from dual
    where rownum = 1;
    /* Determine the serial# of the session to maintain stats for,
    if this was requested.
    if l_session_id > 0 then
    if not GETSERIAL%ISOPEN then open GETSERIAL; end if;
    fetch GETSERIAL into l_serial#;
    if GETSERIAL%NOTFOUND then
    /* Session has already disappeared - don't gather
    statistics for this session in this snapshot */
    l_session_id := 0;
    l_serial# := 0;
    end if; close GETSERIAL;
    else
    l_serial# := 0;
    end if;
    /* The instance has been restarted since the last snapshot */
    if p_new_sga = 0
    then
    begin
    p_new_sga := 1;
    /* Get the instance startup time, and other characteristics */
    insert into stats$database_instance
    ( dbid
    , instance_number
    , startup_time
    , snap_id
    , parallel
    , version
    , db_name
    , instance_name
    , host_name
    select p_dbid
    , p_instance_number
    , p_startup_time
    , l_snap_id
    , p_parallel
    , p_version
    , p_name
    , p_instance_name
    , p_host_name
    from sys.dual;
    commit;
    end;
    end if; /* new SGA */
    /* Work out the max undo stat time, used for gathering undo stat data */
    select nvl(max(begin_time), to_date('01011900','DDMMYYYY'))
    into l_max_begin_time
    from stats$undostat
    where dbid = p_dbid
    and instance_number = p_instance_number;
    /* Save the snapshot characteristics */
    insert into stats$snapshot
    ( snap_id, dbid, instance_number
    , snap_time, startup_time
    , session_id, snap_level, ucomment
    , executions_th, parse_calls_th, disk_reads_th
    , buffer_gets_th, sharable_mem_th
    , version_count_th, serial#, all_init)
    values
    ( l_snap_id, p_dbid, p_instance_number
    , SYSDATE, p_startup_time
    , l_session_id, l_snap_level, l_ucomment
    , l_executions_th, l_parse_calls_th, l_disk_reads_th
    , l_buffer_gets_th, l_sharable_mem_th
    , l_version_count_th, l_serial#, l_all_init);
    /* Begin gathering statistics */
    insert into stats$filestatxs
    ( snap_id
    , dbid
    , instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    from stats$v$filestatxs;
    insert into stats$tempstatxs
    ( snap_id
    , dbid
    , instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    from stats$v$tempstatxs;
    insert into stats$librarycache
    ( snap_id
    , dbid
    , instance_number
    , namespace
    , gets
    , gethits
    , pins
    , pinhits
    , reloads
    , invalidations
    , dlm_lock_requests
    , dlm_pin_requests
    , dlm_pin_releases
    , dlm_invalidation_requests
    , dlm_invalidations
    select l_snap_id
    , p_dbid
    , p_instance_number
    , namespace
    , gets
    , gethits
    , pins
    , pinhits
    , reloads
    , invalidations
    , dlm_lock_requests
    , dlm_pin_requests
    , dlm_pin_releases
    , dlm_invalidation_requests
    , dlm_invalidations
    from v$librarycache;
    insert into stats$buffer_pool_statistics
    ( snap_id
    , dbid
    , instance_number
    , id
    , name
    , block_size
    , set_msize
    , cnum_repl
    , cnum_write
    , cnum_set
    , buf_got
    , sum_write
    , sum_scan
    , free_buffer_wait
    , write_complete_wait
    , buffer_busy_wait
    , free_buffer_inspected
    , dirty_buffers_inspected
    , db_block_change
    , db_block_gets
    , consistent_gets
    , physical_reads
    , physical_writes
    select l_snap_id
    , p_dbid
    , p_instance_number
    , id
    , name
    , block_size
    , set_msize
    , cnum_repl
    , cnum_write
    , cnum_set
    , buf_got
    , sum_write
    , sum_scan
    , free_buffer_wait
    , write_complete_wait
    , buffer_busy_wait
    , free_buffer_inspected
    , dirty_buffers_inspected
    , db_block_change
    , db_block_gets
    , consistent_gets
    , physical_reads
    , physical_writes
    from v$buffer_pool_statistics;
    insert into stats$rollstat
    ( snap_id
    , dbid
    , instance_number
    , usn
    , extents
    , rssize
    , writes
    , xacts
    , gets
    , waits
    , optsize
    , hwmsize
    , shrinks
    , wraps
    , extends
    , aveshrink
    , aveactive
    select l_snap_id
    , p_dbid
    , p_instance_number
    , usn
    , extents
    , rssize
    , writes
    , xacts
    , gets
    , waits
    , optsize
    , hwmsize
    , shrinks
    , wraps
    , extends
    , aveshrink
    , aveactive
    from v$rollstat;
    insert into stats$rowcache_summary
    ( snap_id
    , dbid
    , instance_number
    , parameter
    , total_usage
    , usage
    , gets
    , getmisses
    , scans
    , scanmisses
    , scancompletes
    , modifications
    , flushes
    , dlm_requests
    , dlm_conflicts
    , dlm_releases
    select l_snap_id
    , p_dbid
    , p_instance_number
    , parameter
    , sum("COUNT")
    , sum(usage)
    , sum(gets)
    , sum(getmisses)
    , sum(scans)
    , sum(scanmisses)
    , sum(scancompletes)
    , sum(modifications)
    , sum(flushes)
    , sum(dlm_requests)
    , sum(dlm_conflicts)
    , sum(dlm_releases)
    from v$rowcache
    group by l_snap_id, p_dbid, p_instance_number, parameter;
    /* Collect parameters every snapshot, to cater for dynamic
    parameters changable while instance is running
    if l_all_init = 'FALSE' then
    insert into stats$parameter
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    , isdefault
    , ismodified
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , value
    , isdefault
    , ismodified
    from v$system_parameter;
    else
    insert into stats$parameter
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    , isdefault
    , ismodified
    select l_snap_id
    , p_dbid
    , p_instance_number
    , i.ksppinm
    , sv.ksppstvl
    , sv.ksppstdf
    , decode(bitand(sv.ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE')
    from stats$x$ksppi i
    , stats$x$ksppsv sv
    where i.indx = sv.indx;
    end if;
    /* To cater for variable size SGA - insert on each snapshot */
    insert into stats$sga
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , value
    from v$sga;
    /* Get current allocation of memory in the SGA */
    insert into stats$sgastat
    ( snap_id
    , dbid
    , instance_number
    , pool
    , name
    , bytes
    select l_snap_id
    , p_dbid
    , p_instance_number
    , pool
    , name
    , bytes
    from v$sgastat;
    insert into stats$system_event
    ( snap_id
    , dbid
    , instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    select l_snap_id
    , p_dbid
    , p_instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    from v$system_event;
    insert into stats$bg_event_summary
    ( snap_id
    , dbid
    , instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    select l_snap_id
    , p_dbid
    , p_instance_number
    , e.event
    , sum(e.total_waits)
    , sum(e.total_timeouts)
    , sum(e.time_waited_micro)
    from v$session_event e
    where e.sid in (select s.sid from v$session s where s.type = 'BACKGROUND')
    group by l_snap_id, p_dbid, p_instance_number, e.event;
    insert into stats$sysstat
    ( snap_id
    , dbid
    , instance_number
    , statistic#
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , statistic#
    , name
    , value
    from v$sysstat;
    insert into stats$waitstat
    ( snap_id
    , dbid
    , instance_number
    , class
    , wait_count
    , time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , class
    , "COUNT"
    , time
    from v$waitstat;
    insert into stats$enqueue_stat
    ( snap_id
    , dbid
    , instance_number
    , eq_type
    , total_req#
    , total_wait#
    , succ_req#
    , failed_req#
    , cum_wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , eq_type
    , total_req#
    , total_wait#
    , succ_req#
    , failed_req#
    , cum_wait_time
    from v$enqueue_stat
    where total_req# != 0;
    insert into stats$latch
    ( snap_id
    , dbid
    , instance_number
    , name
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    from v$latch;
    insert into stats$latch_misses_summary
    ( snap_id
    , dbid
    , instance_number
    , parent_name
    , where_in_code
    , nwfail_count
    , sleep_count
    , wtr_slp_count
    select l_snap_id
    , p_dbid
    , p_instance_number
    , parent_name
    , "WHERE"
    , sum(nwfail_count)
    , sum(sleep_count)
    , sum(wtr_slp_count)
    from v$latch_misses
    where sleep_count > 0
    group by l_snap_id, p_dbid, p_instance_number
    , parent_name, "WHERE";
    insert into stats$resource_limit
    ( snap_id
    , dbid
    , instance_number
    , resource_name
    , current_utilization
    , max_utilization
    , initial_allocation
    , limit_value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , resource_name
    , current_utilization
    , max_utilization
    , initial_allocation
    , limit_value
    from v$resource_limit
    where limit_value != ' UNLIMITED'
    and max_utilization > 0;
    insert into stats$undostat
    ( begin_time
    , end_time
    , dbid
    , instance_number
    , snap_id
    , undotsn
    , undoblks
    , txncount
    , maxquerylen
    , maxconcurrency
    , unxpstealcnt
    , unxpblkrelcnt
    , unxpblkreucnt
    , expstealcnt
    , expblkrelcnt
    , expblkreucnt
    , ssolderrcnt
    , nospaceerrcnt
    select begin_time
    , end_time
    , p_dbid
    , p_instance_number
    , l_snap_id
    , undotsn
    , undoblks
    , txncount
    , maxquerylen
    , maxconcurrency
    , unxpstealcnt
    , unxpblkrelcnt
    , unxpblkreucnt
    , expstealcnt
    , expblkrelcnt
    , expblkreucnt
    , ssolderrcnt
    , nospaceerrcnt
    from v$undostat
    where begin_time > l_max_begin_time
    and begin_time + (1/(24*6)) <= end_time;
    insert into stats$db_cache_advice
    ( snap_id
    , dbid
    , instance_number
    , id
    , name
    , block_size
    , buffers_for_estimate
    , advice_status
    , size_for_estimate
    , estd_physical_read_factor
    , estd_physical_reads
    select l_snap_id
    , p_dbid
    , p_instance_number
    , id
    , name
    , block_size
    , buffers_for_estimate
    , advice_status
    , size_for_estimate
    , estd_physical_read_factor
    , estd_physical_reads
    from v$db_cache_advice
    where advice_status = 'ON';
    insert into stats$pgastat
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , value
    from v$pgastat;
    insert into stats$instance_recovery
    ( snap_id
    , dbid
    , instance_number
    , recovery_estimated_ios
    , actual_redo_blks
    , target_redo_blks
    , log_file_size_redo_blks
    , log_chkpt_timeout_redo_blks
    , log_chkpt_interval_redo_blks
    , fast_start_io_target_redo_blks
    , target_mttr
    , estimated_mttr
    , ckpt_block_writes
    select l_snap_id
    , p_dbid
    , p_instance_number
    , recovery_estimated_ios
    , actual_redo_blks
    , target_redo_blks
    , log_file_size_redo_blks
    , log_chkpt_timeout_redo_blks
    , log_chkpt_interval_redo_blks
    , fast_start_io_target_redo_blks
    , target_mttr
    , estimated_mttr
    , ckpt_block_writes
    from v$instance_recovery;
    if p_parallel = 'YES' then
    insert into stats$dlm_misc
    ( snap_id
    , dbid
    , instance_number
    , statistic#
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , statistic#
    , name
    , value
    from v$dlm_misc;
    end if; /* parallel */
    /* Begin gathering Extended Statistics */
    IF l_snap_level >= 5 THEN
    snap_sql;
    END IF; /* snap level >=5 */
    IF l_snap_level >= 10 THEN
    insert into stats$latch_children
    ( snap_id
    , dbid
    , instance_number
    , latch#
    , child#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , latch#
    , child#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    from v$latch_children;
    insert into stats$latch_parent
    ( snap_id
    , dbid
    , instance_number
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    from v$latch_parent;
    END IF; /* snap level >=10 */
    /* Record level session-granular statistics if a specific session
    has been requested
    if l_session_id > 0
    then
    insert into stats$sesstat
    ( snap_id
    , dbid
    , instance_number
    , statistic#
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , statistic#
    , value
    from v$sesstat
    where sid = l_session_id;
    insert into stats$session_event
    ( snap_id
    , dbid
    , instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    , max_wait
    select l_snap_id
    , p_dbid
    , p_instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    , max_wait
    from v$session_event
    where sid = l_session_id;
    end if;
    commit work;
    RETURN l_snap_id;
    end SNAP; /* Function SNAP */
    begin /* STATSPACK body */
    /* Query the database id, instance_number, database name, instance
    name and startup time for the instance we are working on
    /* Get information about the current instance */
    open get_instance;
    fetch get_instance into
    p_instance_number, p_instance_name
    , p_startup_time, p_parallel, p_version
    , p_host_name;
    close get_instance;
    /* Select the database info for the db connected to */
    open get_db;
    fetch get_db into p_dbid, p_name;
    close get_db;
    /* Keep the package
    sys.dbms_shared_pool.keep('PERFSTAT.STATSPACK', 'P');
    /* Determine if the instance has been restarted since the previous snapshot
    begin
    select 1
    into p_new_sga
    from stats$database_instance
    where startup_time = p_startup_time
    and dbid = p_dbid
    and instance_number = p_instance_number;
    exception
    when NO_DATA_FOUND then
    p_new_sga := 0;
    end;
    end STATSPACK;
    Warning: Package Body created with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY STATSPACK:
    LINE/COL ERROR
    2045/3 PLS-00201: identifier 'SYS.DBMS_SHARED_POOL' must be declared
    2045/3 PL/SQL: Statement ignored

    When i compiled the package, it compiled with following error.
    Warning: Package Body created with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY STATSPACK:
    LINE/COL ERROR
    2045/3 PLS-00201: identifier 'SYS.DBMS_SHARED_POOL' must be declared
    2045/3 PL/SQL: Statement ignored
    SQL>

  • Not able to install Statspack.

    DB 9.2.0.5.0
    OS WIn 2003 server
    I've gone through the following procedure to generate a statspack report. but, I am not able to insatall statspack, though the same procedure worked in 10g.
    1. create a perfstat tablespace
    2. run spcreate.sql
    SPCUSR complete. Please check spcusr.lis for any errors.
    SQL>
    SQL> --
    SQL> -- Build the tables and synonyms
    SQL> connect perfstat/&&perfstat_password
    ERROR:
    ORA-12560: TNS:protocol adapter error
    Warning: You are no longer connected to ORACLE.
    SQL> @@spctab
    SQL> Rem
    SQL> Rem $Header: spctab.sql 16-apr-2002.14:54:46 vbarrier Exp $
    SQL> Rem
    SQL> Rem spctab.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1999, 2002, Oracle Corporation. All rights reserved.
    SQL> Rem
    SQL> Rem NAME
    SQL> Rem spctab.sql
    SQL> Rem
    SQL> Rem DESCRIPTION
    SQL> Rem SQL*PLUS command file to create tables to hold
    SQL> Rem start and end "snapshot" statistical information
    SQL> Rem
    SQL> Rem NOTES
    SQL> Rem Should be run as STATSPACK user, PERFSTAT
    SQL> Rem
    SQL> Rem MODIFIED (MM/DD/YY)
    SQL> Rem vbarrier 03/20/02 - 2143634
    SQL> Rem vbarrier 03/05/02 - Segment Statistics
    SQL> Rem cdialeri 02/07/02 - 2218573
    SQL> Rem cdialeri 01/30/02 - 2184717
    SQL> Rem cdialeri 01/11/02 - 9.2 - features 2
    SQL> Rem cdialeri 11/30/01 - 9.2 - features 1
    SQL> Rem cdialeri 04/22/01 - Undostat changes
    SQL> Rem cdialeri 03/02/01 - 9.0
    SQL> Rem cdialeri 09/12/00 - sp_1404195
    SQL> Rem cdialeri 04/07/00 - 1261813
    SQL> Rem cdialeri 03/20/00 - Support for purge
    SQL> Rem cdialeri 02/16/00 - 1191805
    SQL> Rem cdialeri 01/26/00 - 1169401
    SQL> Rem cdialeri 11/01/99 - Enhance, 1059172
    SQL> Rem cmlim 07/17/97 - Added STATS$SQLAREA to store top sql stmts
    SQL> Rem gwood 10/16/95 - Version to run as sys without using many vi
    SQL> Rem cellis.uk 11/15/89 - Created
    SQL> Rem
    SQL>
    SQL> set showmode off echo off;
    If this script is automatically called from spcreate (which is
    the supported method), all STATSPACK segments will be created in
    the PERFSTAT user's default tablespace.
    Using perfstat tablespace to store Statspack objects
    ... Creating STATS$SNAPSHOT_ID Sequence
    SP2-0640: Not connected
    SP2-0640: Not connected
    ... Creating STATS$... tables
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0640: Not connected
    NOTE:
    SPCTAB complete. Please check spctab.lis for any errors.
    SQL> -- Create the statistics Package
    SQL> @@spcpkg
    SQL> Rem
    SQL> Rem $Header: spcpkg.sql 17-apr-2002.16:59:10 vbarrier Exp $
    SQL> Rem
    SQL> Rem spcpkg.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1999, 2002, Oracle Corporation. All rights reserved.
    SQL> Rem
    SQL> Rem NAME
    SQL> Rem spcpkg.sql
    SQL> Rem
    SQL> Rem DESCRIPTION
    SQL> Rem SQL*PLUS command file to create statistics package
    SQL> Rem
    SQL> Rem NOTES
    SQL> Rem Must be run as the STATSPACK owner, PERFSTAT
    SQL> Rem
    SQL> Rem MODIFIED (MM/DD/YY)
    SQL> Rem vbarrier 03/20/02 - 2184504
    SQL> Rem spommere 03/19/02 - 2274095
    SQL> Rem vbarrier 03/05/02 - Segment Statistics
    SQL> Rem spommere 02/14/02 - cleanup RAC stats that are no longer needed
    SQL> Rem spommere 02/08/02 - 2212357
    SQL> Rem cdialeri 02/07/02 - 2218573
    SQL> Rem cdialeri 01/30/02 - 2184717
    SQL> Rem cdialeri 01/09/02 - 9.2 - features 2
    SQL> Rem cdialeri 11/30/01 - 9.2 - features 1
    SQL> Rem hbergh 08/23/01 - 1940915: use substrb on sql_text
    SQL> Rem cdialeri 04/26/01 - 9.0
    SQL> Rem cdialeri 09/12/00 - sp_1404195
    SQL> Rem cdialeri 04/07/00 - 1261813
    SQL> Rem cdialeri 03/28/00 - sp_purge
    SQL> Rem cdialeri 02/16/00 - 1191805
    SQL> Rem cdialeri 11/01/99 - Enhance, 1059172
    SQL> Rem cgervasi 06/16/98 - Remove references to wrqs
    SQL> Rem cmlim 07/30/97 - Modified system events
    SQL> Rem gwood.uk 02/30/94 - Modified
    SQL> Rem densor.uk 03/31/93 - Modified
    SQL> Rem cellis.uk 11/15/89 - Created
    SQL> Rem
    SQL>
    SQL> set echo off;
    Creating Package STATSPACK...
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0641: "SHOW ERRORS" requires connection to server
    Creating Package Body STATSPACK...
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0641: "SHOW ERRORS" requires connection to server
    NOTE:
    SPCPKG complete. Please check spcpkg.lis for any errors.
    hare krishna
    Alok

    Hi Alok
    I have encountered this before
    In the script there will be a comnnection link at the spcreate sql..
    Rem
    Rem $Header: spcreate.sql 16-apr-2002.11:22:55 vbarrier Exp $
    Rem
    Rem spcreate.sql
    Rem
    Rem Copyright (c) 1999, 2002, Oracle Corporation.  All rights reserved. 
    Rem
    Rem    NAME
    Rem      spcreate.sql - Statistics Create
    Rem
    Rem    DESCRIPTION
    Rem      SQL*PLUS command file which creates the STATSPACK user,
    Rem      tables and package for the performance diagnostic tool STATSPACK
    Rem
    Rem    NOTES
    Rem      Note the script connects INTERNAL and so must be run from
    Rem      an account which is able to connect internal.
    Rem
    Rem    MODIFIED   (MM/DD/YY)
    Rem    cdialeri    02/16/00 - 1191805
    Rem    cdialeri    12/06/99 - 1103031
    Rem    cdialeri    08/13/99 - Created
    Rem
    --  Create PERFSTAT user and required privileges
    @@spcusr
    --  Build the tables and synonyms
    connect perfstat/&&perfstat_password@MARAN
    @@spctab
    --  Create the statistics Package
    @@spcpkgadd the @servicename and run the script
    It will work
    Message was edited by:
    Maran Viswarayar

  • Error in creating perfstat user for statspack

    Hi Friends,
    DB: 11.2.0.2, SE and 64 bit
    OS: RHEL 5.7
    My DB is on SE and hence i cannot use the diagonistic pack so when i am trying to use Statspack for the same, i am facing the following error when i am trying to create Perfstat user.
    SQL> @?/rdbms/admin/spcreate
    Choose the PERFSTAT user's password
    Not specifying a password will result in the installation FAILING
    Enter value for perfstat_password: perfstat
    perfstat
    Choose the Default tablespace for the PERFSTAT user
    Below is the list of online tablespaces in this database which can
    store user data. Specifying the SYSTEM tablespace for the user's
    default tablespace will result in the installation FAILING, as
    using SYSTEM for performance data is not supported.
    Choose the PERFSTAT users's default tablespace. This is the tablespace
    in which the STATSPACK tables and indexes will be created.
    TABLESPACE_NAME CONTENTS STATSPACK DEFAULT TABLESPACE
    INDUS_SML_DATA PERMANENT
    INDUS_SML_INDEX PERMANENT
    PERFSTAT PERMANENT
    SYSAUX PERMANENT *
    USERS PERMANENT
    Pressing <return> will result in STATSPACK's recommended default
    tablespace (identified by *) being used.
    Enter value for default_tablespace: PERFSTAT
    Using tablespace PERFSTAT as PERFSTAT default tablespace.
    Choose the Temporary tablespace for the PERFSTAT user
    Below is the list of online tablespaces in this database which can
    store temporary data (e.g. for sort workareas). Specifying the SYSTEM
    tablespace for the user's temporary tablespace will result in the
    installation FAILING, as using SYSTEM for workareas is not supported.
    Choose the PERFSTAT user's Temporary tablespace.
    TABLESPACE_NAME CONTENTS DB DEFAULT TEMP TABLESPACE
    TEMP TEMPORARY *
    Pressing <return> will result in the database's default Temporary
    tablespace (identified by *) being used.
    Enter value for temporary_tablespace: TEMP
    Using tablespace TEMP as PERFSTAT temporary tablespace.
    ... Creating PERFSTAT user
    ... Installing required packages
    ... Creating views
    ... Granting privileges
    NOTE:
    SPCUSR complete. Please check spcusr.lis for any errors.
    SQL>
    SQL> --
    SQL> -- Build the tables and synonyms
    SQL> connect perfstat/&&perfstat_password
    Connected.
    SQL> @@spctab
    SQL> Rem
    SQL> Rem $Header: rdbms/admin/spctab.sql /st_rdbms_11.2.0/1 2010/08/13 10:06:01 kchou Exp $
    SQL> Rem
    SQL> Rem spctab.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1999, 2010, Oracle and/or its affiliates.
    SQL> Rem All rights reserved.
    SQL> Rem
    SQL> Rem NAME
    SQL> Rem spctab.sql
    SQL> Rem
    SQL> Rem DESCRIPTION
    SQL> Rem SQL*PLUS command file to create tables to hold
    SQL> Rem start and end "snapshot" statistical information
    SQL> Rem
    SQL> Rem NOTES
    SQL> Rem Should be run as STATSPACK user, PERFSTAT
    SQL> Rem
    SQL> Rem MODIFIED (MM/DD/YY)
    SQL> Rem kchou 08/11/10 - Bug#9800868 - Add Missing Idle Events for
    SQL> Rem 11.2.0.2for Statspack & Standby Statspack
    SQL> Rem kchou 08/11/10 - Bug#9800868 - Add missing idle events to 11.2.0.2
    SQL> Rem cgervasi 05/13/09 - add idle event: cell worker idle
    SQL> Rem cgervasi 04/02/09 - bug8395154: missing idle events
    SQL> Rem rhlee 02/22/08 -
    Rem cdgreen 03/14/07 - 11 F2SQL> Rem shsong 06/14/07 - Add idle events
    SQL> Rem cdgreen 02/28/07 - 5908354
    SQL> Rem cdgreen 04/26/06 - 11 F1
    SQL> Rem cdgreen 06/26/06 - Increase column length
    SQL> Rem cdgreen 05/10/06 - 5215982
    SQL> Rem cdgreen 05/24/05 - 4246955
    SQL> Rem cdgreen 04/18/05 - 4228432
    SQL> Rem cdgreen 03/08/05 - 10gR2 misc
    SQL> Rem vbarrier 02/18/05 - 4081984
    SQL> Rem cdgreen 10/29/04 - 10gR2_sqlstats
    SQL> Rem cdgreen 07/16/04 - 10gR2
    SQL> Rem cdialeri 03/25/04 - 3516921
    SQL> Rem vbarrier 02/12/04 - 3412853
    SQL> Rem cdialeri 12/04/03 - 3290482
    SQL> Rem cdialeri 11/05/03 - 3202706
    SQL> Rem cdialeri 10/14/03 - 10g - streams - rvenkate
    SQL> Rem cdialeri 08/05/03 - 10g F3
    SQL> Rem cdialeri 02/27/03 - 10g F2: baseline, purge
    SQL> Rem vbarrier 02/25/03 - 10g RAC
    SQL> Rem cdialeri 11/15/02 - 10g F1
    SQL> Rem cdialeri 09/27/02 - sleep4
    SQL> Rem vbarrier 03/20/02 - 2143634
    SQL> Rem vbarrier 03/05/02 - Segment Statistics
    SQL> Rem cdialeri 02/07/02 - 2218573
    SQL> Rem cdialeri 01/30/02 - 2184717
    SQL> Rem cdialeri 01/11/02 - 9.2 - features 2
    SQL> Rem cdialeri 11/30/01 - 9.2 - features 1
    SQL> Rem cdialeri 04/22/01 - Undostat changes
    SQL> Rem cdialeri 03/02/01 - 9.0
    SQL> Rem cdialeri 09/12/00 - sp_1404195
    SQL> Rem cdialeri 04/07/00 - 1261813
    SQL> Rem cdialeri 03/20/00 - Support for purge
    SQL> Rem cdialeri 02/16/00 - 1191805
    SQL> Rem cdialeri 01/26/00 - 1169401
    SQL> Rem cdialeri 11/01/99 - Enhance, 1059172
    SQL> Rem cmlim 07/17/97 - Added STATS$SQLAREA to store top sql stmts
    SQL> Rem gwood 10/16/95 - Version to run as sys without using many view
    SQL> Rem cellis.uk 11/15/89 - Created
    SQL> Rem
    SQL>
    SQL> set showmode off echo off;
    If this script is automatically called from spcreate (which is
    the supported method), all STATSPACK segments will be created in
    the PERFSTAT user's default tablespace.
    Using PERFSTAT tablespace to store Statspack objects
    ... Creating STATS$SNAPSHOT_ID Sequence
    Sequence created.
    create public synonym STATS$SNAPSHOT_ID for STATS$SNAPSHOT_ID
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    Disconnected from Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
    Kindly suggest on the same..
    BR

    @?/rdbms/admin/spdrop
    drop public synonym STATS$SNAPSHOT_ID;
    try again

  • Releasing Cloned Blocks

    While investigating a severe performance issue of buffer busy waits and latch free - cache buffer chains, I noticed that for a particular 1-row table with the majority of the BBW, there was a large number of cloned blocks. (same latch, many entries w/ touch count=1). I also noticed that fairly quickly after the wait contention subsided, that the number of tcn=1 blocks were basically gone.
    Is there a function/command/etc. that I could force/"request" Oracle cleanup up any cloned blocks no longer being used?

    metalink document suggests Bug 5387030: AUTOMATIC TUNING OF UNDO_RETENTION CAUSING SPACE PROBLEMS, as per the documents there are 3 workarounds & one of them I opted for was Set the autoextend and maxsize attribute of each datafile in the undo ts so it is autoextensible and its maxsize is equal to its current size so the undo tablespace now has the autoextend attribute but does not autoend:
    alter database datafile '<datafile_flename>' autoextend on maxsize <current_size>;
    With this setting, v$undostat.tuned_undoretention is not calculated based on a percentage of the undo tablespace size, instead v$undostat.tuned_undoretention is set to the maximum of: maxquerylen secs + 300 undo_retention specified in init.ora
    As I monitor the undo tablespace, the same query now returns
    SQL> select sum(bytes)/1024/1024/1024 Gb, status from dba_undo_extents group by status;
    GB STATUS
    42.399292 EXPIRED
    .0625 ACTIVE
    SQL> select begin_time, end_time, undoblks, tuned_undoretention, maxquerylen from v$undostat ;
    this is a partial output
    BEGIN_TIM END_TIME UNDOBLKS T UNED_UNDORETENTION MAXQUERYLEN
    11-APR- 11 11-APR-11 4 900 0
    11-APR-11 11-APR-11 9 900 0
    11-APR-11 11-APR-11 11 900 0
    11-APR-11 11-APR-11 7 900 0
    11-APR-11 11-APR-11 106 900 0
    previously the same query had given different values for tuned_undoretention
    SQL> select begin_time, end_time, undoblks, tuned_undoretention, maxquerylen, maxqueryid from v$undostat;
    BEGIN_TIM END_TIME UNDOBLKS TUNED_UNDORETENTION MAXQUERYLEN
    11-APR-11 11-APR-11 1 900 0
    *11-APR-11 11-APR-11 1 900 0--------------------> This is where the workaround started to effect*
    11-APR-11 11-APR-11 3580 345600 0
    11-APR-11 11-APR-11 1 345600 0
    11-APR-11 11-APR-11 40 345600 0
    11-APR-11 11-APR-11 1 345600 0
    11-APR-11 11-APR-11 1 345600 0
    Any suggestions on how the tuned_undoretention works?

  • SMON observing buffer busy waits

    select *from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionI am truing to split one MAX partition into two partitions but my split operation is failing with ORA-0155. When i tried to find row-count in MAX partition using select count(*), i got ORA-0155 again. Table size is 32 G and partition size of MAX partition is just 2.5 GB. I have Auto Undo Management with UNDO tablespace sized at 32 GB. Compression is ENABLE (DIRECT LOAD ONLY) for every partitions. I have daily partitions and partition count is 79.
    select inst_id, max(maxquerylen)
      from gv$undostat
      group by inst_id;
       INST_ID MAX(MAXQUERYLEN)
             1            26437
    SELECT DISTINCT STATUS, SUM(BYTES), COUNT(*)  FROM DBA_UNDO_EXTENTS GROUP BY STATUS;
    STATUS            SUM(BYTES)   COUNT(*)
    UNEXPIRED        15341387776      16293
    EXPIRED            177143808        134
    ACTIVE                 65536          1
    SELECT A.SID, A.USERNAME, B.XIDUSN, B.USED_UREC, B.USED_UBLK
    FROM V$SESSION A, V$TRANSACTION B
      WHERE A.SADDR=B.SES_ADDR;
    Did not return any record
    SELECT TABLESPACE_NAME,RETENTION FROM DBA_TABLESPACES WHERE TABLESPACE_NAME='UNDO_T1';
    TABLESPACE_NAME                RETENTION
    UNDO_T1                        NOGUARANTEE
    _in_memory_undo=FALSE
    undo_management=AUTO
    undo_retention=28800
    undo_tablespace=UNDO_T1
    select sid,program,logon_time,last_call_et/60/60,sql_hash_value,sql_id,EVENT,P1,P2,P3 from v$session where sid=749;
    SID PROGRAM                                          LOGON_TIME          LAST_CALL_ET/60/60 EVENT                        P1         P2         P3
    749 [email protected] (SMON)                       2010/08/24 06:57:09         4443.34667 buffer busy waits             2        305         33
    File#=2 is an UNDO file
    select startup_time from v$instance;
    STARTUP_TIME
    24.Aug.10/06:57:08There is no locking/blocking scene in db.
    May i ask why SMON is observing BBW ? I tried to wake-up SMON by 'oradebug wakeup pid' but it did not help.
    Edited by: OraDBA02 on Feb 25, 2011 6:48 AM
    Edited by: OraDBA02 on Feb 25, 2011 6:49 AM

    my split operation is failing with ORA-0155.REALLY?
    00155, 00000, "cannot perform work outside of global transaction"
    // *Cause:  The application tried to perform some work on either an Oracle
    //          7.3 server or an Oracle8 server with local transactions disabled
    //          while outside of a global transaction.
    // *Action: Check if the application is connected to an Oracle 7.3 server. The
    //          Transaction monitor must not return a NULL XID on an AX_REG call
    //          when the resource manager is Oracle 7.3.  If the application is
    //          connected to an Oracle8 server, either set nolocal=f in the
    //          xa_open string or start a global transaction prior to attempting
    //          the work.

  • Logical dataguard problem

    Hi all,
    I have prepared a logical dataguard on two local systems. My oracle version is 9i and linux version is Entreprise Linux 3.0.
    Today when i tried to execute spcreate.sql on the primary database it had thrown some errors in my secondary database.
    Kindly look at the following output from my secondary database:-
    SQL> select applied_scn,newest_scn from dba_logstdby_progress;
    APPLIED_SCN NEWEST_SCN
    270084 272644
    SQL> SELECT XIDUSN, XIDSLT, XIDSQN FROM DBA_LOGSTDBY_EVENTS
    2 WHERE EVENT_TIME = (SELECT MAX(EVENT_TIME) FROM DBA_LOGSTDBY_EVENTS);
    XIDUSN XIDSLT XIDSQN
    6 1 114
    SQL> EXECUTE DBMS_LOGSTDBY.SKIP_TRANSACTION(6,1,114);
    PL/SQL procedure successfully completed.
    SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;
    Database altered.
    SQL> select applied_scn,newest_scn from dba_logstdby_progress;
    APPLIED_SCN NEWEST_SCN
    270087 272644
    SQL> SELECT * FROM DBA_LOGSTDBY_EVENTS;
    EVENT_TIM CURRENT_SCN COMMIT_SCN XIDUSN XIDSLT XIDSQN
    EVENT
    STATUS_CODE
    STATUS
    grant select on STATS$V_$SQLXS to PERFSTAT
    942
    ORA-00942: table or view does not exist
    from the above errors i have found out that a particular transaction is unable to replicate in my standby database and i skipped the transaction. But still after skipping the transaction applied_scn in the dba_logstdby_progress is moving only by 3 each time I skip a transaction . So it won'' t be possible for me to skip each and every transaction.
    Kindly let me another way of skipping the rest of transactions which are causing halt in the replication.
    Also I am unable to find out how the script executed from the sys user can be replicated on logical database as sys comes in unsupported users in logical datagurad.
    Is there any way I can execute a script on primary database which won't reflect on secondary database.
    thanks in advance.

    Hi Yoann,
    Commands you provided for skipping perfstat schema worked on logical database .
    Now i m executing spcreate.sql on secondary database it gives following errors after i have specified the perfstat password,default tablespace for perfstat as 'perfstat' and temporary tablespace for perfstat as 'temp' and datafile contained in perfstat tablespace is 150 MB in size.
    spcreate worked fine on primary but is giving errors in the end in secondary.Any suggestions about this:-
    Specifying the SYSTEM tablespace will result in the installation
    FAILING, as using SYSTEM for performance data is not supported.
    TABLESPACE_NAME CONTENTS
    LOGMNRTS PERMANENT
    PERFSTAT PERMANENT
    TEMP TEMPORARY
    UNDOTBS1 UNDO
    Specify PERFSTAT user's default tablespace
    Enter value for default_tablespace: perfstat
    Using perfstat for the default tablespace
    PL/SQL procedure successfully completed.
    User altered.
    User altered.
    Choose the PERFSTAT user's temporary tablespace.
    Specifying the SYSTEM tablespace will result in the installation
    FAILING, as using SYSTEM for the temporary tablespace is not recommended.
    Specify PERFSTAT user's temporary tablespace.
    Enter value for temporary_tablespace: temp
    Using temp for the temporary tablespace
    PL/SQL procedure successfully completed.
    User altered.
    NOTE:
    SPCUSR complete. Please check spcusr.lis for any errors.
    SQL>
    SQL> --
    SQL> -- Build the tables and synonyms
    SQL> connect perfstat/&&perfstat_password
    Connected.
    SQL> @@spctab
    SQL> Rem
    SQL> Rem $Header: spctab.sql 16-apr-2002.14:54:46 vbarrier Exp $
    SQL> Rem
    SQL> Rem spctab.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1999, 2002, Oracle Corporation. All rights reserved.
    SQL> Rem
    SQL> Rem NAME
    SQL> Rem spctab.sql
    SQL> Rem
    SQL> Rem DESCRIPTION
    SQL> Rem SQL*PLUS command file to create tables to hold
    SQL> Rem start and end "snapshot" statistical information
    SQL> Rem
    SQL> Rem NOTES
    SQL> Rem Should be run as STATSPACK user, PERFSTAT
    SQL> Rem
    SQL> Rem MODIFIED (MM/DD/YY)
    SQL> Rem vbarrier 03/20/02 - 2143634
    SQL> Rem vbarrier 03/05/02 - Segment Statistics
    SQL> Rem cdialeri 02/07/02 - 2218573
    SQL> Rem cdialeri 01/30/02 - 2184717
    SQL> Rem cdialeri 01/11/02 - 9.2 - features 2
    SQL> Rem cdialeri 11/30/01 - 9.2 - features 1
    SQL> Rem cdialeri 04/22/01 - Undostat changes
    SQL> Rem cdialeri 03/02/01 - 9.0
    SQL> Rem cdialeri 09/12/00 - sp_1404195
    SQL> Rem cdialeri 04/07/00 - 1261813
    SQL> Rem cdialeri 03/20/00 - Support for purge
    SQL> Rem cdialeri 02/16/00 - 1191805
    SQL> Rem cdialeri 01/26/00 - 1169401
    SQL> Rem cdialeri 11/01/99 - Enhance, 1059172
    SQL> Rem cmlim 07/17/97 - Added STATS$SQLAREA to store top sql stmts
    SQL> Rem gwood 10/16/95 - Version to run as sys without using many view s
    SQL> Rem cellis.uk 11/15/89 - Created
    SQL> Rem
    SQL>
    SQL> set showmode off echo off;
    If this script is automatically called from spcreate (which is
    the supported method), all STATSPACK segments will be created in
    the PERFSTAT user's default tablespace.
    Using perfstat tablespace to store Statspack objects
    ... Creating STATS$SNAPSHOT_ID Sequence
    create sequence STATS$SNAPSHOT_ID
    ERROR at line 1:
    ORA-01031: insufficient privileges
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production

  • Daily UNDO statistics report?

    i want to find the undostats for the last seven days on daily basis.I want the out put in the following format
    date sum(undoblks) sum(txncount) max(maxmaxquerylen)
    30/06/2008 100 200 300
    01/06/2008 200 300 400
    Thank You All...

    Nick, too bad I had not seen that thread.
    -- my version
    > @t9
    > select to_char(begin_time,'YYYYMMDD') as TIME,
      2         sum(undoblks), sum(txncount), max(maxquerylen)
      3  from v$undostat
      4  group by to_char(begin_time,'YYYYMMDD')
      5  /
    TIME     SUM(UNDOBLKS) SUM(TXNCOUNT) MAX(MAXQUERYLEN)
    20080629            85          7772              435
    20080630        262410       6240097              638
    20080701        304863      17472266             1681
    20080702         87685      10133385             8287
    -- Jonathan's
    select  2          to_char(trunc(begin_time,'dd'),'mmdd hh24:mi:ss'),
      3          sum(txncount),
      4          sum(undoblks),
      5          max(maxquerylen)
      6  from v$undostat
      7  group by
      8          to_char(trunc(begin_time,'dd'),'mmdd hh24:mi:ss')
      9  order by 1
    10  /
    TO_CHAR(TRUNC SUM(TXNCOUNT) SUM(UNDOBLKS) MAX(MAXQUERYLEN)
    0629 00:00:00          7772            85              435
    0630 00:00:00       6240097        262410              638
    0701 00:00:00      17472266        304863             1681
    0702 00:00:00      10133385         87685             8287
    [pre]
    -- Mark D Powell --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • High Logical I/O

    Hello,
    The system we use is a kind of OLTP thing.
    platform - linux
    version - 10.2
    here, in the statspack everything seems okay to me except the logical reads.(if not tell)
    the problems is, the cpu grows gradually and reaches 100.
    i need the cpu to be steady.
    can somebody tell what is happening here?
    STATSPACK report for
    Database DB Id Instance Inst Num Startup Time Release RAC
    ~~~~~~~~ ----------- ------------ -------- --------------- ----------- ---
    2386172435 apple22a 1 11-Aug-09 23:14 10.2.0.1.0 NO
    Host Name: xxxxxxxxx Num CPUs: 4 Phys Memory (MB): 2
    ~~~~
    Snapshot Snap Id Snap Time Sessions Curs/Sess Comment
    ~~~~~~~~ ---------- ------------------ -------- --------- -------------------
    Begin Snap: 1747 11-Aug-09 23:23:46 96 7.6
    End Snap: 1752 11-Aug-09 23:34:00 218 12.5
    Elapsed: 10.23 (mins)
    Cache Sizes Begin End
    ~~~~~~~~~~~ ---------- ----------
    Buffer Cache: 2,864M Std Block Size: 8K
    Shared Pool Size: 656M Log Buffer: 29,855K
    Load Profile Per Second Per Transaction
    ~~~~~~~~~~~~ --------------- ---------------
    Redo size: 8,051,891.15 5,042.02
    Logical reads: 289,821.64 181.48
    Block changes: 49,889.55 31.24
    Physical reads: 197.76 0.12
    Physical writes: 717.84 0.45
    User calls: 1,908.82 1.20
    Parses: 962.84 0.60
    Hard parses: 0.25 0.00
    Sorts: 591.85 0.37
    Logons: 0.35 0.00
    Executes: 25,757.48 16.13
    Transactions: 1,596.96
    % Blocks changed per Read: 17.21 Recursive Call %: 94.11
    Rollback per transaction %: 26.58 Rows per Sort: 628.58
    Instance Efficiency Percentages
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Buffer Nowait %: 99.97 Redo NoWait %: 100.00
    Buffer Hit %: 99.93 In-memory Sort %: 100.00
    Library Hit %: 100.01 Soft Parse %: 99.97
    Execute to Parse %: 96.26 Latch Hit %: 99.78
    Parse CPU to Parse Elapsd %: 91.30 % Non-Parse CPU: 99.31
    Shared Pool Statistics Begin End
    Memory Usage %: 47.56 49.99
    % SQL with executions>1: 60.62 73.55
    % Memory for SQL w/exec>1: 77.58 84.79
    Top 5 Timed Events Avg %Total
    ~~~~~~~~~~~~~~~~~~ wait Call
    Event Waits Time (s) (ms) Time
    CPU time 1,362 31.6
    log file sync 16,960 1,264 75 29.4
    PL/SQL lock timer 10 586 58606 13.6
    buffer busy waits 57,444 388 7 9.0
    enq: TX - row lock contention 12,036 298 25 6.9
    Host CPU (CPUs: 4)
    ~~~~~~~~ Load Average
    Begin End User System Idle WIO WCPU
    0.20 10.74 53.82 9.51 36.67
    Note: There is a 8% discrepancy between the OS Stat total CPU time and
    the total CPU time estimated by Statspack
    OS Stat CPU time: 2261(s) (BUSY_TIME + IDLE_TIME)
    Statspack CPU time: 2456(s) (Elapsed time * num CPUs in end snap)
    Instance CPU
    ~~~~~~~~~~~~
    % of total CPU for Instance: 63.51
    % of busy CPU for Instance: 100.30
    %DB time waiting for CPU - Resource Mgr:
    Memory Statistics Begin End
    ~~~~~~~~~~~~~~~~~ ------------ ------------
    Host Mem (MB): 1.9 .0
    SGA use (MB): 3,584.0 3,584.0
    PGA use (MB): 164.2 258.5
    % Host Mem used for SGA+PGA: 194875.2 8987233.1
    Avg
    %Time Total Wait wait Waits
    Event Waits -outs Time (s) (ms) /txn
    log file sync 16,960 4 1,264 75 0.0
    PL/SQL lock timer 10 100 586 58606 0.0
    buffer busy waits 57,444 0 388 7 0.1
    enq: TX - row lock contention 12,036 0 298 25 0.0
    log file parallel write 11,870 0 163 14 0.0
    db file sequential read 21,324 0 95 4 0.0
    log file sequential read 3,963 0 47 12 0.0
    db file scattered read 22,614 0 29 1 0.0
    log file switch completion 102 17 28 272 0.0
    latch: cache buffers chains 5,829 0 11 2 0.0
    Log archive I/O 4,346 0 9 2 0.0
    enq: TX - index contention 1,153 0 7 6 0.0
    latch free 1,483 0 4 3 0.0
    control file parallel write 328 0 4 11 0.0
    control file sequential read 1,593 0 2 1 0.0
    latch: enqueue hash chains 337 0 2 6 0.0
    buffer deadlock 1,091 99 2 2 0.0
    Segments by Logical Reads DB/Inst: apple22A/apple22a Snaps: 1747-1752
    -> End Segment Logical Reads Threshold: 10000
    -> Pct Total shows % of logical reads for each top segment compared with total
    logical reads for all segments captured by the Snapshot
    Subobject Obj. Logical Pct
    Owner Tablespace Object Name Name Type Reads Total
    TPCCDB TPCCDB NEW_ORDER TABLE 89,638,240 51.4
    TPCCDB TPCCDB PK_STOCK INDEX 22,913,776 13.1
    TPCCDB TPCCDB PK_ORDER_LINE INDEX 14,941,264 8.6
    TPCCDB TPCCDB PK_O_ORDER INDEX 10,503,040 6.0
    TPCCDB TPCCDB ORDER_LINE TABLE 6,368,896 3.7
    Segments by Physical Reads DB/Inst: apple22A/apple22a Snaps: 1747-1752
    -> End Segment Physical Reads Threshold: 1000
    Subobject Obj. Physical Pct
    Owner Tablespace Object Name Name Type Reads Total
    TPCCDB TPCCDB NEW_ORDER TABLE 49 12.2
    TPCCDB TPCCDB WAREHOUSE TABLE 49 12.2
    TPCCDB TPCCDB DISTRICT TABLE 49 12.2
    TPCCDB TPCCDB INDEX_NO_D_ID INDEX 49 12.2
    TPCCDB TPCCDB PK_NEW_ORDER INDEX 49 12.2
    SQL Memory Statistics DB/Inst: apple22A/apple22a Snaps: 1747-1752
    Begin End % Diff
    Avg Cursor Size (KB): 65.12 67.79 3.95
    Cursor to Parent ratio: 1.03 1.02 -.08
    Total Cursors: 560 620 9.68
    Total Parents: 546 605 9.75
    init.ora Parameters DB/Inst: apple22A/apple22a Snaps: 1747-1752
    End value
    Parameter Name Begin value (if different)
    aq_tm_processes 1
    audit_file_dest /rdbms/oracle/apple22i/64/admin/o
    background_dump_dest /rdbms/oracle/apple22i/64/admin/o
    commit_write BATCH,NOWAIT
    compatible 10.2.0.1.0
    control_files /rdbms/oracle/apple22i/64/oradata
    core_dump_dest /rdbms/oracle/apple22i/64/admin/o
    cursor_sharing EXACT
    db_block_size 8192
    db_domain yyyyyyy
    db_file_multiblock_read_count 16
    db_name apple22a
    db_recovery_file_dest /rdbms/oracle/apple22i/64/flash_r
    db_recovery_file_dest_size 2147483648
    dispatchers (PROTOCOL=TCP) (SERVICE=apple22aX
    dml_locks 30028
    global_names TRUE
    job_queue_processes 10
    log_archive_dest_1 LOCATION=/perf0/Archivelog_10g_ch
    log_archive_format arch_%t_%s_%r.dbf
    log_buffer 30571520
    open_cursors 300
    pga_aggregate_target 524288000
    processes 2000
    remote_login_passwordfile EXCLUSIVE
    sessions 2205
    sga_max_size 3758096384
    sga_target 3758096384
    transactions 7507
    undo_management AUTO
    undo_tablespace UNDOTBS1
    user_dump_dest /rdbms/oracle/apple22i/64/admin/o
    -------------------------------------------------------------

    Process Memory Summary Stats  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> B: Begin snap   E: End snap
    -> All rows below contain absolute values (i.e. not diffed over the interval)
    -> Max Alloc is Maximum PGA Allocation size at snapshot time
       Hist Max Alloc is the Historical Max Allocation for still-connected processes
    -> Num Procs or Allocs:  For Begin/End snapshot lines, it is the number of
       processes. For Category lines, it is the number of allocations
    -> ordered by Begin/End snapshot, Alloc (MB) desc
                                                                      Hist   Num
                                              Avg    Std Dev   Max    Max   Procs
                 Alloc     Used    Freeabl   Alloc    Alloc   Alloc  Alloc    or
      Category   (MB)      (MB)      (MB)     (MB)    (MB)    (MB)    (MB)  Allocs
    B --------     192.0      95.1      8.8      2.0     6.4      51     55     97
      Other        179.0                         1.8     6.3      50     54     97
      Freeable       8.8        .0                .8      .6       2            11
      PL/SQL         2.7       1.4                .0      .0       0      0     95
      SQL            2.0       1.0                .0      .0       0      2     58
    E --------     311.2     166.7     11.3      1.4     4.3      52     55    220
      Other        284.0                         1.3     4.1      49     52    220
      Freeable      11.4        .0               1.0     1.0       3            11
      PL/SQL        10.0       5.4                .0      .0       0      0    218
      SQL            5.8       2.8                .0      .0       0      2    208
    Top Process Memory (by component)  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> ordered by Begin/End snapshot, Alloc (MB) desc
                            Alloc   Used   Freeabl     Max      Hist Max
         PId Category       (MB)    (MB)     (MB)   Alloc (MB) Alloc (MB)
    B      5 DBW0 --------    51.3    22.5      1.0       51.3       54.8
             Other            50.3                        50.3       53.8
             Freeable          1.0      .0                 1.0
             PL/SQL             .0      .0                  .0         .0
           6 LGWR --------    24.7    11.7       .1       24.7       25.5
             Other            24.5                        24.5       25.4
             Freeable           .1      .0                  .1
             PL/SQL             .0      .0                  .0         .0
          16 ARC0 --------    21.9    10.3       .0       21.9       21.9
             Other            21.9                        21.9       21.9
             PL/SQL             .0      .0                  .0         .0
          17 ARC1 --------    21.9    10.3       .0       21.9       21.9
             Other            21.9                        21.9       21.9
             PL/SQL             .0      .0                  .0         .0
          54 TNS V1-V3 ---     4.4     1.3      1.7        4.4        4.4
             Other             2.6                         2.6        2.6
             Freeable          1.7      .0                 1.7
             SQL                .2      .1                  .2        2.3
             PL/SQL             .0      .0                  .0         .0
          11 MMON --------     3.5     1.6      1.3        3.5        3.6
             Other             2.1                         2.1        2.1
             Freeable          1.3      .0                 1.3
             SQL                .1      .0                  .1        1.1
             PL/SQL             .0      .0                  .0         .1
           8 SMON --------     2.8      .7      1.9        2.8        2.8
             Freeable          1.9      .0                 1.9
             Other              .8                          .8         .8
             SQL                .1      .0                  .1         .6
             PL/SQL             .0      .0                  .0         .0
          10 CJQ0 --------     1.6      .6       .8        1.6        1.7
             Freeable           .8      .0                  .8
             Other              .7                          .7         .7
             SQL                .1      .0                  .1         .6
             PL/SQL             .0      .0                  .0         .0
          20 q000 --------     1.6      .7       .2        1.6        1.6
             Other             1.3                         1.3        1.3
             Freeable           .2      .0                  .2
             SQL                .1      .1                  .1         .5
             PL/SQL             .0      .0                  .0         .0
          24  ------------     1.6      .6       .3        1.6        1.6
             Other             1.2                         1.2        1.2
             Freeable           .3      .0                  .3
             SQL                .1      .0                  .1         .6
             PL/SQL             .1      .0                  .1         .1
           7 CKPT --------     1.4      .4       .8        1.4        2.3
             Freeable           .8      .0                  .8
             Other              .6                          .6        1.4
             SQL                .0      .0                  .0         .1
             PL/SQL             .0      .0                  .0         .0
           9 RECO --------     1.2      .5       .6        1.2        1.2
             Freeable           .6      .0                  .6
             Other              .5                          .5         .5
             SQL                .1      .1                  .1         .5
    Top Process Memory (by component)  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> ordered by Begin/End snapshot, Alloc (MB) desc
                            Alloc   Used   Freeabl     Max      Hist Max
         PId Category       (MB)    (MB)     (MB)   Alloc (MB) Alloc (MB)
    B      9 PL/SQL             .0      .0                  .0         .0
          21  ------------     1.1      .5       .0        1.1        1.1
             Other             1.0                         1.0        1.0
             PL/SQL             .0      .0                  .0         .0
             SQL                .0      .0                  .0         .2
          31  ------------     1.1      .6       .1        1.1        1.1
             Other              .9                          .9         .9
             SQL                .1      .0                  .1         .2
             Freeable           .1      .0                  .1
             PL/SQL             .1      .0                  .1         .1
    E      5 DBW0 --------    52.4    23.4      3.3       52.4       54.8
             Other            49.2                        49.2       51.5
             Freeable          3.3      .0                 3.3
             PL/SQL             .0      .0                  .0         .0
           6 LGWR --------    24.7    11.7       .1       24.7       25.5
             Other            24.5                        24.5       25.4
             Freeable           .1      .0                  .1
             PL/SQL             .0      .0                  .0         .0
          16 ARC0 --------    21.9    10.3       .0       21.9       21.9
             Other            21.9                        21.9       21.9
             PL/SQL             .0      .0                  .0         .0
          17 ARC1 --------    21.9    10.3       .0       21.9       21.9
             Other            21.9                        21.9       21.9
             PL/SQL             .0      .0                  .0         .0
          54 TNS V1-V3 ---     4.6     1.3      1.9        4.6        4.6
             Other             2.4                         2.4        2.4
             Freeable          2.1      .0                 2.1
             SQL                .1      .1                  .1        2.5
             PL/SQL             .0      .0                  .0         .0
          11 MMON --------     3.5     1.6      1.3        3.5        3.6
             Other             2.1                         2.1        2.1
             Freeable          1.3      .0                 1.3
             SQL                .1      .0                  .1        1.1
             PL/SQL             .0      .0                  .0         .1
           8 SMON --------     2.8      .7      1.8        2.8        2.8
             Freeable          1.8      .0                 1.8
             Other             1.0                         1.0        1.0
             SQL                .1      .0                  .1         .6
             PL/SQL             .0      .0                  .0         .0
          10 CJQ0 --------     1.6      .6       .8        1.6        1.7
             Freeable           .8      .0                  .8
             Other              .7                          .7         .7
             SQL                .1      .0                  .1         .6
             PL/SQL             .0      .0                  .0         .0
          20 q000 --------     1.6      .7       .2        1.6        1.6
             Other             1.3                         1.3        1.3
             Freeable           .2      .0                  .2
             SQL                .1      .1                  .1         .5
             PL/SQL             .0      .0                  .0         .0
          24  ------------     1.6      .6       .6        1.6        1.6
             Other              .9                          .9         .9
             Freeable           .6      .0                  .6
             SQL                .1      .0                  .1         .6
    Top Process Memory (by component)  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> ordered by Begin/End snapshot, Alloc (MB) desc
                            Alloc   Used   Freeabl     Max      Hist Max
         PId Category       (MB)    (MB)     (MB)   Alloc (MB) Alloc (MB)
    E     24 PL/SQL             .1      .0                  .1         .1
           7 CKPT --------     1.5      .4       .7        1.5        2.3
             Other              .8                          .8        1.5
             Freeable           .7      .0                  .7
             SQL                .0      .0                  .0         .1
             PL/SQL             .0      .0                  .0         .0
           9 RECO --------     1.2      .5       .6        1.2        1.2
             Freeable           .6      .0                  .6
             Other              .5                          .5         .5
             SQL                .1      .1                  .1         .5
             PL/SQL             .0      .0                  .0         .0
         219  ------------     1.2      .5       .0        1.2        1.2
             Other             1.1                         1.1        1.1
             PL/SQL             .0      .0                  .0         .0
             SQL                .0      .0                  .0         .2
          21  ------------     1.1      .5       .0        1.1        1.1
             Other             1.0                         1.0        1.0
             PL/SQL             .0      .0                  .0         .0
             SQL                .0      .0                  .0         .2
          31  ------------     1.1      .6       .1        1.1        1.1
             Other              .9                          .9         .9
             SQL                .1      .0                  .1         .2
             Freeable           .1      .0                  .1
             PL/SQL             .1      .0                  .1         .1
         205  ------------     1.1      .5       .0        1.1        1.1
             Other             1.0                         1.0        1.0
             PL/SQL             .1      .0                  .1         .1
             SQL                .0      .0                  .0         .1
          27  ------------     1.1      .5       .0        1.1        1.1
             Other             1.0                         1.0        1.0
             PL/SQL             .1      .0                  .1         .1
             SQL                .0      .0                  .0         .1
         158  ------------     1.1      .5       .0        1.1        1.1
             Other             1.0                         1.0        1.0
             PL/SQL             .1      .0                  .1         .1
             SQL                .0      .0                  .0         .1
         172  ------------     1.1      .5       .0        1.1        1.1
             Other             1.0                         1.0        1.0
             PL/SQL             .1      .0                  .1         .1
             SQL                .0      .0                  .0         .1
    Enqueue activity  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> only enqueues with waits are shown
    -> Enqueue stats gathered prior to 10g should not be compared with 10g data
    -> ordered by Wait Time desc, Waits desc
    Enqueue Type (Request Reason)
        Requests    Succ Gets Failed Gets       Waits Wt Time (s)  Av Wt Time(ms)
    TX-Transaction (row lock contention)
         106,475      106,474           0     106,341       20,273         190.64
    TX-Transaction (index contention)
          44,355       44,355           0      44,319        2,784          62.81
    TX-Transaction (allocate ITL entry)
             184          184           0         182            9          46.81
    HW-Segment High Water Mark
           1,975        1,975           0          70            5          66.29
    FB-Format Block
           2,164        2,164           0          50            3          54.60
    TX-Transaction
         394,649      394,668           0          30            0           4.33
    Undo Segment Summary  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> Min/Max TR (mins) - Min and Max Tuned Retention (minutes)
    -> STO - Snapshot Too Old count,  OOS - Out Of Space count
    -> Undo segment block stats:
       uS - unexpired Stolen,   uR - unexpired Released,   uU - unexpired reUsed
       eS - expired   Stolen,   eR - expired   Released,   eU - expired   reUsed
    Undo   Num Undo       Number of  Max Qry     Max Tx Min/Max   STO/  uS/uR/uU/
    TS# Blocks (K)    Transactions  Len (s)      Concy TR (mins) OOS   eS/eR/eU
       1      117.7         322,423       49         73 15/15     0/0   0/0/0/0/0/0
    Undo Segment Stats  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> Most recent 35 Undostat rows, ordered by End Time desc
                    Num Undo    Number of Max Qry  Max Tx Tun Ret STO/  uS/uR/uU/
    End Time          Blocks Transactions Len (s)   Concy  (mins) OOS   eS/eR/eU
    17-Aug 03:40     117,733      322,423      49      73      15 0/0   0/0/0/0/0/0
    Latch Activity  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    ->"Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
      willing-to-wait latch get requests
    ->"NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
    ->"Pct Misses" for both should be very close to 0.0
                                               Pct    Avg   Wait                 Pct
                                  Get          Get   Slps   Time       NoWait NoWait
    Latch                       Requests      Miss  /Miss    (s)     Requests   Miss
    Consistent RBA                    3,517    0.0             0            0
    FAL request queue                    11    0.0             0            0
    FAL subheap alocation                11    0.0             0            0
    FIB s.o chain latch                  20    0.0             0            0
    FOB s.o list latch                  361    0.0             0            0
    JS mem alloc latch                    2    0.0             0            0
    JS queue access latch                 2    0.0             0            0
    JS queue state obj latch          3,706    0.0             0            0
    JS slv state obj latch               16    0.0             0            0
    KGX                                   0                    0      353,668    6.5
    KMG MMAN ready and start            636    0.0             0            0
    KMG resize request state             27   33.3    1.0      0            0
    KTF sga latch                         2    0.0             0          165    0.0
    KWQP Prop Status                      4    0.0             0            0
    MQL Tracking Latch                    0                    0           11    0.0
    Memory Management Latch             660    0.2    0.0      0          624    0.0
    OS process                          294    0.0             0            0
    OS process allocation               507    0.0             0            0
    OS process: request allo            333    0.0             0            0
    PL/SQL warning settings         270,940    0.3    0.0      0            0
    SGA IO buffer pool latch          2,654    0.0             0        5,801    0.0
    SQL memory manager latch              4    0.0             0          158    0.0
    SQL memory manager worka         11,158    0.0             0            0
    Shared B-Tree                        29    0.0             0            0
    active checkpoint queue           8,205    0.0             0            0
    active service list               2,335    0.0    0.0      0          174    0.0
    archive control                      13    0.0             0            0
    archive process latch               171    0.0             0            0
    buffer pool                         139    0.0             0            0
    cache buffer handles             46,062    0.1    0.0      0            0
    cache buffers chains        457,192,374    0.2    0.0   1082    3,785,637    0.6
    cache buffers lru chain         447,547    0.5    0.3      8   90,454,746    2.6
    cache table scan latch                0                    0       11,447    0.0
    cas latch                           100    0.0             0            0
    channel handle pool latc            333    0.0             0            0
    channel operations paren          8,286    0.0             0            0
    checkpoint queue latch          199,380    0.0    0.0      0      386,367    0.0
    client/application info           1,208    0.0             0            0
    compile environment latc        791,470    0.0    0.1      1            0
    dml lock allocation           3,552,580    0.5    0.1    117            0
    dummy allocation                    336    0.3    0.0      0            0
    enqueue hash chains           5,288,101    0.3    0.1     45       23,479    0.4
    enqueues                      1,120,394    0.1    0.1      2            0
    event group latch                   239    0.0             0            0
    file cache latch                  2,388    0.0             0            0
    global KZLD latch for me            236    0.0             0            0
    hash table column usage               0                    0        4,564    0.0
    hash table modification              30    0.0             0            0
    job workq parent latch                0                    0            4    0.0
    job_queue_processes para             11    0.0             0            0
    Latch Activity  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    ->"Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
      willing-to-wait latch get requests
    ->"NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
    ->"Pct Misses" for both should be very close to 0.0
                                               Pct    Avg   Wait                 Pct
                                  Get          Get   Slps   Time       NoWait NoWait
    Latch                       Requests      Miss  /Miss    (s)     Requests   Miss
    kks stats                           302    0.0             0            0
    ksuosstats global area               58    0.0             0            0
    ktm global data                     270    0.0             0            0
    kwqbsn:qsga                          29    0.0             0            0
    lgwr LWN SCN                      3,520    0.0             0            0
    library cache                19,899,407    0.4    0.0    199       16,683 ######
    library cache load lock           1,030    0.0             0           63    0.0
    library cache lock               17,688    0.2    0.0      0            0
    library cache lock alloc            990    0.0             0            0
    library cache pin            19,007,237    0.2    0.0     35        1,074    0.0
    library cache pin alloca            681    0.0             0            0
    list of block allocation          1,042    0.1    1.0      0            0
    longop free list parent               8    0.0             0           16   12.5
    messages                         38,525    0.0    0.0      0            0
    mostly latch-free SCN         2,543,316    0.1    0.0      0            0
    multiblock read objects          30,207    0.0    1.0      0            0
    ncodef allocation latch               8    0.0             0            0
    object queue header heap             10    0.0             0        1,365    0.0
    object queue header oper      1,198,162    0.1    0.1      0            0
    object stats modificatio            832    0.0             0            0
    parallel query alloc buf             64    0.0             0            0
    parameter table allocati            116    1.7    0.5      0            0
    post/wait queue                  28,580    0.4    0.0      0        8,842    0.0
    process allocation                  333    0.0             0          239    0.0
    process group creation              333    0.0             0            0
    qmn state object latch                1    0.0             0            0
    qmn task queue latch                124    0.0             0            0
    redo allocation                  22,668    2.0    0.2      1    9,366,319    0.5
    redo copy                            13   76.9    1.3      0    9,367,099    0.4
    redo on-disk SCN                 11,212    0.0             0            0
    redo writing                     23,270    0.0    0.0      0            0
    resmgr group change latc            244    0.0             0            0
    resmgr:actses active lis            347    0.0             0            0
    resmgr:actses change gro            238    0.0             0            0
    resmgr:free threads list            335    0.3    0.0      0            0
    resmgr:schema config                 12    0.0             0            0
    rm cas latch                      1,038    0.0             0            0
    row cache objects               464,390    0.0    0.0      0            0
    rules engine rule set st            400    0.0             0            0
    sequence cache                      752    0.0             0            0
    session allocation            1,627,067    0.2    0.0      1            0
    session idle bit              1,875,662    0.0    0.0      0            0
    session state list latch            486    0.0             0            0
    session switching                     8    0.0             0            0
    session timer                       174    0.0             0            0
    shared pool                      58,091    0.3    0.3      1            0
    simulator hash latch         32,009,012    0.0    0.0      0            0
    simulator lru latch          20,996,297    4.9    0.0   1243       15,131    0.2
    slave class                           1    0.0             0            0
    slave class create                    3    0.0             0            0
    Latch Activity  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    ->"Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
      willing-to-wait latch get requests
    ->"NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
    ->"Pct Misses" for both should be very close to 0.0
                                               Pct    Avg   Wait                 Pct
                                  Get          Get   Slps   Time       NoWait NoWait
    Latch                       Requests      Miss  /Miss    (s)     Requests   Miss
    sort extent pool                    100    0.0             0            0
    threshold alerts latch               29    0.0             0            0
    transaction allocation              965    0.0             0            0
    transaction branch alloc              8    0.0             0            0
    undo global data             24,845,984    0.2    0.0     20            0
    user lock                           658    4.4    0.9      1            0
    Latch Sleep breakdown  DB/Inst: apple22A/apple22a  Snaps: 2147-2151
    -> ordered by misses desc
                                           Get                                 Spin
    Latch Name                        Requests       Misses      Sleeps        Gets
    simulator lru latch             20,996,297    1,020,829      20,140   1,003,339
    cache buffers chains           457,192,374    1,016,828      24,247     994,418
    library cache                   19,899,407       86,387       3,201      83,529
    undo global data                24,845,984       42,072         497      41,638
    library cache pin               19,007,237       36,024         619      35,469
    dml lock allocation              3,552,580       17,725       1,223      16,696
    enqueue hash chains              5,288,101       14,754       1,086      13,773
    simulator hash latch            32,009,012        7,219          54       7,171
    session allocation               1,627,067        2,489         117       2,385
    cache buffers lru chain            447,547        2,278         583       1,792
    mostly latch-free SCN            2,543,316        1,814          14       1,802
    enqueues                         1,120,394        1,253          89       1,172
    object queue header operat       1,198,162        1,010          52         965
    PL/SQL warning settings            270,940          682           5         677
    redo allocation                     22,668          448          71         389
    session idle bit                 1,875,662          387           8         380
    compile environment latch          791,470          176          12         165
    shared pool                         58,091          171          48         127
    checkpoint queue latch             199,380           33           1          32
    user lock                              658           29          25           5
    redo copy                               13           10          13           0
    KMG resize request state o              27            9           9           0
    parameter table allocation             116            2           1           1
    multiblock read objects             30,207            1           1           0
    list of block allocation             1,042            1           1           0
              -------------------------------------------------------------Edited by: praveenkumaar on Aug 18, 2009 4:07 AM

Maybe you are looking for

  • Pages and numbers  Ipad : How to convert pages and numbers to word and xls?

    Hello everyone, I am currently using Pages and Numbers for Ipad. As I am currently working on these two programs and with their equivalent for PC (Word and Excel) for my research project, I would like to know how I can convert respectively the page a

  • SAP HR Placement ( Urgent )

    Hi , I have several years of IT experience in SAP HR Modules  and am new to United States of America and am looking for new projects here .do you know anybody who can placed me very quickly. I am hoping my sap business and management knowledge in mul

  • How to draw an array of imageIcons in java

    Hi, I am working on a UI in which i need images taken from a local path to be listed out in the panels . I have two panels one left and one right . half set of images shuld get listed in left panel and the other half shuld get listed in the right pan

  • Les restaurations

    Bonjour, Mon iPod a eu besoin de 2 restaurations déjà depuis le peu de temps que je le possède. Mais pour votre service technique il n'est pas question de le changer même si je devais faire une restauration tous les deux jours. Je trouve vraiment cet

  • How to get internet on a blackberry storm 9350 unlocked?

    i have a blackberry storm 9350 n i want to ask how to get internet on a blackberry storm 9350 unlocked?