Regarding gathering statastics using dbms_stats

Hi,
BANNER
Oracle8i Enterprise Edition Release 8.1.7.0.0 - 64bit Production
PL/SQL Release 8.1.7.0.0 - Production
CORE 8.1.7.0.0 Production
TNS for Solaris: Version 8.1.7.0.0 - Production
NLSRTL Version 3.4.1.0.0 - Production
i would like generate statastics of tables using dbms_stats and i have lot of users in the database but i would like to generate statastics of "asap" user object(tables and indexes)i am using following syntax by connecting database as asap user :
sql>connect asap/asap;
sql>exec DBMS_STATS.GATHER_TABLE_STATS(NULL,'ITEM_T',CASCADE=>TRUE,METHOD_OPT=>'FOR ALL COLUMNS SIZE 254',
ESTIMATE_PERCENT=>10,DEGREE=>4);
is this statement is correct do anybody share valuable inputs since first time generating statastics in this database(new joinee)
Regards
Prakash

Hi Prakash ,
if i want gather statastics of asap schema how i need to connect database is as asap user or sys user OR both the cases are okIn general, I would carefully test the dbms_stats and the resulting new plans BEFORE doing anything in production! Lots may change!
Oracle recommends only re-analyzing when you have had enough data changes that it will effect your SQL execution plans.
Is there a reason for your desire to re-analyze? Have you identified sub-optimal SQL as a result of bad stats?
The addage "If it ain't broke, don't fix it" applies here.
Andy Holsworth recommends taking aa "deep" sample (perhaps more than 10% if you have the time), including histograms, and keep the stats as-is, only re-analyzing when required.
Withour SKEWONLY, you will need to manually add your histograms, by identifying skewed column distributions and correlating them to historical SQL. I have some notes on manual histogram detection here:
http://articles.techrepublic.com.com/5100-10878_11-5091017.html
We have the term "Monday Morning Mayhem" to describe databases where the DBA blindly re-analyzes stats on Sunday, only to find that the execution plans change dramatically.
Just make sure to test it throughly in both TEST and QA instances before changing production!

