About gather statistics - ANALYZE on Oracle views

Oracle® Database Reference
11g Release 1 (11.1)
Part Number B28320-01
ALL_TABLES describes the relational tables accessible to the current user. To gather statistics for this view, use the ANALYZE SQL statement.
Columns marked with an asterisk (*) are populated only if you collect statistics on the table with the ANALYZE statement or the DBMS_STATS package
I thought ANALYZE command shouldn't be used to gather stats, as it explained as well on the ANALYZE command description.
Furthermore, explanations on how the columns should be populated are not clear enough. Maybe my english level is too low, but it seems we have to run any thing on the view itself.
Same for ALL_INDEXES.
Nicolas.

Hi Nicolas. You're right that we recommend using DBMS_STATS for most statistics-gathering purposes. I'll pass this along to the writer who manages the Database Reference, to see that it gets updated. I'll also ask him to check the clarity of the column descriptions.
Regards,
Diana

Similar Messages

  • Auto task - Gather Stats.How do Oracle knows which DB objects to analyze ?

    Hi,
    Do oracle has any specific criteria while identifying which Oracle DB objects needs to be analyze as part of Gather Stats ( included as "auto task") ?
    Does it uses information from DBA_TAB_MODIFICATIONS to find any fixed % of change like 10% or so or it analyzes all objects ?

    Copied and pasted from the documentation, which you can find via some simple Google searches if you don't know about http://docs.oracle.com
    GATHER AUTO: Gathers all necessary statistics automatically. Oracle implicitly determines which objects need new statistics, and determines how to gather those statistics. When GATHER AUTO is specified, the only additional valid parameters are stattab,statid, objlist and statown; all other parameter settings are ignored. Returns a list of processed objects.
    GATHER STALE: Gathers statistics on stale objects as determined by looking at the *_tab_modifications views. Also, return a list of objects found to be stale.
    GATHER EMPTY: Gathers statistics on objects which currently have no statistics. Return a list of objects found to have no statistics.
    14.2.1 GATHER_STATS_JOB
    Optimizer statistics are automatically gathered with the job GATHER_STATS_JOB. This job gathers statistics on all objects in the database which have:
    Missing statistics
    Stale statistics

  • Gather statistics or analyze table

    What is the difference between gather statistics for table and analyze table?
    Regards
    Arpit

    Analyzing a table is gathering statistics (whether you're using the old ANALYZE statement or the preferred dbms_stats package).

  • Gather statistics about classloader

    I can gather statistics like
    1.No of classes loaded.
    2.Memory used by the JVM.
    3.Threads created about the JVM (default ClassLoader of the JVM).
    I need to do the same for any generic ClassLoader.
    The code I use to gather information for the JVM's ClassLoader is as follows:
    import java.io.IOException;
    import java.lang.management.ClassLoadingMXBean;
    import java.lang.management.ManagementFactory;
    import java.lang.management.OperatingSystemMXBean;
    import java.net.MalformedURLException;
    import javax.management.MBeanServer;
    import javax.management.MBeanServerConnection;
    import javax.management.remote.JMXConnector;
    import javax.management.remote.JMXConnectorFactory;
    import javax.management.remote.JMXConnectorServer;
    import javax.management.remote.JMXConnectorServerFactory;
    import javax.management.remote.JMXServiceURL;
    public class ClassLoading {
    public static void main(String args[]) throws MalformedURLException, IOException
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
    JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
    cs.start();
    JMXServiceURL url1 = cs.getAddress();
    JMXConnector jmxc = JMXConnectorFactory.connect(url1, null);
    MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
    final ClassLoadingMXBean clmb = ManagementFactory.newPlatformMXBeanProxy(mbsc, ManagementFactory.CLASS_LOADING_MXBEAN_NAME, ClassLoadingMXBean.class);
    System.out.println("Loaded class count"+clmb.getLoadedClassCount());
    final OperatingSystemMXBean osmxb = ManagementFactory.newPlatformMXBeanProxy(mbsc, ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, OperatingSystemMXBean.class);
    System.out.println("Name"+osmxb.getName());
    }

    Hi Nicolas. You're right that we recommend using DBMS_STATS for most statistics-gathering purposes. I'll pass this along to the writer who manages the Database Reference, to see that it gets updated. I'll also ask him to check the clarity of the column descriptions.
    Regards,
    Diana

  • Get more info about the last errors in Oracle

    Hi all,
    There is a log in a live system where it is possible to see every minute the following error:
    Sweep Incident[48073]: failed, err=[1858]
    I know that error can happen mainly when:
    1. Trying to insert caracter field in a numeric column
    2. Using in the wrong way the function to_date()
    I need more information about that error, what can be causing the error in the system and why. Is it possible to see more information about the last errors in Oracle? For example, if a query produces an error... is it possible to see in Oracle the error and the query that caused the error?
    Hope you can help me.
    Thanks in advance.

    Thanks Niall.
    I'm not sure if I got you...
    What I found is that MMON makes snapshots of the database 'health' and stores this information in the AWR. So, it seems like in the database there could be a numeric column that is storing character fields, and when MMON works, it finds that error... is that right?
    I found the following information:
    SQL> select substr(s.username,1,18) username,
    2 substr(s.program,1,22) program,
    3 decode(s.command,
    4 0,'No Command',
    5 1,'Create Table',
    6 2,'Insert',
    7 3,'Select',
    8 6,'Update',
    9 7,'Delete',
    10 9,'Create Index',
    11 15,'Alter Table',
    12 21,'Create View',
    13 23,'Validate Index',
    14 35,'Alter Database',
    15 39,'Create Tablespace',
    16 41,'Drop Tablespace',
    17 40,'Alter Tablespace',
    18 53,'Drop User',
    19 62,'Analyze Table',
    20 63,'Analyze Index',
    21 s.command||': Other') command
    22 from
    23 v$session s,
    24 v$process p,
    25 v$transaction t,
    26 v$rollstat r,
    27 v$rollname n
    28 where s.paddr = p.addr
    29 and s.taddr = t.addr (+)
    30 and t.xidusn = r.usn (+)
    31 and r.usn = n.usn (+)
    32 order by 1;
    USERNAME PROGRAM COMMAND
    oracle@airvs1b (MMON) No Command
    SQL> select addr, pid, spid, username, serial#, program,traceid, background, latchwait, latchspin from v$process where program='oracle@airvs1b (MMON)';
    ADDR PID SPID USERNAME SERIAL# PROGRAM
    000000044A4E48A8 24 15372 oracle 1 oracle@airvs1b (MMON)
    TRACEID B LATCHWAIT LATCHSPIN
    ---------------- ---------- ------------------------ --------------- 1
    SQL> select
    2 substr(a.spid,1,9) pid,
    3 substr(b.sid,1,5) sid,
    4 substr(b.serial#,1,5) ser#,
    5 substr(b.machine,1,6) box,
    6 substr(b.username,1,10) username,
    7 b.server,
    8 substr(b.osuser,1,8) os_user,
    9 substr(b.program,1,40) program
    10 from v$session b, v$process a
    11 where
    12 b.paddr = a.addr
    13 and a.spid=15372
    14 order by spid;
    PID SID SER# BOX USERNAME SERVER OS_USER PROGRAM
    15372 1082 1 airvs1 DEDICATED oracle oracle@airvs1b (MMON)
    Is there any way I can see what MMON is doing and when is failing?
    Thank you very much.
    Edited by: user11281526 on 19-jun-2009 5:18

  • Autom. Gather Statistics Job

    Hello,
    i am facing following problem with the automatic gather statistics job which is running every night.
    The jobs starts when the weeknight/weekend_maintenance_windows opens, runs approx. 30 minutes and rebuilds statistics for around 270 objects. But when we check the status of objects next morning or immediate after jobrun, we still find hundrets of objects with stale statistics. We are not facing any heavy performance problems, but i want to know why we found stale statistics. The job uses 30 minutes of the 480 minutes window, so in my opinion there is plenty of time for all objects to create new statistics.
    Is this normal behaviour?
    Can't find anything in metalink.
    Systeminfo:
    Host: HP-UX 11.31
    DB: 10.2.0.4
    Regards
    Ulli

    Ulli,
    uwaldt wrote:
    Hello Randolf,
    we check if column stale_stats contains a 'YES'. The column 'last_analyzed' is filled with a date.OK, and the date corresponds to the latest run of the automatic statistics gathering job or is it outdated? What is the content of the corresponding TABMODIFICATIONS view in that case?
    After we check sthe SQL-script with the 'original' check via dbms_stats.gather_schema_stats, we see that there is a difference between all_tab/ind_statistics and the real value in tabmodifications.Apologies, but I'm not able to follow: What is the "difference between all_tab/ind_statistics and the real value in *_tab_modifications"? You mean to say that the list of objects marked as "STALE_STATS = YES" column differs from the output of the "LIST STALE" call?
    But what shows grid-control if we check there for stale stats?Good question, I can't answer since I seldom use the GUI tools.
    The next is, the developers in house argue with the all_tab/ind_statistics and blame the DBA's to do their housekeeping, especially if the users complain bad performance. I knew that the gather_job do his work, but we can't show it probable to the developers.This all sounds a bit odd. Two comments:
    1. It is possible in 10g to lock the statistics of tables, so that the automatic statistics collection job doesn't touch them. It's quite unlikely since you have to invoke it manually/explicitly using DBMS_STATS.LOCK_TABLE/SCHEMA_STATS, but may be you want to check the column STATTYPE_LOCKED in the TABSTATISTICS views for those objects in question, just to make sure.
    2. All the monitoring related information (*TABMODIFICATIONS/STALE_STATS column etc.) is usually only updated every three hours or if a call to DBMS_STATS.GATHER_STATS is performed. If you want to manually invoke the flush of the monitoring info, you can call DBMSSTATS.FLUSH_DATABASE_MONITORING_INFO to make sure that you look at the latest monitoring information available.
    Above point might explain that you can spot differences/inconsistencies before/after calling DBMS_STATS.GATHER_SCHEMA_STATS to list the stale objects.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Statistics analysis in Oracle 8i

    Is there a statisticS utility in Oracle 8i, which can do statistical analysis on data tables in Oracle? I am not talking about statistics in Oracle for performance tuning.
    If not, is there a 3rd party software to do this work?
    Thanks!

    Hi, Shah,
    Thanks for your help. I checked Darwin, and found it's more business oriented. What I am looking for is a package for scitific statistical analysis, such as clustering and probability distribution.
    I am sure that those anaylses are included in Darwin. Can I use them directly?
    Thanks again !
    limin
    null

  • Statistics Collection in Oracle 10g

    In Oracle 10g gathering table and index statistics are automatic ?
    or we have to physically gather statistics for table and indexes

    It depends how your database is configured -
    PARAMETER statistics_level should be set to typical and there must be a job NAMED as GATHER_STATS_JOB should be active. you can change the job parameters

  • Query to find dependency of an oracle VIEW

    Hi,
    I'm using oracle 10g database.
    DB name is - ORCL
    ORCL DB consists two schemas - Schema1 and Schema2
    I have one Oracle view called VIEW1 in Schema1.
    I need to find whether Schema2 uses VIEW1 in any of the Tables,views or Programs owned by Schema2.
    Is there any query available to find this one?
    Regards,
    Karthik

    How about querying the dba_dependencies view?
    SQL> conn / as sysdba
    Connected.
    SQL> conn aman/aman
    Connected.
    SQL> create table t as select * from scott.dept;
    Table created.
    SQL> create view v1 as select * from t;
    View created.
    SQL> grant select on v1 to scott;
    Grant succeeded.
    SQL> conn scott/tiger
    Connected.
    SQL> create view v_dependant as select * from aman.v1;
    View created.
    SQL> conn / as sysdba
    Connected.
    SQL> desc dba_dependencies
    Name                                      Null?    Type
    OWNER                                     NOT NULL VARCHAR2(30)
    NAME                                      NOT NULL VARCHAR2(30)
    TYPE                                               VARCHAR2(18)
    REFERENCED_OWNER                                   VARCHAR2(30)
    REFERENCED_NAME                                    VARCHAR2(64)
    REFERENCED_TYPE                                    VARCHAR2(18)
    REFERENCED_LINK_NAME                               VARCHAR2(128)
    DEPENDENCY_TYPE                                    VARCHAR2(4)
    SQL> select owner, name , type from dba_dependencies where name='V1' and owner='AMAN';
    OWNER                          NAME                           TYPE
    AMAN                           V1                             VIEW
    SQL> select owner, name , type, REFERENCED_OWNER, REFERENCED_NAME from dba_dependencies where name='V1' and owner='AMAN';
    OWNER                          NAME                           TYPE
    REFERENCED_OWNER
    REFERENCED_NAME
    AMAN                           V1                             VIEW
    AMAN
    THTH
    Aman....

  • How to Gather Statistics of Tables and Indexes

    Hi all,
    Plz help me in Gathering Statistics of Tables and Indexes.
    Thanks

    for tables
    exec dbms_stats.gather_table_stats('SCOTT', 'EMPLOYEES');
    for indexes
    exec dbms_stats.gather_index_stats('SCOTT', 'EMPLOYEES_PK');
    check this link for detail
    http://nimishgarg.blogspot.com/2010/04/oracle-dbmsstats-gather-statistics-of.html

  • Exclude Schema from Gather Statistics Job

    I am using 11.1.0,7. I would like to know if we can exclude some schemas While Oracle automatically gathers the statistics.
    Reason I want this is that, I have one database that supports multiple applications but as per one application's demand we should not be gathering stats on it's schema. So, in totality I have 20 Schemas but while this jobs run, I want to exclude 2 schemas that this application supports.
    Locking the Stats for these schemas is not an option.
    Thanks!

    Have you enquired from the vendor exactly why they do not want you to gather statistics on it's schema?
    Is there other options they are willing to consider like baselining the explain plan or perhaps not publishing the statistics to the tables...using the pending statistics feature?
    Exec dbms_stats.set_table_prefs('SH', 'CUSTOMERS', 'PUBLISH', 'false');
    Regards
    Tim Boles
    Edited by: Tim Boles on Aug 4, 2010 11:11 AM

  • Gather Statistics

    exec dbms_stats.gather_schema_stats( -
    ownname => 'PROD1, -
    options => 'GATHER AUTO', -
    estimate_percent => dbms_stats.auto_sample_size, -
    method_opt => 'for all columns size repeat', -
    degree => 25 -
    I have 400 tables in PROD1 schema, but I want to gather statistics for 120 tables only
    How to gathere statistics for 120 tables ?
    For specifying degree, what is the minimum and maximum? Will this affect any performance

    user8934564 wrote:
    exec dbms_stats.gather_schema_stats( -
    ownname => 'PROD1, -
    options => 'GATHER AUTO', -
    estimate_percent => dbms_stats.auto_sample_size, -
    method_opt => 'for all columns size repeat', -
    degree => 25 -
    I have 400 tables in PROD1 schema, but I want to gather statistics for 120 tables only
    How to gathere statistics for 120 tables ?
    For specifying degree, what is the minimum and maximum? Will this affect any performanceFrom Oracle Docs:
    Degree is Degree of parallelism. The default for degree is NULL. The default value can be changed using the SET_PARAM Procedure. NULL means use the table default value specified by the DEGREE clause in the CREATE TABLE or ALTER TABLE statement. Use the constant DBMS_STATS.DEFAULT_DEGREE to specify the default value based on the initialization parameters. The AUTO_DEGREE value determines the degree of parallelism automatically. This is either 1 (serial execution) or DEFAULT_DEGREE (the system default value based on number of CPUs and initialization parameters) according to size of the object.To be able to gather stats for 120 tables:
    1) You can create a temporary table, enter the names of these tables, create a PL/SQL procedure, loop for the table names and call GATHER_TABLE_STATS for each table.
    2) You can lock other table's stats, and call GATHER_SCHEMA_STATS.
    Regards
    Gokhan

  • Gather Statistics taking very long time

    Hi,
    In one of our critical Databases gather statistics is taking a very long time.
    How do I go about debugging this bad performance?
    Regards,
    Narayan

    Start with
    - What is the exact command used to gather statistics (and what are all the global settings that are used for any arguments you're not providing)?
    - What does "very long time" mean in numbers? Are we talking about 20 minutes? 4 hours? 4 days?
    - How much data are we talking about? What fraction of the tables and indexes are you gathering statistics on?
    - Have you done anything to look at, say, v$session_longops (or trace the session or watch the SQL being exectued, etc) to see what the job is doing?
    Justin

  • Generate entity bean from Oracle view fails

    Hello,
    is it possible to create an Entity Bean (v3) from an Oracle View in jDev (Build JDEVADF_11.1.1.1.0_GENERIC_090615.0017.5407)?
    In the wizard I can see my view, select it, specify all the info/details about it, but when clicking 'Finish' I see the "EJB Log" window appearing empty and the entity bean is not created. Already tried it in two different PCs without success.
    thanks!

    You can rename EJB and EJB classes (refactor) by right-clicking on the EJB node in
    project navigagor and selecting "Rename EJB and EJB Classes"
    In the dialog box you would get an option to refactor classes.
    raghu
    JDev Team

  • Access Query to Oracle View Tool

    We have a Access Database which creates forms and reports. It has lots of queries. we want the similar funtionalities in Oracle. Is there any tool that will convert these access queries to Oracle views. I used Migration workbench to convert the database but it can't convert the query.

    FYI,
    Microsoft Access is using ANSI SQL. And Oracle has introduced ANSI SQL from Oracle 9i so, it is also in 10g.
    Oracle 10g does not stop backward compatibilty so, It is depends on person. And I am not forcing you to migrate query from ACCESS to Oracle. I have simply answer the question which you have asked. Whether you want to perform efficiently or not it's your choice.
    But one thing is sure, ORACLE (9i or 10g) provides ANSI SQL and MS ACCESS is using ANSI sql so, this task is feasible. No doubt about it.

Maybe you are looking for