How to measure undo at a session level

Below is what are trying to do.
We are trying to implement Oracle's table block compression feature.
In doing so, in one of our testing we discovered that the session performing the DML (inserts) generated almost 30x undo.
We measured this undo by using below query (before the transaction commited).
SELECT a.sid, a.username, used_ublk, used_ublk*8192 bytes
FROM v$session a, v$transaction b
WHERE a.saddr = b.ses_addr
However, above is at a transaction level since it still not committed, we would lose this value once the transaction either committed or rolled back, for this reason, we are trying to find an equivalent statistic at a session level.
1. What we are trying to find it out whether if an equivalent session level statistic exist to measure the amount of undo generated?
2. Is the undo generated always in terms of "undo blocks?"
3. When querying v$statname for name like '%undo%' we came across several statistics, the closest one
undo change vector size -in bytes?
4. desc test_table;
Name Type
ID NUMBER
sql> insert into test_table values (1);
5. However when we run the query against:
SELECT s.username,sn.name, ss.value
FROM v$sesstat ss, v$session s, v$statname sn
WHERE ss.sid = s.sid
AND sn.statistic# = ss.statistic#
AND s.sid =204
AND sn.name ='undo change vector size'
SID USERNAME NAME BYTES
204 NP4 undo change vector size 492
6. Query against: v$transaction
SELECT a.sid, a.username, used_ublk, used_ublk*8192 bytes
FROM v$session a, v$transaction b
WHERE a.saddr = b.ses_addr
SID USED_UBLK BYTES
204 1 8192
What are trying to understand is:
1. How can we or what is the correct statistic to determine how many undo blocks were generated by particular session?
2. What is the statistic: undo change vector size? What does it really mean? or measure?

Any transaction that generates Undo will use Undo Blocks in multiples of 1 --- i.e. the minimum allocation on disk is 8KB.
Furthermore, an Undo_Rec does not translate to a Table Row. The Undo has to capture changes to Indexes, block splits, other actions. Multiple changes to the same table/index block may be collapsed into one undo record/block etc etc.
Therefore, a transaction that generated 492 bytes of Undo would use 8KB of undo space because that is the minimum allocation.
You need to test with larger transactions.
SQL> update P_10 set col_2='ABC2' where mod(col_1,10)=0;
250000 rows updated.
SQL>
SQL> @active_transactions
       SID    SERIAL# SPID         USERNAME     PROGRAM                       XIDUSN  USED_UBLK  USED_UREC
       143        542 17159        HEMANT       sqlplus@DG844 (TNS V1-V3)          6       5176     500000
Statistic : db block changes                                      1,009,903
Statistic : db block gets                                         1,469,623
Statistic : redo entries                                            502,507
Statistic : redo size                                           117,922,016
Statistic : undo change vector size                              41,000,368
Statistic : table scan blocks gotten                                 51,954
Statistic : table scan rows gotten                               10,075,245Hemant K Chitale