Similar Messages

  • Where are stats that are gathered using dbms_stats stored?

    where are stats that are gathered using dbms_stats stored?

    http://docs.oracle.com/cd/E11882_01/server.112/e16638/stats.htm#PFGRF94765

  • What are the database resources when collecting stats using dbms_stats

    Hello,
    We have tables that contain stale stats and would want to collect stats using dbms_stats with estiamte of 30%. What are the database resources that would be consummed when dbms_stats is used on a table? Also, would the table be locked during dbms_stats? Thank you.

    1) I'm not sure what resources you're talking about. Obviously, gathering statistics requires I/O since you've got to read lots of data from the table. It requires CPU particularly if you are gathering histograms. It requires RAM to the extent that you'll be doing sorts in PGA and to the extent that you'll be putting blocks in the buffer cache (and thus causing other blocks to age out), etc. Depending on whether you immediately invalidate query plans, you may force other sessions to start doing a lot more hard parsing as well.
    2) You cannot do DDL on a table while you are gathering statistics, but you can do DML. You would generally not want to gather statistics while an application is active.
    Justin

  • Using dbms_stats

    Hi ,
    I tried to ran the following dbms_stats for a new table
    declare
    begin
    dbms_stats.gather_table_stats(ownname => xx, tabname => 'TESTING_BT' ,
    options => 'GATHER AUTO', method_opt => 'for all columns size repeat',
    estimate_percent => dbms_stats.auto_sample_size ,cascade => TRUE ) ;
    end;
    and it gave me the error :
    ORA-06550: line 5, column 40:
    PLS-00302: component 'AUTO_SAMPLE_SIZE' must be declared
    ORA-06550: line 3, column 1:
    PL/SQL: Statement ignored
    ques :
    1) i thought it will auto gather 5 - 20% of the existing records as per what i read ?
    2) does it mean i need to update the "SAMPLE_SIZE" column with some values from the user_tables that has table_name = 'TESTIGN_BT' ?
    3) if i really need to do pt 2 then the value is in terms of no of records or a percentage will do ?
    kindly advise
    tks & rdgs

    First off all in 9.2 release options parameter is not proper for gather_table_stats.
    It is onlyproper for gather_schema_stats or gather_databas_stats. So your statment
    should look like this.
    begin
    dbms_stats.gather_table_stats(ownname => 'mob', tabname => 'T1' ,
    method_opt => 'for all columns size repeat',
    estimate_percent => dbms_stats.auto_sample_size ,cascade => TRUE ) ;
    end;
    There are several bugs in 9.2 about SAMPLE_SIZEcolumn is user_tables. You can
    refer to "WHEN USING DBMS_STATS.AUTO_SAMPLE_SIZE NUM_ROWS=SAMPLE_SIZE"
    Note:302802.1
    Best Regards
    Krystian Zieja / mob

  • Confusion using dbms_stat package

    Hi,
    I am using oracle 10G. I am quite confusied between analyze comman and dbms_stat package. In 9i we can use the analyze command to generate the execution plan if the optimizer select the CHOOSE base. But in oracle 10G this is obsolete, instead of that we can use the three parameter values viz, ALL_ROWS, FIRST_ROWS and FIRTS_N_ROWS. In oracle documentation it is written that whenever we user the value ALL_ROWS then the oracle server automatically selects the COST based optimizer.
    So My question is that what is the use of using dbms_stat package if the plan is automatically generated by setting the value ALL_ROWS in the parameter OPTIMIZER_MODE.
    Please reply ASAP.
    Thanks
    SS

    > I am quite confusied
    It would seem so. This is the wrong forum for your subject matter. What makes you think that DBMS_STATS have anything to do with object orientated programming, object relational design and advance (user) defined data types in Oracle?
    > Please reply ASAP.
    We are volunteers doing answers for free here.
    Urgent asap answers are supplied by Oracle Support when you file a Service Request with them. So try http://metalink.oracle.com for your asap answer.

  • Regarding acknowledgement without using BPM

    Hi,
    regarding acknowledgement without using BPM,
    i've read all realated document sap lib, but i am not clear on it.
    what step do i have to follow?
    1. IDOC to Java server proxy?
    2. RFC to Java Server Proxy?
    3. ABAP proxy to SOAP?
    thanks & regards
    dennis.

    > what step do i have to follow?
    > 1. IDOC to Java server proxy?
    For the IDOC you need not do anything, as IDOCs request ack's per default. For Java Proxies look here:
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3531 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    > 2. RFC to Java Server Proxy?
    This is not possible.
    > 3. ABAP proxy to SOAP?
    Look in the online help for requesting ack's in ABAP proxy (it is similat leik in Java Proxies). You can only work with system ack's.
    Regards
    Stefan

  • Doubt regarding Adobe forms used for PCR

    Hey all,
    I have a doubt regarding Adobe forms used for PCR.If i goto tc
    <b>SFP->form name (ISR_FORM_SPPM)->Layout->XML SOURCE-->
    <base><server name><port>/sap/bc/fp/form/layout/</base></b>
    But in tc SICF,i do not have anything beyond FP.It goes like this :<b> sicf-> default_host->sap->bc->fp</b> .
    Could this be the possible cause of error why i am not able to view the forms in PDF format?
    Can anyone , who has doen this before, please help me out with this issue?
    Thanks,
    Aditi

    Hi Aditi,
    Are you getting an error when you are trying to access the PDF form ?
    Is ADS installed and configured properly ? Also let me know the operating system you are using, it's version, J2EE and Portal version.
    Regards,
    Sunil

  • Regarding changing and using

    Hello experts:
        First thank you in advance for all your replies.
        would you please explain the difference of changing and using preferably by an example?
        couldn't thank you more.
    Best regards.
    Frank

    Hi,
    USING and CHANGING in PERFORMS means like this.
    USING- Call by value
    CHANGING- Call by reference
    Check the example below.
    PERFORM conv_atinnnam_no USING l_refbatch CHANGING w_refbatch.
    FORM conv_atinnnam_no USING    p_name
                          CHANGING p_no.
      CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'
           EXPORTING
                input  = p_w_name
           IMPORTING
                output = p_w_no.
    ENDFORM.                    " conv_atinnnam_no
    The parameters passing under USING will not change if the corrosponding parameter in the FORM changes unless it is global variable. But in case of parameter under changing what ever changes we are making inside FORM will be reflected to Original variables.
    In case of global variables USING and CHANGING works in
    the same way.
    Thanks,
    Vinod,

  • HT203390 even when i insert my sim card it says insert your sim card kindly help me in this regard i cant use my phone

    even when i insert my sim card it says insert your sim card kindly help me in this regard i cant use my phone

    Sounds like the phone was jailbroken or hacked to unlock it. Was it?

  • Gathering daily statistics of a table using DBMS_STATS..!!

    Hi all,
    Can please somebody help me for how to collect daily statistics of a table..!!
    executing the DBMS_stats is fine but when i assign as a job using OEM the job never starts. It just shows the status as job submitted but never executes..
    Is there any other way to execute the DBMS_STATS daily...??

    In 10g, it is executed daily at 22:00 by default.
    Otherwise, you can execute something like
    begin
    dbms_job.isubmit(job       => 1,
                     what      => 'BEGIN
    DBMS_STATS.GATHER_DATABASE_STATS (
    estimate_percent      => DBMS_STATS.AUTO_SAMPLE_SIZE,
    block_sample          => TRUE,
    method_opt            => ''FOR ALL COLUMNS SIZE AUTO'',
    degree                => 6,
    granularity           => ''ALL'',
    cascade               => TRUE,
    options               => ''GATHER STALE''
    END;',
                     next_date => sysdate + 2,
                     interval  => 'TRUNC(SysDate +1 ) +  22/24',
                     no_parse  => TRUE);
    end;
    commit;Make sure you commit.

  • Error while using DBMS_STATS.GATHER_schema_STATS

    Hi All,
    My database just got upgraded from Oracle 9i to Oracle 11g.
    While everything else is working fine post upgrade Oracle, the DBMS_STATS.GATHER_schema_STATS with METHOD_OPT => 'FOR COLUMNS SIZE ALL' , which was working fine in Oracle 9i is throwing error after upgarde.
    Below is the error I received:
    SQL> execute DBMS_STATS.GATHER_schema_STATS ('cins_dm', METHOD_OPT => 'FOR COLUMNS SIZE AUTO');
    BEGIN DBMS_STATS.GATHER_schema_STATS ('cins_dm', METHOD_OPT => 'FOR COLUMNS SIZE AUTO'); END;
    ERROR at line 1:
    ORA-20001: method_opt should follow the syntax "[FOR ALL [INDEXED|HIDDEN] COLUMNS [size_caluse]]" when gathering statistics on a group of tables
    ORA-06512: at "SYS.DBMS_STATS", line 9641
    ORA-06512: at "SYS.DBMS_STATS", line 9716
    ORA-06512: at "SYS.DBMS_STATS", line 10048
    ORA-06512: at "SYS.DBMS_STATS", line 18939
    ORA-06512: at "SYS.DBMS_STATS", line 19132
    ORA-06512: at "SYS.DBMS_STATS", line 19088
    ORA-06512: at line 1
    OS Details:
    Has this option got obsolete in Oracle 11g?
    What is the alternative to this?
    OS and Databse Details*
    OS:
    scrbbiddkbry002:sas# uname -a
    SunOS scrbbiddkbry002 5.9 Generic_122300-51 sun4u sparc SUNW,Sun-Fire-V240
    Oracle Client:
    SQL*Plus: Release 9.2.0.1.0 - Production
    Oracle Server:
    SQL> 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 Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    Edited by: user13071592 on Aug 3, 2010 2:38 AM

    Hi,
    While going through the link, it seems that METHOD_OPT => 'FOR COLUMNS SIZE AUTO' is obsolete in Oracle 11g and I will have to use METHOD_OPT => 'FOR ALL COLUMNS SIZE AUTO' instead of that. But the option METHOD_OPT => 'FOR COLUMNS SIZE AUTO' used to take just 5 minutes to complete while METHOD_OPT => 'FOR ALL COLUMNS SIZE AUTO' is taking 1 hour.
    I want it to take time (5-6 minutes) which the original METHOD_OPT => 'FOR COLUMNS SIZE AUTO' was taking.

  • Using DBMS_STAT.CREATE_STAT_TABLE

    could someone please advise me the format DBMS_STAT.CREATE_STAT_TABLE is used and what columns need to be in there and the format. Thanks in advance

    This procedure create stats table for you, please look at the example below:
    [email protected]> exec dbms_stats.create_stat_table('mob','mobstats')
    PL/SQL procedure successfully completed.
    [email protected]> desc mobstats
    Name Null? Type
    STATID VARCHAR2(30)
    TYPE CHAR(1)
    VERSION NUMBER
    FLAGS NUMBER
    C1 VARCHAR2(30)
    C2 VARCHAR2(30)
    C3 VARCHAR2(30)
    C4 VARCHAR2(30)
    C5 VARCHAR2(30)
    N1 NUMBER
    N2 NUMBER
    N3 NUMBER
    N4 NUMBER
    N5 NUMBER
    N6 NUMBER
    N7 NUMBER
    N8 NUMBER
    N9 NUMBER
    N10 NUMBER
    N11 NUMBER
    N12 NUMBER
    D1 DATE
    R1 RAW(32)
    R2 RAW(32)
    CH1 VARCHAR2(1000)
    Best Regards
    Krystian Zieja / mob

  • A query regarding synchronised functions, using shared object

    Hi all.
    I have this little query, regarding the functions that are synchronised, based on accessing the lock to the object, which is being used for synchronizing.
    Ok, I will clear myself with the following example :
    class First
    int a;
    static int b;
    public void func_one()
    synchronized((Integer) a)
    { // function logic
    } // End of func_one
    public void func_two()
    synchronized((Integer) b)
    { / function logic
    } // End of func_two
    public static void func_three()
    synchronized((Integer) a)
    { // function logic
    } // End of func_three, WHICH IS ACTUALLY NOT ALLOWED,
    // just written here for completeness.
    public static void func_four()
    synchronized((Integer) b)
    { / function logic
    } // End of func_four
    First obj1 = new First();
    First obj2 = new First();
    Note that the four functions are different on the following criteria :
    a) Whether the function is static or non-static.
    b) Whether the object on which synchronization is based is a static, or a non-static member of the class.
    Now, first my-thoughts; kindly correct me if I am wrong :
    a) In case 1, we have a non-static function, synchronized on a non-static object. Thus, effectively, there is no-synchronisation, since in case obj1 and obj2 happen to call the func_one at the same time, obj1 will obtain lock for obj1.a; and obj2 will obtain lock to obj2.a; and both can go inside the supposed-to-be-synchronized-function-but-actually-is-not merrily.
    Kindly correct me I am wrong anywhere in the above.
    b) In case 2, we have a non-static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a. However, since obj1.a and obj2.a are the same, thus we will indeed obtain sychronisation.
    Kindly correct me I am wrong anywhere in the above.
    c) In case 3, we have a static function , synchronized on a non-static object. However, Java does not allow functions of this type, so we may safely move forward.
    d) In case 4, we have a static function, synchronized on a static object.
    Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a. However, since obj1.a and obj2.a are the same, thus we will indeed obtain sychronisation. But we are only partly done for this case.
    First, Kindly correct me I am wrong anywhere in the above.
    Now, I have a query : what happens if the call is made in a classically static manner, i.e. using the statement "First.func_four;".
    Another query : so far we have been assuming that the only objects contending for the synchronized function are obj1, and obj2, in a single thread. Now, consider this, suppose we have the same reference obj1, in two threads, and the call "obj1.func_four;" happens to occur at the same time from each of these threads. Thus, we have obj1 rying to obtain lock for obj1.a; and again obj1 trying to obtain lock for obj1.a, which are the same locks. So, if obj1.a of the first thread obtains the lock, then it will enter the function no-doubt, but the call from the second thread will also succeed. Thus, effectively, our synchronisation is broken.
    Or am I being dumb ?
    Looking forward to replies..
    Ashutosh

    a) In case 1, we have a non-static function, synchronized on a non-static object. Thus, effectively, there is no-synchronisationThere is no synchronization between distinct First objects, but that's what you specified. Apart from the coding bug noted below, there would be synchronization between different threads using the same instance of First.
    b) In case 2, we have a non-static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a.obj1/2 don't call methods or try to obtain locks. The two different threads do that. And you mean First.b, not obj1.b and obj2.b, but see also below.
    d) In case 4, we have a static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a.Again, obj1/2 don't call methods or try to obtain locks. The two different threads do that. And again, you mean First.b. obj1.b and obj2.b are the same as First.b. Does that make it clearer?
    Now, I have a query : what happens if the call is made in a classically static manner, i.e. using the statement "First.func_four;".That's what happens in any case whether you write obj1.func_four(), obj2.func)four(), or First.func_four(). All these are identical when func_four(0 is static.
    Now, consider this, suppose we have the same reference obj1, in two threads, and the call "obj1.func_four;" happens to occur at the same time from each of these threads. Thus, we have obj1 rying to obtain lock for obj1.aNo we don't, we have a thread trying to obtain the lock on First.b.
    and again obj1 trying to obtain lock for obj1.aYou mean obj2 and First.b, but obj2 doesn't obtain the lock, the thread does.
    which are the same locks. So, if obj1.a of the first thread obtains the lock, then it will enter the function no-doubt, but the call from the second thread will also succeed.Of course it won't. Your reasoning here makes zero sense..Once First.b is locked it is locked. End of story.
    Thus, effectively, our synchronisation is broken.No it isn't. The second thread will wait on the same First.b object that the first thread has locked.
    However in any case you have a much bigger problem here. You're autoboxing your local 'int' variable to a possibly brand-new Integer object every call, so there may be no synchronization at all.
    You need:
    Object a = new Object();
    static Object b = new Object();

  • Regarding the operators used in abap oo

    hi,
    can any one send me the link or else please give in writing the operators used in oo abap. like ->, =>, ?= etc etc. please send me them i didnot find them in many sites that i am going through .
    thanks and regards
    ibrahim.md

    These operators are described in the standard SAP help under ABAP Objects Overview but in particular:
    -> is an instance component selector
    => is a static component selector
    ?= is used for widening casts (casting one object to another)
    Thanks,
    Pete

  • Link with examples of using dbms_stats package

    Please,
    Should Someone let me know when I could find a link or some example on using the new DBMS_STATS package to gather data statisitcs?
    Thanks

    All, made in Oracle:
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14231/general.htm#sthref1861
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14211/stats.htm#PFGRF30102
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#sthref7887
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#sthref7903
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#ARPLS059

Maybe you are looking for

  • Something went wrong when I was downloading my trial

    It won't open now and I want to know if I can uninstall and t ry it again?

  • Roaming with the same Ip address

    folks, very strange, i have mutliple vlans defined on my access-ponts, when i use a laptop and roam, i get the same ip address when i disassociate and them reassociate with another access-point, shouldn't i be getting a new one??? Thanks

  • I need to know if the sync related to ipad and backup to itunes

    I need to know if the sync related to ipad and backup to itunes

  • Videos in Shuffle

    When I shuffle songs and encounter a video, one of three things will happen. Sometimes it will freeze and I have to reset the iPod. Sometimes it will quickly skip over the video and go to a song. Sometimes it will play the music, but not the video. A

  • T.code to access table T030K

    Hi Gurus, Good day. Please kindly help advice the t.code to access table T030K. Also, spro path will be very helpful. Thanks in advance! Rellie