Gathering table statistics

Hi,
I am trying to gather statistics on a sample table dept.I created a statstable as follows
begin
DBMS_STATS.CREATE_STAT_TABLE ( 'scott' ,'dept_stats_tab');
end;
But when i open the statstable "Dept_stats_tab" i am not able to understand the meaning of the columns.
Can anybody let me know the what is purpose of the following cols of statstab
C1..C5,N1--N12,D1,R1,R2,CH1.
cheers
RRK

You have a valid question but this is what the documentation says...
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#i1035018
>>
This procedure creates a table with name stattab in ownname's schema which is capable of holding statistics. The columns and types that compose this table are not relevant as it should be accessed solely through the procedures in this package.
>>

Similar Messages

  • Gathering Table Statistics throws errors ORA-20001 and ORA-06512 on 11g

    Hi Forum!
    I try to gather statistics on a 11.2.0.1 DB for a Siebel application.
    The script which generates the statistics errors out and I don't know why. so I tried to query sys.dba_tab_statistics manually, but event then I receive an error:
    select * from sys.dba_tab_statistics
    ORA-20001: BIN$PV5XQQHLSAYJ0KPMEY1MHG==$0 is an invalid identifier
    ORA-06512: in "SYS-DBMS_STATS", Zeile 2082
    ORA-06512: in "SYS-DBMS_STATS", Zeile 2098
    ORA-06512: in "SYS-DBMS_STATS", Zeile 26789
    Any ideas?
    Edited by: Penky on Oct 10, 2011 2:51 PM

    Penky wrote:
    Note that I even get the error when doing a straight select * from dba_tab_statistics which I think should work fine, no?Is that:
    select * from dba_tab_statisticsor
    select * from sys.dba_tab_statisticsIt's unusual for a SYS view to error, unless that's a specific bug in that version of the database, though I wonder if there are other schemas, such as SYS which have got something in their recycle bin (not that anyone should have been creating and/or dropping things in SYS)?

  • ORA-01555 while gathering table statistics

    Hello All,
    While running a job to gather table statics it failed and I saw in my alert logs ORA-01555, below is the job:
    DBMS_STATS.GATHER_TABLE_STATS (SCHEMA_NAME, TABLE_NAME, PARTITION_NAME, ESTIMATE_PERCENT => DBMS_STATS.AUTO_SAMPLE_SIZE, METHOD_OPT=> 'FOR ALL COLUMNS SIZE AUTO');What is the reason behind the ORA-01555 ?
    How can I prevent it in the future ?
    Regards,

    There are two queries,
    Below query for optimal undo size based on your undo retention
    select d.undo_size / (1024 * 1024) "ACTUAL UNDO SIZE (MEGS)",
    substr(e.value, 1, 25) "UNDO RETENTION (Secs)",
    (to_number(e.value) * to_number(f.value) * g.undo_block_per_sec) /
    (1024 * 1024) "NEEDED UNDO SIZE (MEGS)"
    from (select sum(a.bytes) undo_size
    from v$datafile a, v$tablespace b, dba_tablespaces c
    where c.contents = 'UNDO'
    and c.status = 'ONLINE'
    and b.name = c.tablespace_name
    and a.ts# = b.ts#) d,
    v$parameter e,
    v$parameter f,
    (select max(undoblks / ((end_time - begin_time) * 3600 * 24)) undo_block_per_sec
    from v$undostat) g
    where e.name = 'undo_retention'
    and f.name = 'db_block_size';
    Below is the result from my database;
            ACTUAL UNDO SIZE (MEGS)     UNDO RETENTION (Secs)     NEEDED UNDO SIZE (MEGS)
           20860                     900          955.6171875
    Another query is based how much undo retention you have to configure as per the undo size
    select d.undo_size / (1024 * 1024) "ACTUAL UNDO SIZE (MEGS)",
    substr(e.value, 1, 25) "UNDO RETENTION (Secs)",
    round((d.undo_size / (to_number(f.value) * g.undo_block_per_sec))) "OPTIMAL UNDO RETENTION (Secs)"
    from (select sum(a.bytes) undo_size
    from v$datafile a, v$tablespace b, dba_tablespaces c
    where c.contents = 'UNDO'
    and c.status = 'ONLINE'
    and b.name = c.tablespace_name
    and a.ts# = b.ts#) d,
    v$parameter e,
    v$parameter f,
    (select max(undoblks / ((end_time - begin_time) * 3600 * 24)) undo_block_per_sec
    from v$undostat) g
    where e.name = 'undo_retention'
    and f.name = 'db_block_size';
    Below is the result from my database;
            ACTUAL UNDO SIZE (MEGS)     UNDO RETENTION (Secs)     OPTIMAL UNDO RETENTION (Secs)
         20860                           900                         19646
    BTW, have you tried again by executing the same ?Yes with no problem, it only happened once
    In the link you mention I read the below
    "The ORA-1555 happens when people try to save space typically. They'll have small
    rollback segments that could grow if they needed (and will shrink using OPTIMAL). So,
    they'll start with say 10 or so 1meg rollback segments. These rollback segments COULD
    grow to 100meg each if we let them (in this example) however, they will NEVER grow unless
    you get a big transaction.
    If your database does lots of little transactions, the RBS will never grow on their own.
    They will stay small.
    Now, someone needs to run a query that will take 5 minutes. On your system however the
    rollback wraps every 2 minutes due to lots of little transactions going on. In this
    system, ORA-1555's will happen frequently. What you need to do here is size rollback so
    that it wraps less frequently (less frequently then your long running queries). Here if
    I sized the rollback so that I had 10, 10meg segments (not so they could GROW to 10meg
    but that they are starting at 10meg) we would wrap maybe every 20minutes now. that'll
    give that 5minute query plenty of time to complete without reusing rollback it needs.
    I Think this is exactly my case, how can I resize my redo segments ? and how can I check its current size?

  • Table Statistics Gathering Query

    Hey there,
    I'm currently getting trained in Oracle and one of the questions posed to me were create a table, insert a million rows into it and try to find the number of rows in it. I've tried the following steps to solve this,
    First table creation
    SQL> create table t1(id number);
    Table created.Data insertion
    SQL> insert into t1 select level from dual connect by level < 50000000;
    49999999 rows created.Gathering statistics
    SQL> exec dbms_stats.gather_table_stats('HR','T1');
    PL/SQL procedure successfully completed.Finally counting the number of rows
    SQL> select num_rows from user_tables where table_name='T1';
      NUM_ROWS
      49960410
    SQL> select count(*) from t1;
      COUNT(*)
      49999999My database version is,
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - ProductionI would like to know why there are two different results for the same table when using "num_rows" from the view "user_tables" and the aggregate function "count()" over the same table. Please do keep in mind that i'm studying oracle and this is from a conceptual point of view only. I would like to know how gathering the table statistics works using dbms_stats package works.
    Thank You,
    Vishal

    vishm8 wrote:
    Gathering statistics
    SQL> exec dbms_stats.gather_table_stats('HR','T1');
    PL/SQL procedure successfully completed.I would like to know why there are two different results for the same table when using "num_rows" from the view "user_tables" and the aggregate function "count()" over the same table. Please do keep in mind that i'm studying oracle and this is from a conceptual point of view only. I would like to know how gathering the table statistics works using dbms_stats package works.
    Thank You,
    VishalBecause you aren't specifying a value for estimate_percent in the procedure call (to gather_table_stats) Oracle will pick an estimate value for you. If you want to sample the entire table you would need to explicitly specify that in your procedure call.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_stats.htm#ARPLS68582

  • Table statistics

    Greetings All,
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Windows 2008 R2I had 18 unexplained columns appear on a table in one of the schemas. The column names are like SYS_000080$, SYS_000079$, ...
    Anybody know if gathering statistics on the table will add columns to the table being analyzed, then dropped when stats have been collected?
    I'm thinking (read as HOPE) that the gathering of statistics on this table was interrupted, hence leaving the extra columns.
    Below is the SQL used to gather the stats.
           dbms_stats.gather_schema_stats (
                                    ownname => 'schema_name_here',
                         estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
                                method_opt => 'FOR ALL COLUMNS SIZE AUTO',
                                      cascade => TRUE,
                                       options => 'GATHER',
                                       degree => 6);Can anyone confirm my suspicion please?
    Thanks for your time,
    Bob

    Snyds wrote:
    I posted the SQL used to gather the statistics. Not sure what else you expect for post sql.
    The results:
    There are 18 (new/additional) columns that have been appended to the end of the table. All of these new columns begin with "SYS_000" and end with 2 more digits and the dollar sign (i.e. SYS_00070$, SYS_00079$, SYS_00078$, and so on). These new columns are not consecutive, in that SYS_00079$ may not be the column after the column called SYS_00078$. There are gaps in the numeric protion on nthe new column names. These new columns, that begin with SYS_0000, do not belong on the table.
    I don't know what other results you expect to see.
    Bobwhat exactly is the SQL that displays SYS_00070$, SYS_00079$, SYS_00078$?
    Do you understand that Oracle will generate object names for things like INDEX or CONSTRAINT?

  • Table statistics delete

    Hi
    Is there any command to delete gathered statistics of a table
    suppose : I have gather table statistics as under
    exec dbms_stats.gather_table_stats('TEST1','EMP');
    now I want to delete the statistics from the above table EMP
    Regards
    Jewel

    The package dbms_stats is fully documented in the Oracle supplied package and type reference manual for your unknown version of Oracle.
    It has a call to delete statistics.
    As per forums etiquette, please do the obvious first and consult documentation.
    Sybrand Bakker
    Senior Oracle DBA

  • 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.

  • Error while executing the table statistics using Brtools

    Dear Team,
    We are getting ORA-01031: insufficient privileges error whenever we have tried to execute the update or table statistics using brtools on our SAP development server. I have checked the permissions of sapcheck directory and changed it to 775 still error remains the same. I have observed, it is failing to create the sta or chk files in sapcheck directory after executing update statistics using Brtools.
    BR0291I BRCONNECT will be started with options '-p initDEV.sap -l E -f stats -t  "USTUD" -p 1'
    BR0280I BRTOOLS time stamp: 2010-07-20 12.02.33
    BR0670I Enter 'c[ont]' to continue, 'b[ack]' to go back, 's[top]' to abort:
    c
    BR0280I BRTOOLS time stamp: 2010-07-20 12.02.34
    BR0257I Your reply: 'c'
    BR0259I Program execution will be continued...
    BR0801I BRCONNECT 6.40 (50)
    BR0280I BRCONNECT time stamp: 2010-07-20 12.02.42
    BR0301E SQL error -1031 at location BrLicCheck-12
    ORA-01031: insufficient privileges
    BR0806I End of BRCONNECT processing: cedsegpe.log 2010-07-20 12.02.42
    BR0280I BRCONNECT time stamp: 2010-07-20 12.02.42
    BR0804I BRCONNECT terminated with errors
    I have checked the owner for SAPUSER table and it is showing as OPS$DEVADM
    Please, advise me on the same.
    Thanks and Regards,
    Kedar

    Dear All,
    Thanks for your responses.
    Permissions are set as below for br* files.
    sap-dev:devadm 23> ls -ltr br*
    -rwxrwxr-x   1 oradev     sapsys     3437688 Oct 31  2008 brarchive
    -rwxrwxr-x   1 oradev     sapsys     3547760 Oct 31  2008 brbackup
    -rwxrwxr-x   1 oradev     sapsys     4632408 Oct 31  2008 brconnect
    -rwxrwxr-x   1 devadm     sapsys     3850224 Oct 31  2008 brrecover
    -rwxrwxr-x   1 devadm     sapsys     1480656 Oct 31  2008 brrestore
    -rwxrwxr-x   1 devadm     sapsys     4837672 Oct 31  2008 brspace
    -rwxrwxr-x   1 oradev     sapsys     2175208 Oct 31  2008 brtools
    I guess it is fine because with these set of permissions, it is working absolutely fine in my quality system.
    QAS Permissions are as belows for your information
    sap-qas:qa1adm 22> ls -ltr br*
    -rwsrwxr-x   1 oraqa1     sapsys     3437688 Oct 31  2008 brarchive
    -rwsrwxr-x   1 oraqa1     sapsys     3547760 Oct 31  2008 brbackup
    -rwsrwxr-x   1 oraqa1     sapsys     4632408 Oct 31  2008 brconnect
    -rwxrwxr-x   1 qa1adm     sapsys     3850224 Oct 31  2008 brrecover
    -rwxrwxr-x   1 qa1adm     sapsys     1480656 Oct 31  2008 brrestore
    -rwxrwxr-x   1 qa1adm     sapsys     4837672 Oct 31  2008 brspace
    -rwsrwxr-x   1 oraqa1     sapsys     2175208 Oct 31  2008 brtools
    So do you feel still it has something to do with permissions?
    Thanks and Regards,
    Kedar

  • Import Table Statistics to another table

    Hi,
    Just like to know if I can use dbms_stats.import_table_stats to import table statistics to another table?
    Scenario:
    I exported the table statistics of the table (T1) using the command below.
    exec dbms_stats.export_table_stats('<user>','T1',NULL,'<stat table>');
    PL/SQL procedure successfully completed.
    And then, I have another table named T2, T1 and T2 are identical tables. T2 does not have statistics (I intentionally did not run gather statistics). I am wondering
    if I can import table statistics from T1 to T2 using dbms_stats package?.
    For what I understand, statistics can be imported back at the same table which is T1 but not for another table using dbms_stat package. If I am wrong, anyone can correct me.
    Thanks

    hi
    just try ;-) you lose nothing probably,
    check afterwards last_analyzed value for that table in user_tables
    if something is wrong, run regular stats

  • IMPDP take too much time at TABLE STATISTICS

    Hi experts.
    on of my database is taking taking to much time during IMPDP at TABLE STATISTICS. it take alomost 20 mints to import TABLE STATISTICS while on the other hand all other objects are imported within 5 to 7 minits.
    my database version is 10.2.0.1 and O/S Red Hat Enterprise Linux AS release 3 (Taroon Update 5)
    please guide how i can fix this issue
    thanx in Advance.
    regards

    please guide how i can fix this issueSeems to be a bug. Upgrade to 10.2.0.4.0 or 10.2.0.5.0 and check again.
    Ronny Egner
    My Blog: http://blog.ronnyegner-consulting.de

  • Table Statistics failed during Import

    Hi All,
    I am trying to import an existing schema in Oracle 10g.
    I am using the impdp utility.
    The export dump consists of the complete schema (metadata and data).
    But it failed with the following logs.
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-39125: Worker unexpected fatal error in KUPW$WORKER.PUT_DDLS while calling DBMS_METADATA.CONVERT []
    ORA-06502: PL/SQL: numeric or value error
    LPX-00007: unexpected end-of-file encountered
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.KUPW$WORKER", line 6235
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    1945A21C 14916 package body SYS.KUPW$WORKER
    1945A21C 6300 package body SYS.KUPW$WORKER
    1945A21C 12279 package body SYS.KUPW$WORKER
    1945A21C 3279 package body SYS.KUPW$WORKER
    1945A21C 6889 package body SYS.KUPW$WORKER
    1945A21C 1262 package body SYS.KUPW$WORKER
    1CD814AC 2 anonymous block
    Job "THHIS"."SYS_IMPORT_FULL_02" stopped due to fatal error at 11:47:38
    I had then used the parameter EXCLUDE=STATISTICS and then the import was successful.
    I would like to the significance of this STATISTICS.
    I mean would EXCLUDE=STATISTICS always be ok?
    I have exported and imported the scheme as a user and not as sysdba. Does this make any difference?
    any suggestion would be highly appreciated.
    Thanks,
    Tanuja

    Hi,
    See related threads here:
    ORA-39125 & DBMS_METADATA
    Error ORA-39125 and ORA-04063 during export for transportable tablespace
    ORA-39125: Worker unexpected fatal error in string while calling string [string]
    Cause: An unhandled exception was detected internally within the worker process for the Data Pump job while calling the specified external routine. This is an internal error. Additional information may be supplied.
    Action: If problem persists, contact Oracle Customer Support.
    Hope this helps . . .
    Donald K. Burleson
    Oracle Press author
    Author of "Oracle Tuning: The Definitive Reference"
    http://www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm

  • Re: Unable to see Table statistics on when I click on the Table

    I have lost the ability to see table statistics when I click on the table. I use to be able to click on the table name under the connection window and would get a display of The columns, data, constraints, index,dependencies etc..... Now It does not seem to work any more I tried preferences but I don't seem to be able to change the behavior back to the way it was any suggestions.

    I upgraded to 1.2 and it solved the problem. I would however love to know the settings that control this display.

  • SQL Developer Behavior When Gathering Table/Index Statistics

    Hey All,
    Not sure if this has been posted yet. I did a search and did not find any threads on the topic though.
    I noticed with SQL Developer 2.x, when you using the context menu to gather table/index statistics for a given table, you get no modal progress/waiting window like you did in 1.x. It just kind of "does nothing", even though it did actually execute the DBMS_STATS package. If you press cancel and try to navigate around, you get multiple "Connection is Busy" errors. Eventually it will come back and say "Statistics gathered for table <whatever>". In the old versions there was just a modal window with an animated progress bar while it ran the DBMS_STATS package. What happened to that? Or is this something unique to my install? Anyone else ran into this? Is there a fix or somewhere I can report this as an official bug? FWIW I'm running 2.1.1.64, and this did occur in the initial 2.0 release.
    It is very confusing the first time you run into it... I pressed the "apply" button several times thinking it didn't take, but it ended up running the DBMS_STATS for every click I did.
    Thanks!

    Same happens to all the other context menu opened dialogs. Indeed very confusing at first and disturbing.
    The only official site to report bugs is Metalink/MOS, but you might be lucky if someone from the team picks it up here.
    Regards,
    K.

  • Gathering table only statistics with DBMS_SCHEDULER

    Version:10gR2
    I have statistics gathering sql file called gather_emp_stats.sql whose contents are as follows
    begin
    dbms_stats.gather_table_stats('SCOTT', 'EMP',
    estimate_percent=&gt;100,
    no_invalidate=&gt;FALSE,
    degree =&gt; DBMS_STATS.DEFAULT_DEGREE,
    cascade=&gt;TRUE);
    end;How can i run the above .sql script every five minutes using DBMS_SCHEDULER?
    begin
      dbms_scheduler.create_job(
          job_name =&gt; 'gather_emp_statistics'
         ,job_type =&gt; 'PLSQL_BLOCK'
         ,job_action =&gt; '??----??'
         ,start_date =&gt; sysdate
         ,repeat_interval =&gt; 'FREQ=MINUTELY;INTERVAL=5'
         ,enabled =&gt; TRUE
         ,comments =&gt; 'Gathering stats for EMP table.');
    end;

    If you don't insist of using a file (I think scheduler can do files too, but I don't know the syntax currently).
    Simply put the command in one line and use it as parameter
    begin
      dbms_scheduler.create_job(
          job_name => 'gather_emp_statistics'
         ,job_type => 'PLSQL_BLOCK'
         ,job_action => 'dbms_stats.gather_table_stats(''SCOTT'', ''EMP'',  estimate_percent=>100, no_invalidate=>FALSE, degree => DBMS_STATS.DEFAULT_DEGREE, cascade=>TRUE);'
         ,start_date => sysdate
         ,repeat_interval => 'FREQ=MINUTELY;INTERVAL=5'
         ,enabled => TRUE
         ,comments => 'Gathering stats for EMP table.');
    end;
    /

  • 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.