Similar Messages

  • Change sysdate on session level

    Hi,
    I am using Oracle 10.2.0.4 database.
    My Application server is in USA and my database is in Germany. So we have 6 hours time difference between. So i need to set the sysdate to USA timings for a session who logs from USA.
    How to change the sysdate in session level.
    Regards,
    Nv
    Edited by: ORCLDB on Oct 24, 2011 2:33 PM

    Thanks for the help !.
    Is it possible some way by setting time_zone parameter. I tried as below
    SQL> alter session set time_zone='Europe/Zurich';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    24.10.11
    SQL> select to_char(sysdate,'dd-mm-yyyy hh24:mi:ss') from dual;
    TO_CHAR(SYSDATE,'DD
    24-10-2011 14:37:02
    SQL>  SELECT CURRENT_TIMESTAMP,SYSTIMESTAMP FROM DUAL;
    CURRENT_TIMESTAMP                                                           SYSTIMESTAMP
    24.10.11 11:08:01,281000 EUROPE/ZURICH                                      24.10.11 14:38:01,281000 +05:30But sysdate is not changing only current_timestamp changes.
    Regards,
    Nv

  • How to Use Transient View Objects to Store Session-level Global Variables

    hi
    Please consider section "40.8.5 How to Use Transient View Objects to Store Session-level Global Variables"
    at http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcstatemgmt.htm#ADFFD19610
    Based on this documentation I created the example application
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.01.zip
    It behaves as show in the screencast at http://screencast.com/t/qDvSQCgpvYdd
    Its Application Module has a Transient View Object instance "MyEmployeesContextVOVI", as master for the child View Object instance "EmpInCtxJobVI".
    On rollback the Transient View Object instance keeps its row and attribute values.
    Also when passivation and activation is forced (using jbo.ampool.doampooling=false ) the Transient View Object instance seems to keep its row and attribute values.
    questions:
    - (q1) Why does the expression #{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty} evaluate as true when a Transient View Object instance attribute value is changed (as shown in screencast at http://screencast.com/t/qDvSQCgpvYdd )?
    - (q2) What would be a robust approach to make a Transient View Object instance more self-contained, and manage itself to have only one single row (per instance) at all times (and as such removing the dependency on the Application Module prepareSession() as documented in "5. Create an empty row in the view object when a new user begins using the application module.")?
    many thanks
    Jan Vervecken

    Thanks for your reply Frank.
    q1) Does sample 90 help ? http://blogs.oracle.com/smuenchadf/examples/
    Yes, the sample from Steve Muench does help, "90. Avoiding Dirtying the ADF Model Transaction When Transient Attributes are Set [10.1.3] "
    at http://blogs.oracle.com/smuenchadf/examples/#90
    It does point out a difference in marking transactions dirty by different layers of the framework, "... When any attribute's value is changed through an ADFM binding, the ADFM-layer transaction is marked as dirty. ...".
    This can be illustrate with a small change in the example application
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.02.zip
    It now shows the result of both these expressions on the page ...
    #{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty}
    #{bindings.MyEmployeesContextVOVIIterator.dataControl.dataProvider.transaction.dirty}... where one can be true and the other false respectively.
    See also the screencast at http://screencast.com/t/k8vgNqdKgD
    Similar to the sample from Steve Muench, another modification to the example application introduces MyCustomADFBCDataControl
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.03.zip
    public class MyCustomADFBCDataControl
      extends JUApplication
      @Override
      public void setTransactionModified()
        ApplicationModule vApplicationModule = (ApplicationModule)getDataProvider();
        Transaction vTransaction = vApplicationModule.getTransaction();
        if (vTransaction.isDirty())
          super.setTransactionModified();
    }Resulting in what seems to be more consistent/expected transaction (dirty) information,
    see also the screencast at http://screencast.com/t/756yCs1L1
    Any feedback on why the ADF Model layer is so eager to mark a transaction dirty is always welcome.
    Currently, question (q2) remains.
    regards
    Jan

  • How to undo activated OSB session with WLST?

    Does anybody know if there´s a chance to undo an activated OSB session with WLST?
    There´s a way to undo an UNactivated session but not an activated one (like the undo session in /sbconsole).
    Thanks in advance.
    Edited by: 956378 on 31-ago-2012 12:48

    "zone copy active-zoneset full-zoneset vsan 2" is the correct command.  It will overwrite the full zoneset (identical) and ready to edit.

  • How to measure the performance of sql query?

    Hi Experts,
    How to measure the performance, efficiency and cpu cost of a sql query?
    What are all the measures available for an sql query?
    How to identify i am writing optimal query?
    I am using Oracle 9i...
    It ll be useful for me to write efficient query....
    Thanks & Regards

    psram wrote:
    Hi Experts,
    How to measure the performance, efficiency and cpu cost of a sql query?
    What are all the measures available for an sql query?
    How to identify i am writing optimal query?
    I am using Oracle 9i... You might want to start with a feature of SQL*Plus: The AUTOTRACE (TRACEONLY) option which executes your statement, fetches all records (if there is something to fetch) and shows you some basic statistics information, which include the number of logical I/Os performed, number of sorts etc.
    This gives you an indication of the effectiveness of your statement, so that can check how many logical I/Os (and physical reads) had to be performed.
    Note however that there are more things to consider, as you've already mentioned: The CPU bit is not included in these statistics, and the work performed by SQL workareas (e.g. by hash joins) is also credited only very limited (number of sorts), but e.g. it doesn't cover any writes to temporary segments due to sort or hash operations spilling to disk etc.
    You can use the following approach to get a deeper understanding of the operations performed by each row source:
    alter session set statistics_level=all;
    alter session set timed_statistics = true;
    select /* findme */ ... <your query here>
    SELECT
             SUBSTR(LPAD(' ',DEPTH - 1)||OPERATION||' '||OBJECT_NAME,1,40) OPERATION,
             OBJECT_NAME,
             CARDINALITY,
             LAST_OUTPUT_ROWS,
             LAST_CR_BUFFER_GETS,
             LAST_DISK_READS,
             LAST_DISK_WRITES,
    FROM     V$SQL_PLAN_STATISTICS_ALL P,
             (SELECT *
              FROM   (SELECT   *
                      FROM     V$SQL
                      WHERE    SQL_TEXT LIKE '%findme%'
                               AND SQL_TEXT NOT LIKE '%V$SQL%'
                               AND PARSING_USER_ID = SYS_CONTEXT('USERENV','CURRENT_USERID')
                      ORDER BY LAST_LOAD_TIME DESC)
              WHERE  ROWNUM < 2) S
    WHERE    S.HASH_VALUE = P.HASH_VALUE
             AND S.CHILD_NUMBER = P.CHILD_NUMBER
    ORDER BY ID
    /Check the V$SQL_PLAN_STATISTICS_ALL view for more statistics available. In 10g there is a convenient function DBMS_XPLAN.DISPLAY_CURSOR which can show this information with a single call, but in 9i you need to do it yourself.
    Note that "statistics_level=all" adds a significant overhead to the processing, so use with care and only when required:
    http://jonathanlewis.wordpress.com/2007/11/25/gather_plan_statistics/
    http://jonathanlewis.wordpress.com/2007/04/26/heisenberg/
    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/

  • How to reduce buffer busy waits, session hanging due to buffer busy waits

    Hi,
    How to reduce buffer busy waits, session hanging due to buffer busy waits.
    Thanks,
    Sathis.

    When I see through enterprise manager I see lot of
    tables with buffer busy waits.
    Is there any way by table name we can check the
    blocks info.
    The simple way is to look at the SQL statement and corresponding table name?
    P1=file#, P2=block#. You can extract segment name(table or index) using this info.
    Query v$bh like following:
    SQL> select file#, block#, class#, objd from v$bh where file# = P1 and block# = P2;
    SQL> select object_name from all_objects where object_id = <objd>;See following doc:
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_1051.htm
    Or you can dump block:
    SQL> alter system dump datafie <P1> block <P2>;Some excerpts from block dump:
    scn: 0x07df.17e70782 seq: 0x01 flg: 0x04 tail: 0x07822301
    frmt: 0x02 chkval: 0x61d0 type: 0x23=PAGETABLE SEGMENT HEADER
    Map Header:: next  0x00000000  #extents: 1    obj#: 55881  flag: 0x10000000>
    Can we do something at table level that will reduce
    the waits.
    Yes, some methods are known. But before thinking of that, you must verify which block class and which access are involved.
    Typo... always. :(
    Message was edited by:
    Dion_Cho

  • Setting Session level parameter in FORMS 10g

    Hi folks,
    I want to setup session level setting for NLS DATE FORMAT in FORMS 10g at environment settings. because, i can't change these setting at database level. b,cz different client applications (i.e. .NET,Forms 10g and SQL PLUS) using different settings.
    So, i want to set this NLS DATE FORMAT for SESSION level in FORMS 10g.
    can i include this in default.env, if yes, how to include that one in .env file
    Edited by: user12212962 on Jul 23, 2010 7:18 PM

    No, i want to setup the session parameter for DATE FORMAT. why because, i'm executing oracle stored procedure from forms and this procedure does some logic based on date value.
    In this procedure, i have used all variables as DATE datatype only. and i can't change this procedure due to some other client application's using same procedure like JAVA, .NET, Oracle BI and scheduled jobs. And all these application's working fine, even when i use forms 6i also it's working.
    but when we use FORMS10g, date was treating as DD-MON-RR and all other client applications using DD-MON-YYYY due to session level setting and at database level also has a same format i.e. DD-MON-YYYY. because i logged this NLS value in audit_table when i executed through FORMS10G, JAVA application,.NET
    May be some where it's changing this setting to DD-MON-RR for FORMS10g. Is any settings at Oracle APP server level
    (iAS) for this parameter?

  • How to implement fact tables with finest level of detail (fine-grained)?

    Hi,
    Maybe this is basic knowledge what I'm asking here... I don't know, well, here it goes:
    I need to know the way carry my transactional data to a fact table, but keeping the finest level of detail possible (namely, the transactions). I implemented my cubes with MOLAP option for storage (those were the specs that I had to follow) so I can't add a unique constraint to those structures.
    I only seem to be able to load aggregated, precomputed data. If I wanted to load the transactions (after the data has been transformed and clenased) where should I do it?
    I tried to implement a version of the fact tables as ROLAP but got nowhere (I couldn't add a unique constraint or index on that column either).
    I would really, really appreciate your help.
    Best Regards,
    osvaldo.
    [osantos]

    Hi Veeravalli,
    Thanks for your reply :)
    Let me explain the problem in more detail. I have one Date dimension(Date_Code,Month_Code,Quarter_Code,Half_Year_Code,Year_Code). Here Date_Code is the PK.
    In F1---->Date (Using Month_Code key)
    F2-------->Date (Using Date_Code Key)
    Level based hierarchy is there starting from Year to Date.Each level has PK defined and chronological key selected.
    F1 has level set to Month and F2 has level set to Day.
    Now if i am using ago() function on measure of F2 (having day level data) then it's working fine but if i am using ago() function on measure of F1...I am getting an error at Presentation service: Date_code must be projected for time-series functions.
    So the whole issue is with time-series functions. As per my research...I think for time series the tables in the physical model containing the time dimension cannot join to other data sources, except at the most detailed level but here i am joining with F1(using Month_Code which is not the most detailed level).
    So kindly let me know how to achieve this in rpd?

  • How to measure CPU utilization from Oracle AWR

    Hi All,
    How to measure the cpu usage % from the AWR reports.
    Oracle : 10.2.0.3
    OS : AIX 5300-12-02
    I see the top 5 waited events listing CPU time in it.
    Top 5 Timed Events Avg %Total
    ~~~~~~~~~~~~~~~~~~ wait Call
    Event Waits Time (s) (ms) Time Wait Class
    CPU time 98,655 40.0
    Is it mean that the CPU utilization is full to its 100%. Is there any other way to measure how much an oracle instance is utilizing the CPU ?
    Please advice.
    TIA,
    Nv

    Hi,
    Check this script, if possible run in toad.
    col LastCallET format 99,999
    col cpumins format 99,999
    col status format a1 trunc
    col module format a20
    col username format a15
    col logontime format a12
    col machine format a15 trunc
    col sid format 9999
    select * from (
    select 'P',s.sid, s.status, t.value/100/60 cpumins ,
         floor(last_call_et/60) "LastCallET",
         to_char(s.logon_time,'mm/dd hh24:mi') logontime,
         s.username,s.process, p.spid, s.module , s.machine, s.sql_hash_value
    from v$sesstat t, v$session s, v$process p
    where t.statistic# = 12
    and s.sid = t.sid
    and s.paddr = p.addr
    and s.type = 'USER'
    and s.sql_hash_value != 1425819161
    union
    select 'N',s.sid, s.status, t.value*-1/100/60 cpumins ,
    floor(last_call_et/60) "LastCallET",
    to_char(s.logon_time,'mm/dd hh24:mi') logontime,
    s.username,s.process, p.spid, s.module , s.machine, s.sql_hash_value
    from v$sesstat t, v$session s, v$process p
    where t.statistic# = 12
    and s.sid = t.sid
    and s.paddr = p.addr
    and s.type = 'USER'
    and s.sql_hash_value != 1425819161
    and t.value < 0
    order by 4 desc)
    where rownum < 11
    Regards,
    Satya.

  • Session level auditing

    Hi everyone,
    I need oracle document ID for session-level auditing in oracle 10g.If you 've any steps to do auditing in session level,kindly post it.
    Thanks
    Jaya prataab J

    Do you really mean "audit" as in "information that gets written to the database audit trail"? Or do you mean to ask how to trace a session?
    If you really mean audit as in the SQL statement keyword (i.e. AUDIT SELECT ON emp ...), I'm rather unclear on how you would expect that sort of functionality to work. Auditing is necessarily configured long before the session even exists. And an audit trail that just had audit records from a few select sessions would seem rather pointless as you'd never know what changes were made in unaudited sessions.
    Justin
    Edited by: Justin Cave on Nov 18, 2008 6:22 PM

  • Session level character set

    The below are my character set in my DB
    NLS_CHARACTERSET=WE8ISO8859P1
    NLS_NCHAR_CHARACTERSET=UTF8
    Correct Answer (If I use english language the result is correct)
    ==========
    select product(',','AB_BC ,DE') from dual;
    (AB_BC, DE,,,)
    After altering the parameter at session level to get Japanese character set I am getting wrong result
    ALTER SESSION NLS_SORT=JAPANESE_M_AI
    ALTER SESSION NLS_COMP=LINGUISTICS
    it is giving me wrong result (I should get the above result)
    =================
    select product(',','A_BC ,DE') from dual;
    (AB, BC , DE,,,,)
    How to change at session leavel to get Japanese character set

    Ok,
    Let's provide the broad picture, as your setup and your commands are incorrect.
    You set the characterset of the database to a characterset the O/S supports.
    Whether or not you have characterset conversion on the client side is determined by NLS_LANG.
    You set NLS_LANG to a characterset the client O/S supports. Ie if you are running on Windows (as always you provide no details at all), the regional settings of the O/S must have been set to Japanese.
    WE8ISO8859P1 is the Latin-1 alphabet and doesn't support Kanji.
    Also the command you specify deal with sorting of the data, not with the characterset itself.
    Also no one can tell what
    select product(',','AB_BC ,DE') from dual;
    constitutes.
    In summary: you don't seem to be reading documentation, or you only look at it.
    None of what you have posted makes any sense, and clearly shows you didn't try to understand the NLS concept.
    Yet again: you don't provide platform and version info
    Yet again: you don't specify any background.
    If you want help, you need to provide as much info as possible.
    You should not require anyone here to tear the information out of you.
    After all: everyone here is a volunteer and doesn't get paid to help you out, but is spending his/her time.
    If you want to continue to post in this fashion, maybe you should find a forum of mindreaders.
    Sybrand Bakker
    Senior Oracle DBA

  • How to switch undo tablespace

    Dear all,
    I have created a new undo tablespace named undotbs2, How can i switch all the session use the undotbs2?
    Many sessions are running and using the old undo tablespace named undotbs1.

    user7244870 wrote:
    CKPT wrote:
    Sb has already mentioned links how to manage undo..
    For more reference check this below links.
    http://oracleflash.com/32/Change-or-switch-undo-tablespace-in-Oracle-database.html
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/undo.htm#BABGJBJH
    I can't open the link.
    http://oracleflash.com/32/Change-or-switch-undo-tablespace-in-Oracle-database.html
    Is there a specific reason that you are not willing to read the official doc link?
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/logical.htm#CNCPT1079
    Aman....

  • How to measure pulse/amplitude droop?

    I am trying to figure out how to measure pulse/amplitude droop in the labview.
    Is there any built in VI that perform this measurement?
    Thanks
    DB

    Do you want to measure the 10% to 90% height of the pulse itself or the 10% to 90% change in the pulse level? The suspect the latter, or we would not be having this conversation. If you want to do the former, use Amplitude and Levels.vi or Pulse Parameters.vi and scale by 0.8 to get the 10% to 90%. If you want to get the latter, you may be in for more work. First, try to use the overshoot output of Timing and Transition Measurements or Transition Measurements.vi. Read the documentation, as there is a fair amount of flexibility you can put to your advantage. If that doesn't give you good results, use Pulse Measurements.vi to find your pulse, then extract that section of your waveform. Trim the ends to get rid of the rising and falling edges (this should be a constant number of points if your pulses are consistent). Analyze the result for 10% to 90% values. The easiest way to do this is probably to use the array max and min primitive to give you the maximum and minimum points, then scale by 0.8. Alternately, and more robustly, you can duplicate the waveform a couple of times, concatenate the results, and use Amplitude and Levels.vi to find the amplitude. As a final alternative, you could fit the resulting curve to an appropriate line/polynomial/exponential and extract the info from the curve coefficients. This will only work if the data is a well defined curve. Be careful with general polynomial fits.
    Good luck. Let us know how you make out.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • How to prolong the bluetooth timeout session on ipad and iphone

    how to prolong the bluetooth timeout session on ipad and iphone?
    I understannd that the standard timeout setting is 3 mins. what if I want to prolong the connection duration, how should I do?
    thanks

    To my knowledge, there is no "time out" on a device.  A mouse, KB, etc will go into a low power mode after a short period of non-use.
    Barry

  • How to trace an already running session

    Hi,
    Sometime I come across following situation.
    Queries/SQL statements keep on running for a long time and users complain about the same.
    But since they have already started I am not able do anything about it.
    So please guide me "how can I trace already running session."
    Thanks,
    Rushi

    Rushi Shah wrote:
    Hi,
    Sometime I come across following situation.
    Queries/SQL statements keep on running for a long time and users complain about the same.
    But since they have already started I am not able do anything about it.
    So please guide me "how can I trace already running session."
    http://www.petefinnigan.com/ramblings/how_to_set_trace.htm
    Use DBMS_SUPPORT to set trace in another users session
    Next use the interface to again set trace for SCOTT's session that we found earlier. here it is:
         SQL> exec dbms_support.start_trace_in_session(10,20,waits=>true,binds=>false);
         PL/SQL procedure successfully completed.
         SQL> -- execute some code
         SQL> exec dbms_support.stop_trace_in_session(10,20);
         PL/SQL procedure successfully completed.
         SQL>                          
                                  

Maybe you are looking for