Stats_update_time

Hello,
Just curious - Does Oracle store how long did it take to generate stats for an object? Stats_update_time -> keep the statistics and timestamp of old times completed but does not tell you how long it took to generate the stats.
Thanks in Advance.

Just curious thats all. I was trying to see how long it took to gen stats on a huge table and started to look at the backend tables. I could also script it out and cron it but wanted to know if there was an option - thats all.
Thanks.

Similar Messages

  • Advice regarding how best to collect stats on 10G RAC Production system

    Friends,
    I have read quite a lot of blogs and docs and need some help with the best way forward. I am a DBA new to RAC who has limited experience with busy 24@7 10g systems on the scale of my current employer.
    Historically stats are gathered here as follows :-
    exec dbms_stats.unlock_schema_stats('BP');
    exec dbms_stats.gather_schema_stats(ownname => 'BP', cascade => true, estimate_percent => dbms_stats.auto_sample_size);
    exec dbms_stats.lock_schema_stats('BP');
    Then Flush shared pool ok ????
    Because of previous issues with this - alll tables are currently locked and this process is recommended for every 1-2 months rather than daily.
    EM Grid Control is used when performance is poor and the sql tuning advisor is run to generate recommendations from which a sql profile could be selected and enabled for the selected code.
    My plan is to bring back gathering of stats every 1 to 2 months, my goal is make sure I can fix things quickly if it all goes to custard !!!!
    From research it looks like sql_profile is like a hint and independent of gathering stats - it tells optimiser what hints to use when executing sql.
    This thread is for advice from professional dba's in my shoes - how do you approach this so that any issues are quickly rectified ???
    My thinking is to query dba_profiles and get list of profiles and statuses ... for all tables with sql profiles ..
    This is so profiles can be disabled and then quickly enabled if there is a problem aftewr the tables are analyzed.
    To revert all the schema stats :-
    exec dbms_stats.unlock_schema_stats('BP');
    exec dbms_stats.restore_schema_stats(ownname=>'BP',as_of_timestamp=>sysdate-1);
    exec dbms_stats.lock_schema_stats('BP');
    To revert a table's stats (this looks more finicky so not sure the way to go ...):-
    Pre gather stats :-
    select stats_update_time from user_tab_stats_history where table_name = ‘<EnterTabName>’;
    exec dbms_stats.create_stat_table ( -‘SCOTT’, -‘stattab_new’);
    exec dbms_stats.export_table_stats ( -‘SCOTT’, -‘DEPT’, -null, -‘stattab_new’, -null, -true, -‘SCOTT’);
    Then later after gather stats :-
    exec dbms_stats.restore_table_stats ( -‘SCOTT’, -‘DEPT’, -’21-JAN-09 11.00.00.000000 AM -05:00′);
    Enable/Disable Profile
    exec dbms_sqltune.alter_sql_profile('<Profile name>', 'STATUS', 'DISABLED');
    exec dbms_sqltune.alter_sql_profile('<Profile name>', 'STATUS', 'ENABLED');
    I will do the plan below on a test system first however load may not really identify problems until for real on the Prod system.
    My plan is to :-
    1 analyze all tables as per outline at start above (existing practice)
    2 Disable the sql profiles that are in use on the analyzed tables
    3 See what code is affected and what tables
    If Profile exists for these sql statements then either apply existing profile (as disabled) or use tuning adviser to create another profile
    (Advice welcome here - what do you do on big systems ????)
    4 If its a catastrophe - I can restore the schema stats using (exec dbms_stats.restore_schema_stats(ownname=>'BP',as_of_timestamp=>sysdate-1);)
    and then possibly re-enabling the sql_profiles that were in place before ....
    I welcome any advice based on similar experiences that can help me get this right.
    Many thanks,
    cheers, Rob
    Edited by: Diesel on Jun 27, 2012 10:51 PM

    Useful Link:
    http://www.oradev.com/create_statistics.jsp
    ## Gather schema stats
    begin
    dbms_stats.gather_schema_stats(ownname=>'SYSLOG');
    end;
    ## Gather a particular table stats of a schema
    begin
    DBMS_STATS.gather_table_stats(ownname=>'syslog',tabname=>'logs');
    end;
    Regards
    Asif Kabir
    --mark the answer as correct/helpful                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to retrieve old statistics backed up in SYSAUX tablespace.

    Hi, Folks
    From 10g onward, Oracle stores statistics collected previously when new statistics is gathered. Old statistics can be queryed via dba_tab_stats_history. but dba_tab_stats_history view doesn't show values like histogram, rows, min, and max. I would like to compare old statistics with new ones. Is there any way to retrieve previous statistics data backed up in SYSAUX tablespace?
    [oracle@rh01 ~]$ sqlplus '/as sysdba'
    SQL*Plus: Release 10.2.0.3.0 - Production on Wed Sep 2 10:26:27 2009
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> desc dba_tab_stats_history
    Name Null? Type
    OWNER VARCHAR2(30)
    TABLE_NAME VARCHAR2(30)
    PARTITION_NAME VARCHAR2(30)
    SUBPARTITION_NAME VARCHAR2(30)
    STATS_UPDATE_TIME TIMESTAMP(6) WITH TIME ZONE
    SQL>

    If it is stored you can query it. The trick is knowing where it is stored and without specific information about what you are looking for there's not much I can do other than refer you to tables whose names begin with the prefix 'WRH.''
    Try this for starters:
    select table_name from dba_tables where table_name like 'WRH%STAT%';

  • How do we ensure that statistics is restored in oracle10g?

    I am using oracle10g. I have emp table in scott schema. I analyzed the table today and last_analyzed field is showing today's date. it make sense.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select last_analyzed from dba_tables where table_name='EMP';
    LAST_ANAL
    07-NOV-09
    I have statistics history since from 6-oct-2009.
    SQL> SELECT DBMS_STATS.GET_STATS_HISTORY_AVAILABILITY FROM DUAL;
    GET_STATS_HISTORY_AVAILABILITY
    06-OCT-09 09.52.45.351000000 PM -05:00
    Now i want to restore the statistics as of date 10-OCT-2009
    SQL> execute dbms_stats.restore_table_stats('SCOTT','EMP','10-OCT-09 09.52.45.351000000 PM -05:00')
    PL/SQL procedure successfully completed.
    SQL>
    Let me check the last_analyzed column....
    SQL> select last_analyzed from dba_tables where table_name='EMP';
    LAST_ANAL
    15-SEP-09
    SQL>
    It is showing 15-SEP-2009.
    Any clarification is highly appreciated..

    Jean-Valentin, Your answers make sense!!!. All i wanted to test here is....
    I want to take SCOTT.EMP table and see the statistics history. Based on the history, i need to choose one date and recover the statistics on that date.
    I used dba_tab_stats_history view to see the past statistics. In the below query, i do not see any statistics update date for 15-SEP-2009. However,
    dba_tab_stats_history is right view to see the past statistics history?
    SQL> select stats_update_time from dba_tab_stats_history where
    2 table_name='EMP';
    STATS_UPDATE_TIME
    19-OCT-09 10.01.27.954000 PM -04:00
    19-OCT-09 10.31.32.347000 PM -04:00
    19-OCT-09 10.26.45.057000 PM -04:00
    19-OCT-09 10.33.57.068000 PM -04:00
    19-OCT-09 10.37.23.627000 PM -04:00
    19-OCT-09 10.38.14.437000 PM -04:00
    19-OCT-09 10.39.49.269000 PM -04:00
    19-OCT-09 10.48.10.138000 PM -04:00
    19-OCT-09 10.50.52.815000 PM -04:00
    19-OCT-09 10.51.29.085000 PM -04:00
    19-OCT-09 10.54.42.094000 PM -04:00
    STATS_UPDATE_TIME
    19-OCT-09 10.57.11.589000 PM -04:00
    30-OCT-09 06.25.54.809000 PM -04:00
    07-NOV-09 07.23.23.504000 AM -05:00
    07-NOV-09 07.27.31.709000 AM -05:00
    07-NOV-09 07.29.54.324000 AM -05:00
    16 rows selected.
    SQL>

Maybe you are looking for

  • Duplicate target database for standby failing with below error

    Hello All, Need your assistance We are creating a physical standby database (standalone) from 2 node RAC database, OS =RHEL5 and DB =11gR2 What we did: We took RMAN backup of primary DB along with archives and copied to standby server in same locatio

  • JDBC to ABAP PROXY ASYNCHRONOUS SENARIO

    Hi Experts JDBC to ABAP PROXY ASYNCHRONOUS SENARIO  IN PI 7.4 ? Can you tell me any one step by step procedure BR, Sagar

  • Suggest me way for calling Function Module in BSP page

    Dear Friends, I want to create sales order using BSP. For that there is an bapi called BAPI_SALES_CREATEFROMDAT2. I have two ways to do that. 1. I will create all the required structure on the BW system and then i can call the bapi. 2. I will create

  • It's all about Stream...

    Hi' this is really makes me feel so upset. Why every time i try to execute WindowsExec file. There's no error in code but the output not correctly. WindowsExec.java : public class WindowsExec      response std_out,std_err;      DataOutputStream doStr

  • How to change to native file name in ucm using custom component

    I am having the requirement to change the  name of the native file to some PO_contentid_1 . contentid is the contents content id. please help