Maybe you are looking for

  • Networks will "connect" over Wifi, but DNS resolution is impossible and I can't access the internet.

    My OSX 10.7.5 iMac (late 2011) will connect to my university's wireless network and thinks it's connected to the internet, but cannot resolve any DNS - and cannot actually access the internet on any browser or internet-utilising app. My university ha

  • WINDOWS 8/ADOBE-NOT COMPATIBLE?

    I HAVE WINDOWS 8. MY ADOBE FLASH PLAYER NO LONGER WORKS. THE NEW VERSION WILL NOT DOWNLOAD. I WANT TO BUY PHOTOSHOP ELEMENTS BUT IT APPEARS ADOBE PRODUCTS ARE NOT COMPATIBLE WITH WINDOWS 8.

  • TS2570 iMac won't boot, GSOD with Flashing Question Mark, safe/verbose mode not possible

    I have an iMac 24", just over 2 years old running OS X v10.5 (Leopard). Mighty Mouse and bluetooth keyboard, no peripherals. It slowed enormously over the last few weeks and has now ceased to boot. On switching on I hear the chime (blank grey screen

  • Query regarding screen exits

    Hi ppl, I am looking for a screen exit for tcode MSC3n. Using SMOD, I found the following enhancements: BATCHCHK MBCFC010 SAPLCHVW SAPLMHD1 SAPLV01D SAPLV01P SAPLV01Z SAPLV1ZE SAPLV1ZN But, all these have function exits. There was no screen exit spec

  • FM HR_READ_INFOTYPE to read records from 3 infotypes

    Hi all, I am writing a report using PNP as my LDB. So there is a selection screen which can takes in the pernr and the dates as begda and endda. Based on this scenario, how do you normally use this FM 'HR_READ_INFOTYPE' to all the records from let sa