Why Gather Schema Stats?

Hi all,
I truncated all tables in my dev schema HR.
Then I ran > exe dbms_stats.gather_schema_stats('HR');
But the num_nows column in USER_TABLES are all have the old values :(
I am expecting all to be "zeroes".
How to take effect the updated stats for the cost base optimizer?
Thanks a lot,

KinsaKaUy? wrote:
Hi all,
I truncated all tables in my dev schema HR.
Then I ran > exe dbms_stats.gather_schema_stats('HR');
But the num_nows column in USER_TABLES are all have the old values :(
I am expecting all to be "zeroes".
How to take effect the updated stats for the cost base optimizer?
Thanks a lot,Whenever you use a valid SQL statement for the first time, Oracle produces an execution plan that describes how to retrieve the necessary data. The optimiser uses this plan to fetch the query from database . As in your case you truncated the table but the you have not updated the stats .whenever you use the same query the optimiser will use the old plan . Hence to update the optimizer , we collect the fresh stats by running "dbms_stats.gather_schema_stats"
at the schemas level ...
For more details check the oracle docs
http://docs.oracle.com/cd/B28359_01/server.111/b28274/stats.htm
Hope this may help you ....
--neeraj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Gather Schema Stat running long in R12

    Hi:
    I scheduled Gather Schema Stat (all with 10%) on two PROD instances last night. One completed about 2 hrs (this one normally has more activeties) while the other is still running since 12:00am. Please give me the steps and commands how I should troubleshoot. Is it still running? I have checked there is no block. BTW, I did one Gather Schema Stats for AP with 10% yesterday afternoon. It completed less than 2 min. They both are on 12.1.3 and 11.1.0.7 on Linux. Thank you in advance.

    I guess I have to do one of these. Thank you.
    Another question: Why some tables dont have date under last_analyzed? When I checked the all_tables and sorted on the last_analyzed, saw 1/3 of the tables with date blank. They are from all kinds of schemas, ex, two tables below. But some AR, or AP are analyzed.
    AR_SUBMISSION_CTRL_GT
    AP_PERIOD_CLOSE_EXCPS_GT

  • Gather schema stats not running for custom schema's in EBS 12.1.1

    Hi All,
    We are running Gather schema stats program periodically in our EBS system with Schama name as "ALL", but it is not generating the statistics for the custom schema. We have custom schema registered in our EBS application. Can you please let us know if there is any issue with our setup or this is standard behaviour of Gather schama stats concurrent program.
    Thanks,

    Hi,
    At how much percent ur using with Gather schema stats program like 10%,20%(in Gather schema stats program form)...I think there are no updates on the tables of that custom schema thats why the gather schema progam ignored it..can u check were there updates?
    Regards

  • ORA-12801 ORA-08103 while running gather schema stats in R12

    Hi All,
    We have recently upgraded from 11.5.9 to R12.1.1 on RHEL 4.8
    Database version is 10.2.0.5
    We are running Gather schema stats on R12.1.1 but its Errored out with below messages.
    ORA-12801: error signaled in parallel query server P006
    GL.GL_JE_LINES
    ORA-08103 : object no longer exists
    Please advice if anybdy face this issue.
    Thanks
    RB

    Please see (GATHER SCHEMA STATISTICS COMPLETED WITH ERROR WHEN RUNNING FOR GL SCHEMA. [ID 1068541.1]).
    Thanks,
    Hussein

  • How to gather schema stats in 11.5.9

    Hi,
    I am trying to gather schema stats for 11.5.9. But schemaname does not have the list of schemas. can i enter ALL.
    Regards
    Taher

    Hi Taher,
    You can either enter a schema name or even ALL should work.
    If you refer the link Helios has referred, Gather schema statistics is run on the schemas or tables on where there is a change in data frequently. So if you enter ALL then it would gather statistics for all the schemas which might not be required. Since it is run on all the schemas it might take time to complete.
    It is a good practice to run gather statistics at object level where there are lot of data growth or change.
    Regards,
    Mithun

  • Error  while gather schema stats

    Hi,
    I am getting the error while gather schema stats
    -1 - ORA-00001: unique constraint (APPLSYS.FND_STATS_HIST_U1) violated
    Unable to correctly update the history table - fnd_stats_hist.
    -1 - ORA-00001: unique constraint (APPLSYS.FND_STATS_HIST_U1) violated
    -Sagar

    Ariz,
    The FND_STATS package provides procedures for gathering statistics for Oracle Applications database objects. It also provides procedures
    for storing the current statistics in a table (FND_STATTAB) and restoring them back. This package also facilitates the gathering of some statistics in parallel. This package calls the DBMS_STATS package.
    The FND_STATS package also has procedures to populate the FNDSTATS_HIST_* table to record the historical information of time taken for gathering the
    statistics for the different types of objects.
    Famy

  • Many Gather Schema Stat CR on R12

    Hi, gurus:
    I saw today that there are many Gather Schema Stats CR completed these days. They all run "as soon as possible". Who/what fired them?
    EBS: 12.1.3
    OS: Linux
    DB: 11.1.0.7
    Thank you.

    Hi,
    Helping without politeness will not actually be termed as Help, isn't it?
    You may find the request set of a particular concurrent request/program using query:
    SELECT DISTINCT user_request_set_name
      FROM FND_REQUEST_SETS_TL
    WHERE request_set_id IN
              (SELECT request_set_id
                 FROM FND_REQUEST_SET_PROGRAMS
                WHERE concurrent_program_id =
                         (SELECT CONCURRENT_PROGRAM_ID
                            FROM fnd_concurrent_programs_tl
                           WHERE upper(USER_CONCURRENT_PROGRAM_NAME) = upper( '&Enter_Prog_name')));
    The above query was extracted from link:
    http://orclapp.blogspot.com/2012/02/script-to-find-concurrent-programs-of.html
    Hope this helps
    Best Regards

  • Needed Script for Gather Schema Stats

    Hi
    Well i need a script that monitors Gather Schema Schema stats is scheduled for coming week
    In EBS this would be a con current request scheduled that i need to get the information ..
    that script will run once in week and tell us that a GSS is scheduled on or else if its not scheduled it will give an alert as it is not schedule
    please let me know
    Cheers

    Hi Hussein,Alex
    well thanks for your reply ....
    but let me be more more clear what i need ...
    below query
    select ACTUAL_START_DATE, ACTUAL_COMPLETION_DATE,ROUND ( (ACTUAL_COMPLETION_DATE - ACTUAL_START_DATE)*1440) DURATION_MINS, REQUEST_ID, CONCURRENT_PROGRAM_ID from fnd_concurrent_requests where actual_start_date between to_date('4-Jun-12 00:00:00','dd-mon-yy hh24:mi:ss') and to_date('6-July-12 11:00:00','dd-mon-yy hh24:mi:ss')
    and CONCURRENT_PROGRAM_ID in (select CONCURRENT_PROGRAM_ID from FND_CONCURRENT_PROGRAMS_TL where USER_CONCURRENT_PROGRAM_NAME LIKE 'Gather Schema Statistics') order by 5,1;
    this give me output that between this date 4-june-12 to 6-July-12 is there any con current request ran for Gather Schema Stats...
    this query will give me request_id,concurrent_program_id and all details...
    like this i want to see that if any con current request is schedule in near future
    let us for eg
    this script will run on monday and it will pickup up the concurrent request telling for this week on this date GSS is schedule...
    likewise i need ...
    hope this give explanation what exact i need ..
    Cheers........

  • Gather Schema Stats concurrent program error with lock

    We are running Gather Schema Statistics from Oracle E-Business Suite 11.5.10 against a 10..2 database. When run against individual schema it completes with no error, but when run against ALL schemas it completes with the following error.
    “ERROR: While GATHER_TABLE_STATS: object_name=XDP.XDP_ORDER_PROCESSOR_QTAB***ORA-20005: object statistics are locked (stattype = ALL)***”
    I understand why the tables are locked and I know how to unlock the table (exec dbms_stats.unlock_schema_stats('schema_owner'); exec dbms_stats.unlock_table_stats('table_owner','table_name');
    My query is this: Metalink Note [ID 433240.1] advises If the table is a queue table then the statistics should remain empty and locked so that dynamic sampling is used due to the volatility of queue tables.
    If I follow the advise in the note above, and leave the tables as locked then gather Schema Statistics will continue to complete with an Error (its annoying).
    I found metalink note (375351.1) which seems to say that all tables can be unlocked including queue tables.
    Has anyone encountered this problem, do you recommended that I unlock this tables even though they are queue tables.

    Hi;
    Please follow doc ORA-20005 WHEN GATHERING STATISTICS FOR APPS 11i / R12 IN 10G or 11G [ID 375351.1],i belive you can run command wihtout issue. If its prod than you can also rise SR and confirm wiht oracle support
    Regard
    Helios

  • How to execute "gather schema stats" in parallel?

    Hi,
    I've a 11.2 Standard Edition and I need to gather stats for about 20 schemas.
    It's possible to execute with a plsql (or other) dbms_stats.gather_schema_stats in parallel?
    I want to execute 4 schema stats at time, and when one finish another one starts.
    It's possible?
    Thanks

    Mr.D. wrote:
    Hi,
    I've a 11.2 Standard Edition and I need to gather stats for about 20 schemas.
    It's possible to execute with a plsql (or other) dbms_stats.gather_schema_stats in parallel?
    I want to execute 4 schema stats at time, and one finish another one starts.
    It's possible?
    Thanks
    yes it is possible by opening 4 different   sessions
    which system resource will be saturated first?

  • Exclude MV Table from gather schema stats

    Hey,
    I am running the daily stats gathering procedure below.
    But it is running at the same time with an MV that is refreshing,and it's failing due to that.
    Is it possible to exclude the Materialized view from the below schema stats procedure?
    BEGIN
    dbms_stats.gather_schema_stats(ownname=>'SCOTT',estimate_percent=>dbms_stats.auto_sample_size,degree=>2);
    END;
    This is running on Oracle 10.2.1.0, on Linux env.

    You could lock the statistics onto the tables you don't want to re-gather stats : dbms_stats.lock_table_stats
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#i1043993
    Then run the mentioned command will not compute stats on those objects.
    Nicolas.

  • Find errors while running gather schema stats

    BEGIN DBMS_STATS.gather_schema_stats (ownname => '####', cascade =>true,estimate_percent => dbms_stats.auto_sample_size); END;
    ERROR at line 1:
    ORA-04063: package body "SYS.DBMS_SQLDIAG" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_SQLDIAG"
    ORA-06512: at "SYS.DBMS_STATS", line 17964
    ORA-06512: at "SYS.DBMS_STATS", line 18450
    ORA-06512: at "SYS.DBMS_STATS", line 18531
    ORA-06512: at "SYS.DBMS_STATS", line 18487
    ORA-06512: at line 1

    Hi Niket,
    The statement works fine for me in my environment
    SQL> BEGIN DBMS_STATS.gather_schema_stats (ownname => 'SHAJI' , cascade =>true,estimate_percent => dbms_stats.auto_sample_size); END;
    2 /
    PL/SQL procedure successfully completed.
    SQL> exec DBMS_STATS.gather_schema_stats (ownname => 'SHAJI' , cascade =>true,estimate_percent => dbms_stats.auto_sample_size);
    PL/SQL procedure successfully completed.
    Could you please verify the below objects are valid in your environment ?
    SQL> select OWNER,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where owner='SYS' and OBJECT_NAME='DBMS_SQLDIAG';
    OWNER OBJECT_NAME OBJECT_TYPE STATUS
    SYS DBMS_SQLDIAG PACKAGE VALID
    SYS DBMS_SQLDIAG PACKAGE BODY VALID
    Otherwise fix the issue by compiling it & try collecting again.
    Hope it helps,

  • 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 issue?

    Hi
    Actually, we have a custom schema in our EBS R12.0.6 instance database. But i have observed that, 'Gather Schema Statistics' program is not picking-up this schema. why? May be something wrong with database schema registration but since 1 & half year the interface associated with this schema is running fine. I do not know,how to resolve this issue?
    I can manually run 'Gather Table Statistics' program against all tables.
    Regards

    Hi;
    Actually, we have a custom schema in our EBS R12.0.6 instance database. But i have observed that, 'Gather Schema Statistics' program is not picking-up this schema. why? May be something wrong with database schema registration but since 1 & half year the interface associated with this schema is running fine. I do not know,how to resolve this issue?For can run hather stat for custom schema please check
    gather schema stats for EBS 11.5.10
    gather schema stats for EBS 11.5.10
    I can manually run 'Gather Table Statistics' program against all tables. Please see:
    How To Gather Statistics On Oracle Applications 11.5.10(and above) - Concurrent Process,Temp Tables, Manually [ID 419728.1]
    Also see:
    How to work Gather stat
    Gather Schema Statistics
    http://oracle-apps-dba.blogspot.com/2007/07/gather-statistics-for-oracle.html
    Regard
    Helios

  • Gather Schema Statistics produces HUGE oracle trace file

    Hi
    I am running gather schema stats on my E-Biz 12.1.3 / 11.2.0.3 system
    Each week we run Gather Schema Stats
    I have noticed that when the job completes a 3g trace fuile is produced under the Oracle RDBMS home
    I have tried un-checking the box when the COnc Request is submitted to DO NOT SAVE OUTPUT FILE but it is still procuced.
    I dont want it and do not understand why it is produced. Anyone out there have a resolution?

    I have noticed that when the job completes a 3g trace fuile is produced under the Oracle RDBMS homeWhat is the file name/location? What is the contents of this trace file?
    I have tried un-checking the box when the COnc Request is submitted to DO NOT SAVE OUTPUT FILE but it is still procuced.Do you have any debug/trace enabled on HRMS schema?
    I dont want it and do not understand why it is produced. Anyone out there have a resolution?Was this working before? If yes, any changes been done since then?
    What are the parameters you use to run "Gather Schema Statistics" concurrent program?
    Thanks,
    Hussein

Maybe you are looking for

  • Urgent Help Required for streaming video on Flash Media Server  3.5

    Please follow the link for the detailed question. As im not getting any replies so that is why attaching a link http://forums.adobe.com/thread/559567?tstart=0

  • Purchase Orders form in Query Only mode for a single user

    Hi All, I want to make the Purchase Orders form as query only for a single user. I tried by giving 'Query_only=Yes' in the parameters section. I am getting 'FRM-04151: You cannot query records here' message more than 10 time. I know we get this messa

  • DVD burner wont burn...keep getting error's. please help me

    So here's the situation, ever since i downloaded Audio Highjack Pro i've not been able to burn dvd's or cd's...it starts to burn and gets to about 2.3% or somewhere around there and it gives me this error.... "Burning the disc failed because communic

  • Is there any function module that brings out profile planner

    Hello experts, Is there any function module that brings out profile planner (I want to set planner profile as u201CSAP800u201D. I am using 7KE1 transaction. Example: I know, the FM - K_KOKRS_SET_BATCHINPUT will set the controlling area to 'CTIC' for

  • Lightroom 5 not recognizing canon or sony raw.

    I recently upgraded to Lightroom 5.   Suddenly it will not recognize raw files from either my Canon 7D, or my Sony Nex-7. Both of these are supported in LR4, and LR4 is still recognizing them. Any suggestions?  I've already checked, there are no furt