Gathering Schema statistics automatically

Hi All,
I have a couple of doubts regarding automatic statistics gathering in Oracle 9i.
I have seen a metalink document telling that in 9i statistics can be gathered automatically by giving options => 'GATHER AUTO'. My doubt is
1) Once this statement is executed, dont we require running it any time afterwards? ie, will the statistics be gathered automatically for all objects in this schema without our intervention henceforth?
2) It is mentioned to execute the following statement before the one above "exec dbms_stats.ALTER_SCHEMA_TAB_MONITORING('<owner>',TRUE);"
If we enable table monitoring will it impact the database perfromance by any means? Will there be any overhead associated with table monitoring?
Please clear my above doubts regarding the DBMS_STATS. Also could you please inform me which is the better way to gather object statistics for a schema.
Thanks in advance
Satish

1) Yes, you need to create a job inside oracle (recommended) or a batch in your OS to calculate statistics in the interval (daily,weekly,etc) that you want. If you just execute it once only that time the statistics will be calculated.
2)Yes, "it's recommended" but not mandatory. Except:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#sthref6562
Well I think there will be some sort of impact, but I'm not sure how much. I once had that in a prod DB and I didn't noticed any kind of impact. You should test it before.
I don't think there's a rule to know which way is better to gather statistics, because some options for DBMS_STATS applies for some cases and others for a complete different case.
Depends in the type of DB that you have.

Similar Messages

  • GATHERING schema statistics

    Hi Guys...
    I am running Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production on Solaris.
    I have materialized views that I refresh and gather schema statistics everyday at midnight.
    Normally the procedure takes few minutes to complete.
    But now it's about three days the procedure running and is stuck on one table.
    How do I tell as to whether the table is having issues with statistics gathering?
    Or what would be the remedy for this situation?
    Thanks in advance

    Index rebuilding sounds so much Oracle 7! Indexes today generally take care of themselves quite well, throughout inserts, deletes and updates. It rebalances itself automatically when necessary, without requiring any rebuild. As for the stats, run it for sure after large data movements (i.e. deletes and inserts). Besides that, implement table monitoring for your tables, and run once in a while dbms_stats with the options parameter as GATHER STALE. That way, Oracle will automatically know which objects need their stats refreshed.
    Daniel

  • Gathering schema Statistics and Index rebuilding

    I want to know after how much time we must gather the schema Statistics and Index rebuilding.
    In our system approximately 7 logfile generates in one day
    Please suggest me

    Index rebuilding sounds so much Oracle 7! Indexes today generally take care of themselves quite well, throughout inserts, deletes and updates. It rebalances itself automatically when necessary, without requiring any rebuild. As for the stats, run it for sure after large data movements (i.e. deletes and inserts). Besides that, implement table monitoring for your tables, and run once in a while dbms_stats with the options parameter as GATHER STALE. That way, Oracle will automatically know which objects need their stats refreshed.
    Daniel

  • Steps after the Gathering schema statistics

    i am getting schema statistics using these statements
    begin
    dbms_stats.gather_schema_stats(ownname => 'FSL',estimate_percent => dbms_stats.auto_sample_size, method_opt => 'for all columns size auto');
    end;
    Now after issuing these statement which steps required

    Which version of oracle are you using? Because, if you are using oracel 9i then, estimate_percent => dbms_stats.auto_sample_size, will collect 100% statistics. Its a kind of bug in oracle 9i Rel.2.
    Once you collect the statstics, nothing to be done from yourside, because, CBO will comes in picture during parsing your queries with best execution plan based on your objects statsitics.
    Jaffar

  • [SOLVED] Gathering Schema Statistics from Form Builder

    Hi
    these are my database and Forms versions:
    Forms [32 Bit] Version 6.0.8.8.0 (Production)
    Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
    PL/SQL Version 8.0.6.0.0 (Production)
    I would like to build a form with a push button which when clicked will gather schema statistics using procedures from the DBMS_STATS package ie. using the command:
    DBMS_STATS.gather_schema_stats (ownname => 'DLIC', cascade => true, estimate_percent => 99.99);
    But when this line is added to the PLSQL code for the push button, i get the following error:
    Error 0 at line 0, column 0
    ORA-00600: internal error code, arguments:[17003], [59630960], [911], [1], [], [], [], []
    Can any one please tell me what is the problem here?
    Thank You.
    Message was edited by:
    One

    Thanks Christian the W1zard and Francois D for your help! The solution IS, as you have suggested, to include the call to the DBMS_STATS procedure in a PLSQL block ie. using BEGIN ... END;
    and the whole in a FORMS_DDL statement.
    For any one facing the same problem, here is the entire solution:
    --Code in push-button When-Button-Pressed trigger.
    DECLARE
         STATEMENT_TO_EXECUTE VARCHAR2(200);
         OWN_NAME VARCHAR2(4);
         CASCADE_PARAM VARCHAR2(4);
         EST_PC VARCHAR2(5);
    BEGIN
         OWN_NAME := 'DLIC';
         CASCADE_PARAM := 'TRUE';
         EST_PC := '10.99';
         STATEMENT_TO_EXECUTE := 'DBMS_STATS.gather_schema_stats(ownname=>'||''''||OWN_NAME||''''||',cascade =>'||CASCADE_PARAM||',estimate_percent=>'||EST_PC||')';
         FORMS_DDL('BEGIN '||STATEMENT_TO_EXECUTE||'; END;');
    END;
    Note that all parameters passed to the DBMS_STATS procedure is stored in a bind variable. Also, note that the parameter that is of type VARCHAR2, in this case DLIC or Ownname is preceded and succeded by '''' or 4 single-quotes.
    PS:
    Would be very helpful if someone explained why 4 single-quotes. I found this in another post in the OTN forum, but not quite sure of the theory behind it.
    Thank You.

  • How to select all  indexes in a schema , for gathering the statistics

    In OEM 10g , How can we select all the indexes in a particular schema for gathering the statistics.
    For example , consider the schema got 1500 indexes. When i clicked on select all , it is selecting 10 indexes in one stretch ( all which are present in that page).
    For 1500 indexes , i have to make 150 such selection.
    How can we avoid it.
    In 9i OEM, its quite simple. With just 1 mouse clicke , we can select all the indexes .
    Thanks
    Naveen
    314 439 9554

    On the Administration Tab of the instance, choose Statistics Management - Manage Optimizer Statistics, then Gather Optimizer Statistics and click Continue. You then get a choice of Database, Schema, Tables or Indexes.
    Stupid that you have to supply an OS username and password to do this but anyway.

  • Statistics automatically gathered on indexes?

    I haven't paid much attention to this in the past, but I notice in XE that user_indexes
    is automatically populated when you create an index - num_rows, last_analyzed,
    etc. I suppose the simple act of creating the index collects enough data to
    provide those statistics, and Oracle uses them instead of throwing them away.
    Below is output from a simple script run in XE creating a table and four indexes.
    user_indexes.last_analyzed is not null even without any explicit
    gathering of statistics. num_rows, etc. are all populated...
    This does NOT happen in Enterprise 9.2.0.4...
    SQL> drop table pkt2;
    Table dropped.
    SQL> create table pkt2 as
    2 select rownum row_num, rownum / object_id not_row_num, 2 * rownum / object_id not_row_num2
    3 from all_objects
    4 /
    Table created.
    SQL>
    SQL> select table_name, last_analyzed from user_tables where table_name = 'PKT2';
    TABLE_NAME LAST_ANAL
    PKT2
    SQL> create unique index pkt2_1_udx on pkt2(row_num);
    Index created.
    SQL> create index pkt2_2_idx on pkt2(not_row_num);
    Index created.
    SQL> create index pkt2_3_idx on pkt2(row_num, not_row_num);
    Index created.
    SQL> create index pkt2_4_idx on pkt2(row_num, not_row_num, not_row_num2);
    Index created.
    SQL> select index_name, last_analyzed, num_rows, leaf_blocks, clustering_factor
    2 from user_indexes where table_name = 'PKT2';
    INDEX_NAME LAST_ANAL NUM_ROWS LEAF_BLOCKS CLUSTERING_FACTOR
    PKT2_3_IDX 27-NOV-05 4794 25 36
    PKT2_4_IDX 27-NOV-05 4794 40 36
    PKT2_1_UDX 27-NOV-05 4794 10 36
    PKT2_2_IDX 27-NOV-05 4794 23 2322

    that is normal behaviour in 10g

  • 'Gather Schema Statistics' concurrent request question

    Hello,
    I just have a question about the 'Gather Schema Statistics' concurrent request.
    We run this every evening on ALL schemas, however our SYS and SYSTEM schemas aren't registered in the application so therefore stats aren't gathered for these.
    Should SYS and SYSTEM be registered and stats gathered for these 2 schemas every night?
    Please advise
    Thank you
    Sarah

    Hi Sarah,
    First of all, Its not necessary to run gather schema statistics every evening. Either once in a week or month would suffice the need. Please look at the following note:
    How Often Should Gather Schema Statistics Program be Run? [ID 168136.1]
    With respect to your question:
    Sys and system users are not included in the "ALL" specified parameters in gather schema statistic program. It includes the list of product related users. But it is recommended you collect statistics for sys and system users and you can automate and achieve this by creating a job and schedule it at DB level. Please follow the following note which will assist you:
    EBPERF FAQ - Collecting Statistics in Oracle EBS 11i and R12 [ID 368252.1]
    Cheers,
    Asif

  • Gather Schema Statistics - GATHER AUTO option failing to gather stats

    Hi ,
    We recently upgraded to 10g DB and 11.5.10 version of Oracle EBS. I want to employ GATHER AUTO option while running Gather Schema Statistics.
    To test the working, I created a test table with 1 million rows. Then, stats were gathered for this table alone by using Gather Table Stats. Now, I deleted ~12% of rows & issued commit. The table all_tab_statistics shows that the table has stale statistics (stale stats column = YES). After that I ran Gather Schema Stats for that particular schema. But the request did not pick the test table to be gathered.
    What is the criterion on which Oracle chooses which all tables to be gather statistics for under Gather Auto option? I am aware of the 10% change in data, but how is this 10% calculated? Is it only based on (insert + update + delete)?
    Also, what is the difference between Gather Auto and Gather Stale ?
    Any help is appreciated.
    Thanks,
    Jithin

    Randalf,
    FYI.. this is what happens inside the concurrent progarm call.. there are a few additional parameters for output/ error msgs:
    procedure GATHER_SCHEMA_STATS(errbuf out varchar2,
    retcode out varchar2,
    schemaname in varchar2,
    estimate_percent in number,
    degree in number ,
    internal_flag in varchar2,
    request_id in number,
    hmode in varchar2 default 'LASTRUN',
    options in varchar2 default 'GATHER',
    modpercent in number default 10,
    invalidate in varchar2 default 'Y'
    is
    exist_insufficient exception;
    bad_input exception;
    pragma exception_init(exist_insufficient,-20000);
    pragma exception_init(bad_input,-20001);
    l_message varchar2(1000);
    Error_counter number := 0;
    Errors Error_Out;
    -- num_request_id number(15);
    conc_request_id number(15);
    degree_parallel number(2);
    begin
    -- Set the package body variable.
    stathist := hmode;
    -- check first if degree is null
    if degree is null then
    degree_parallel:=def_degree;
    else
    degree_parallel := degree;
    end if;
    l_message := 'In GATHER_SCHEMA_STATS , schema_name= '|| schemaname
    || ' percent= '|| to_char(estimate_percent) || ' degree = '
    || to_char(degree_parallel) || ' internal_flag= '|| internal_flag ;
    FND_FILE.put_line(FND_FILE.log,l_message);
    BEGIN
    FND_STATS.GATHER_SCHEMA_STATS(schemaname, estimate_percent,
    degree_parallel, internal_flag, Errors, request_id,stathist,
    options,modpercent,invalidate);
    exception
    when exist_insufficient then
    errbuf := sqlerrm ;
    retcode := '2';
    l_message := errbuf;
    FND_FILE.put_line(FND_FILE.log,l_message);
    raise;
    when bad_input then
    errbuf := sqlerrm ;
    retcode := '2';
    l_message := errbuf;
    FND_FILE.put_line(FND_FILE.log,l_message);
    raise;
    when others then
    errbuf := sqlerrm ;
    retcode := '2';
    l_message := errbuf;
    FND_FILE.put_line(FND_FILE.log,l_message);
    raise;
    END;
    FOR i in 0..MAX_ERRORS_PRINTED LOOP
    exit when Errors(i) is null;
    Error_counter:=i+1;
    FND_FILE.put_line(FND_FILE.log,'Error #'||Error_counter||
    ': '||Errors(i));
    -- added to send back status to concurrent program manager bug 2625022
    errbuf := sqlerrm ;
    retcode := '2';
    END LOOP;
    end;

  • Gather Schema Statistics improve the performance of the R12 application?

    Hi All,
    If we run “Gather Schema Statistics” program, it will improve the performance of the R12 application?
    Platform Linux and DB version 10.2.0.4.
    Thanks & Regards,
    Tharun

    Hi Tharun,
    If we ruer n “Gather Schema Statistics” program, it will improve the performance of the R12 application?
    Yes, it will speed up as it ensures to have an up to date statistics.
    Please refer notes:
    Concurrent Processing - How To Gather Statistics On Oracle Applications Release 11i and/or Release 12 - Concurrent Process,Temp Tables, Manually [ID 419728.1]
    How Often Should Gather Schema Statistics Program be Run? [ID 168136.1]
    Why Stats Gather?
    Stats gathering must be set as a routine job and is recommended to be scheduled. Even though this program is available from the fronted in the form of submitting a concurrent program basically it performs a DB level enhancement and ensures that you have an up to date optimizer statistics.Because the objects in a database can be constantly changing, statistics must be regularly updated so that they accurately describe these database objects.
    For indepth understand as to why it should be run, please refer doc:
    Managing Optimizer Statistics
    Thanks &
    Best Regards,

  • Managing Schema statistics

    hi,
    is there any way or approach for the following.....
    when to take schema statisics in Oracle Applications 11i...my version is 11.5.10.2 with 10.2.0.3 database...I know we have to run gather schema statistics request...do we need to schedule this request for ALL schemas or particular schemas only...what is the time basis for this..

    Actually, Oracle changed the stats gathering mode for SYS in 10g in that note again:
    EBPERF FAQ - Collecting Statistics with Oracle Apps 11i
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=368252.1
    2) How to collect statistics for SYS schema ?
    execute dbms_stats.gather_schema_stats ('SYS',cascade=>TRUE,estimate_percent=>100,degree=><# cpus>);
    In 10G, you can also run
    execute dbms_stats.gather_dictionary_stats ();
    which gather statistics for all system schemas, including SYS and SYSTEM, and other optional schemas, such as CTXSYS and DRSYS.
    3) How do I collect statistics for fixed ojbects (V$ views) in 10G databases?
    Run during a typical workload
    dbms_stats.gather_fixed_objects_stats;
    Note: the script $APPL_TOP/admin/adstats.sql requires the DB to be in restricted mode an could be used only when running upgrades. For optimal performance, statistics on fixed objects should be gathered when there is a typical load in the system
    I am gathering stats on SYS,SYSTEM as follows (especially if you use RMAN)
    execute dbms_stats.unlock_schema_stats('SYS');
    execute dbms_stats.unlock_schema_stats('SYSTEM');
    execute dbms_stats.gather_schema_stats('SYSTEM',options=>'GATHER', estimate_percent => 100, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
    execute dbms_stats.gather_schema_stats('SYS',options=>'GATHER', estimate_percent => 100, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE);
    execute dbms_stats.gather_fixed_objects_stats();
    commit;
    execute dbms_stats.DELETE_TABLE_STATS('SYS','X$KCCRSR');
    execute dbms_stats.LOCK_TABLE_STATS('SYS','X$KCCRSR');
    commit;

  • Gather Schema Statistics Report taking more than 13 hours to complete is it normal?

    I have run Gather Schema Statistics Report at 9 pm and it completed on 11am next morning. It almost took more than 13 hours, is this behavior normal.
    I have used the following parameter.
    Schema name: ALL
    Estimate percent:50
    Backup Flag :NOBACKUP
    History Mode :LASTRUN
    Gather Option:GATHER
    Invalidate Dependent Cursor : Y
    My database size is about 250 GB.
    Please reply

    Gather schema stastics is erroring out when i'm using the GATHER_AUTO option with 10%.
    Here is the log file
    +---------------------------------------------------------------------------+
    Application Object Library: Version : 12.0.0
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    FNDGSCST module: Gather Schema Statistics
    +---------------------------------------------------------------------------+
    Current system time is 13-AUG-2013 10:42:12
    +---------------------------------------------------------------------------+
    **Starts**13-AUG-2013 10:42:12
    ORACLE error 20001 in FDPSTP
    Cause: FDPSTP failed due to ORA-20001: SYS_NTGNSVL1S+OCZGRAAHKD9MYG== is an invalid identifier
    ORA-06512: at "APPS.FND_STATS", line 774
    ORA-06512: at line 1
    The SQL statement being executed at the time of the error was: SE
    +---------------------------------------------------------------------------+
    Start of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    In GATHER_SCHEMA_STATS , schema_name= ALL percent= 10 degree = 8 internal_flag= NOBACKUP
    ORA-20001: SYS_NTGNSVL1S+OCZGRAAHKD9MYG== is an invalid identifier
    +---------------------------------------------------------------------------+
    End of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    +---------------------------------------------------------------------------+
    Executing request completion options...
    Finished executing request completion options.
    +---------------------------------------------------------------------------+
    Concurrent request completed
    Current system time is 13-AUG-2013 10:43:29
    +---------------------------------------------------------------------------+
    I have used the following parameters
    Schema name: ALL
    Estimate percent:10
    Backup Flag :NOBACKUP
    History Mode :LASTRUN
    Gather Option:GATHER_AUTO
    Invalidate Dependent Cursor : Y

  • How often we need to run gather schema statistics etc.. ??

    HI,
    Am on 11.5.10.2
    RDBMS 9.2.0.6
    How often we need to run the following requests in Production...
    1.Gather schema statistics
    2.Gather Column statistics
    3.Gather Table statistics
    4.Gather All Column statisitics
    Thanks

    Hi;
    We discussed here before about same issue. Please check below thread which could be helpful about your issue:
    How often we need to run gather schema statistics
    Re: Gather schema stats run
    How we can collect custom schema information wiht gather statistics
    gather schema stats for EBS 11.5.10
    gather schema stats conc. program taking too long time
    Re: gather schema stats conc. program taking too long time
    How it runs
    Gather Schema Statistics
    http://oracle-apps-dba.blogspot.com/2007/07/gather-statistics-for-oracle.html
    gather statistict collect which informations
    Gather Schema Statistics...
    Regard
    Helios

  • FNDGSCST module: Gather Schema Statistics - ERROR: While GATHER_TABLE_STATS

    Hi
    I ran gather schema Statistics
    In GATHER_SCHEMA_STATS , schema_name= ALL percent= 10 degree = 4 internal_flag= NOBACKUP
    the error are:
    stats on table AQ$_WF_CONTROL_P is locked
    stats on table FND_CP_GSM_IPC_AQTBL is locked
    Error #1: ERROR: While GATHER_TABLE_STATS:
    object_name=AP.JE_FR_DAS_010***ORA-20001: invalid column name or duplicate columns/column groups/expressions in method_opt***
    Error #2: ERROR: While GATHER_TABLE_STATS:
    object_name=AP.JE_FR_DAS_010_NEW***ORA-20001: invalid column name or duplicate columns/column groups/expressions in method_opt***
    Error #3: ERROR: While GATHER_TABLE_STATS:
    object_name=AP.JG_ZZ_SYS_FORMATS_ALL_B***ORA-20001: invalid column name or duplicate columns/column groups/expressions in method_opt***
    I ran this while ago.
    anyone can help me to fix it
    Thanks

    Please see old threads which discuss the same issue -- http://forums.oracle.com/forums/search.jspa?threadID=&q=Gather+AND+Schema+AND+Statistics+AND+ORA-20001&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Gather Schema Statistics

    Hi All,
              When I run gather schema statistics, it is completing status normal .  But it took only 45 min.
              EBS - 12.1.3
                 DB - 11.2.0.3
                 OS - RHEL  64
              As per my understanding , it will take 2-3 hrs. After DB upgraded to 11.2.0.3, got an completd with error and followd the note: Gather Schema Statistics fails with Ora-20001 errors after 11G database upgrade [ID 781813.1]
              After that it completd with normal. But it took time only 45 min max in every run. with percentage 10 and 40. My DB size is 90 GB
    Request Log file:
    Start of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    In GATHER_SCHEMA_STATS , schema_name= ALL percent= 40 degree = 8 internal_flag= NOBACKUP
    stats on table FND_CP_GSM_IPC_AQTBL is locked
    stats on table FND_SOA_JMS_IN is locked
    stats on table FND_SOA_JMS_OUT is locked
    +---------------------------------------------------------------------------+
    End of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    Start of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    In GATHER_SCHEMA_STATS , schema_name= ALL percent= 10 degree = 8 internal_flag= NOBACKUP
    stats on table FND_CP_GSM_IPC_AQTBL is locked
    stats on table FND_SOA_JMS_IN is locked
    stats on table FND_SOA_JMS_OUT is locked
    +---------------------------------------------------------------------------+
    End of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    Now I querey the below :
    SQL> select column_name, nvl(hsize,254) hsize from FND_HISTOGRAM_COLS where table_name = 'JE_BE_LINE_TYPE_MAP' order by column_name;
    COLUMN_NAME                         HSIZE
    SOURCE                                254
    a)   Is this an expected behavior ?
    b)   If not, please suggest, to fix
    Thanks
    SAL

    Did the concurrent program fail? -- Gather Schema Statistics Fails With Error For APPLSYS Schema (Doc ID 1393184.1)
    Please check the LAST_ANALYZED column of DBA_TABLES and DBA_INDEXES views (Note: 166346.1 - How to Determine When a Table Was Last Analyzed By the Gather Schema Statistics Program).
    Thanks,
    Hussein

Maybe you are looking for

  • How can i make a transition between clips on cutaway?

    how can i make a transition between clips on cutaway?

  • BW3.5 query

    Hi all, I create vendor evaluation report in bw3.5 for that i use two data sources omm_pur_ve_01 from that data source i use lifnr ,lebdt,ekorg,gesbu fields for vendor score and another data source is 0vendor_attr from that data source i use name1 or

  • Error While importing third party certificate

    Hi, In my application I'm using HTTPS for secure connectivity.For that purpose I signed my midlet using a third Party certificate (GoDaddy's Certificate).But when I'm hitiing the url it is not working. I've done this with generating my own certificat

  • OIM seeded reports are unable to view in BI publishser 11.1.1.6

    OS: AIX 6.1 DB: Oracle 11gR2(11.2.0.3) OIM: 11gR2 BIpublisher: 11g I have installed BI publisher as Enterprise install which means it create it own weblogic console and em, BI publisher as managed server. Copied OIM seeded reports from OIM reports di

  • HTML Snipper Widget only for visual content?

    When I heard about the HTML Widget, I thought, great no more going into iDisk and manually changing the HTML code. I read the help article about how it can be for visual content such as youtube etc. But what about non-visual content, such as a counte