Gather Stats Job in 11g

Hi,
I am using 11.1.0.7 on IBMAIX Power based 64 bit system.
In 10g, if i query dba_scheduler_jobs view, i see the GATHER_STATS_JOB for automated statistics collection but in 11g i don't see this rather i see BSLN_MAINTAIN_STATS_JOB job which executes BSLN_MAINTAIN_STATS_PROG program for stats collection.
And if i query DBA_SCHEDULER_PROGRAMS, i also see GATHER_STATS_PROG program here. Can gurus help me understanding both in 11g. Why there are two different programs and what is the difference?
Actually the problem is that i am receiving following error message in my alert log file
Mon Aug 16 22:01:42 2010
GATHER_STATS_JOB encountered errors.  Check the trace file.
Errors in file /oracle/diag/rdbms/usgdwdbp/usgdwdbp/trace/usgdwdbp_j000_1179854.trc:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expiredThe trace files shows
*** 2010-08-14 22:10:14.449
*** SESSION ID:(2028.20611) 2010-08-14 22:10:14.449
*** CLIENT ID:() 2010-08-14 22:10:14.449
*** SERVICE NAME:(SYS$USERS) 2010-08-14 22:10:14.449
*** MODULE NAME:(DBMS_SCHEDULER) 2010-08-14 22:10:14.449
*** ACTION NAME:(ORA$AT_OS_OPT_SY_3407) 2010-08-14 22:10:14.449
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
*** 2010-08-14 22:10:14.450
GATHER_STATS_JOB: GATHER_TABLE_STATS('"DWDB_ADMIN_SYN"','"TEMP_HIST_HEADER_LIVE"','""', ...)
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expiredBut we dont have GATHER_STATS_JOB in 11g and also the job BSLN_MAINTAIN_STATS_PROG runs only on weekend and the above error message came last night 16 August.
Thanks
Salman

Thanks for the people who are contributing.
I know from the information that table is locked, but i have tried manually locking a table and executing gather_table_stats procedure but it runs fine. Here i have two questions
Where is GATHER_STATS_JOB in 11g as you can see the text of trace file where it says that GATHER_STATS_JOB failed, i dont see there is any GATHER_STATS_JOB in 11g.
BSLN_MAINTAIN_STATS_JOB job is supposed gather statistics but only on weekend nights, then how come i see this error occurring last night at 22:11 on 16th August which is not a week end night.
Salman

Similar Messages

  • Can we change GATHER_STATS_PROG (auto gather stat job) behavior

    Hi All,
    Is anyway we can change default oracle auto gather job ?
    We know that oracle gather job (GATHER_STATS_JOB, below 11g) will trigger base on the Maintenance Window, we have few huge Production environment.
    We're thinking to gather application schema stat by using our own scripts, thus would like to know is anyway we can still enable oracle auto gather stat
    but exclude application schema?
    Thanks in advance.
    Regards,
    Klnghau

    Hi All,
    Forgot to mention my oracle version is 10.2.0.4, and I think i find the solution from My Oracle support,
    Oracle10g: New DBMS_STATS parameter AUTOSTATS_TARGET [ID 276358.1]
    This is a new parameter in Oracle10g for the DBMS_STATS package.
    According to the documentation for this package in file dbmsstat.sql
    (under ORACLE_HOME/rdbms/admin):
    This parameter is applicable only for auto stats collection.
    The value of this parameter controls the objects considered for stats collection.
    It takes the following values:
    'ALL' -- statistics collected for all objects in system
    'ORACLE' -- statistics collected for all oracle owned objects
    'AUTO' -- oracle decides for which objects to collect stats
    Default is AUTO, i think i can chenge to ORACLE in my environment.
    Thanks

  • How to check whether gather stats job is running or not in OEM

    Hi,
    People in our team are saying that there is an automatic job is running in OEM to gather the statistics of the tables. Also it decides which table needs to be gather stats.
    I have not much idea in OEM (Oracle 10g), please let me know how to check the job which is gathering the statistics of tables and where to check that job.
    Thanks in advance,
    Mahi

    You may query dba_scheduler_job_log like
    SQL> select JOB_NAME,LOG_DATE,STATUS from dba_scheduler_job_log;There you should see the GATHER_STATS_JOB and its runnings.

  • Oracle gather stat jobs

    Hi,
    on 11g R2, on Win 2008.
    How to see when Oracle does stat gathering default job ?
    Any job table to query ?
    Thanks.

    Thank you.
    Ok ,
    Realy thanks. Fantastic.
    I saw that they are done at 23: 21.
    select client_name,last_good_date from DBA_AUTOTASK_TASK
    CLIENT_NAME                                                      LAST_GOOD_DATE
    sql tuning advisor                                               06/05/13 23:00:36,381000000 +02:00
    auto optimizer stats collection                                  06/05/13 23:21:48,319000000 +02:00
    auto space advisor                                               06/05/13 23:03:25,992000000 +02:00
    3 rows selectedHow can we force it to execute auto optimizer stats collection at another time ? For example 5 o'clock in the morning ?
    Thanks.

  • GATHER STATS JOB

    There is one automatic statistics gathering job GATHER_STATS_JOB. Is it necessary to leave it in enabled state (default) or should we disable it ?
    Are there situations where it is not advisable to run it ?

    Is there any reason why you want to disable it?
    Does it have any negative impact on your situation? Did you investigate this?
    Or do you just want to disable it, because you don't know what it does?
    This job is quite efficient, and is smarter at getting adequate statistics, than any job you set up manually!
    If you disable it, statistics will get stale, and Oracle will potentially generate adverse execution plans!
    If you want to exclude parts of the database for statistic calculation, just lock those statistics!
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read documentation.

  • Gather stats on every table in a schema

    Hi,
    i have an CRM application running on 10g R2 db. it has 5000 tbls on which less than 10% of tables are dynamic. gather stats job runs every day at 2am successfully.
    i was monitoring the statistics(dba_tables, dba_tab_modifications, dba_tab_statistics), noticed that only 28 tables r been update with latest stats every day for CRM schema and most of these tables are same. during query tunning i found that some tables has stale stats, but it does't figure in column stale of dba_tab_statistics, but it shows no of rows inserted, updated in tab_modifications.
    my question is there any draw back in gathering stats for all the tables every day irrespective of data is loaded with 10% or not and but not for tables with no rows..

    thanks for the quick response, it was helpful.
    due to application vendor recommendations, for some tables stats were disabled and optimizer parameter were changed which causes dynamic sample not using dynamic stats gather for some queries as they use the tables with no stats. as per documentation it would be calculating the stats on fly when the query the tables which stats has not been updated.
    as of now i am not gathering stats manually for this schema, as auto is scheduled. and will verify if indeed on 10% of data is loaded it updates the stats or not then i may manually gather stats for only those tables.

  • Scheduled Job to gather stats for multiple tables - Oracle 11.2.0.1.0

    Hi,
    My Oracle DB Version is:
    BANNER Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    In our application, we have users uploading files resulting in insert of records into a table. file could contain records ranging from 10000 to 1 million records.
    I have written a procedure to bulk insert these records into this table using limit clause. After the insert, i noticed my queries run slow against these tables if huge files are uploaded simultaneously. After gathering stats, the cost reduces and the queries executed faster.
    We have 2 such tables which grow based on user file uploads. I would like to schedule a job to gather stats during a non peak hour apart from the nightly automated oracle job for these two tables.
    Is there a better way to do this?
    I plan to execute the below procedure as a scheduled job using DBMS_SCHEDULER.
    --Procedure
    create or replace
    PROCEDURE p_manual_gather_table_stats AS
    TYPE ttab
    IS
        TABLE OF VARCHAR2(30) INDEX BY PLS_INTEGER;
        ltab ttab;
    BEGIN
        ltab(1) := 'TAB1';
        ltab(2) := 'TAB2';
        FOR i IN ltab.first .. ltab.last
        LOOP
            dbms_stats.gather_table_stats(ownname => USER, tabname => ltab(i) , estimate_percent => dbms_stats.auto_sample_size,
            method_opt => 'for all indexed columns size auto', degree =>
            dbms_stats.auto_degree ,CASCADE => TRUE );
        END LOOP;
    END p_manual_gather_table_stats;
    --Scheduled Job
    BEGIN
        -- Job defined entirely by the CREATE JOB procedure.
        DBMS_SCHEDULER.create_job ( job_name => 'MANUAL_GATHER_TABLE_STATS',
        job_type => 'PLSQL_BLOCK',
        job_action => 'BEGIN p_manual_gather_table_stats; END;',
        start_date => SYSTIMESTAMP,
        repeat_interval => 'FREQ=DAILY; BYHOUR=12;BYMINUTE=45;BYSECOND=0',
        end_date => NULL,
        enabled => TRUE,
        comments => 'Job to manually gather stats for tables: TAB1,TAB2. Runs at 12:45 Daily.');
    END;Thanks,
    Somiya

    The question was, is there a better way, and you partly answered it.
    Somiya, you have to be sure the queries have appropriate statistics when the queries are being run. In addition, if the queries are being run while data is being loaded, that is going to slow things down regardless, for several possible reasons, such as resource contention, inappropriate statistics, and having to maintain a read consistent view for each query.
    The default collection job decides for each table based on changes it perceives in the data. You probably don't want the default collection job to deal with those tables. You probably do want to do what Dan suggested with the statistics. But it's hard to tell from your description. Is the data volume and distribution volatile? You surely want representative statistics available when each query is started. You may want to use all the plan stability features available to tell the optimizer to do the right thing (see for example http://jonathanlewis.wordpress.com/2011/01/12/fake-baselines/ ). You may want to just give up and use dynamic sampling, I don't know, entire books, blogs and papers have been written on the subject. It's sufficiently advanced technology to appear as magic.

  • Stats  job in Oracle 11g

    During installation, the decision was made to not install the stats gathering job in 11g.
    Post installation the job is not running as expected.
    SInce then we have done more research and are comfortable with the stats job running only for Oracle dictionary tables.
    My question is
    How to install it and make sure it is run at a certain time?
    I have read documentation and have issues commands such as :-
    DBMS_AUTO_TASK_ADMIN.ENABLE (
    client_name IN VARCHAR2,
    operation IN VARCHAR2,
    window_name IN VARCHAR2);
    I have verified that the stats are not gathered on dictionary tables a.k.a SYS owned objects.
    Any input will be highly appreciated.

    I have verified that the stats are not gathered on dictionary tables a.k.a SYS owned objects.post SQL & results that are proof that "the stats are not gathered on dictionary tables".
    LAST_ANALYZED is NOT a reliable indicator to determine if/when statistics were gathered.
    If/when table content does NOT change, then current statistics are still valid & statistics do NOT need to be collected again.
    Handle:      Dbacloud
    Status Level:      Newbie (20)
    Registered:      Nov 18, 2009
    Total Posts:      55
    Total Questions:      13 (13 unresolved)
    so many questions without ANY answers.
    http://forums.oracle.com/forums/ann.jspa?annID=718
    Edited by: sb92075 on Feb 25, 2011 5:46 PM

  • 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

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

  • Refreshing mview is hanging after a database level gather stats

    hi guys,
    can you please help me identify the root cause of this issue.
    the scenario is this:
    1. we have a scheduled unix job that will refresh an mview everyday, from tuesday to saturdays.
    2. database maintenance being done during weekends (sundays), gathering stats at a database level.
    3. the refresh mview unix job apparently is hanging every tuesdays.
    4. our workaround is to kill the job, request for a schema gather stats, then re-run the job. and voila, refresh mview will be successful then.
    5. and the rest of the weekdays until saturdays, refresh mview is having no problems.
    we already identified during testing that the scenario where the refresh mview is failing is when after we are gathering stats in a database level.
    during gather stats in a schema level, refresh mview is successful.
    can you please help me understand why we are failing refreshing mview after we gather stats in the database level??
    we are using oracle 9i
    the creation of the mview goes something like below:
    create materialized view hanging_mview
    build deferred
    refresh on demand
    query rewrite disabled
    appreciate all your help.
    thanks a lot in advance.

    1. we have a scheduled unix job that will refresh an mview everyday, from tuesday to saturdays.
    2. database maintenance being done during weekends (sundays), gathering stats at a database level.
    3. the refresh mview unix job apparently is hanging every tuesdays.
    4. our workaround is to kill the job, request for a schema gather stats, then re-run the job. and voila, refresh mview will be successful then.
    5. and the rest of the weekdays until saturdays, refresh mview is having no problems.
    You know Tuesday's MV refresh "hangs".
    You don't know why it does not complete.
    You desire solution so that it does complete.
    You don't really know what is is doing on Tuesdays, but hope automagical solution will be offered here.
    The ONLY way I know how to possibly get some clues is SQL_TRACE.
    Only after knowing where time is being spent will you have a chance to take corrective action.
    The ball is in your court.
    Enjoy your mystery!

  • How to gather stats on the target table

    Hi
    I am using OWB 10gR2.
    I have created a mapping with a single target table.
    I have checked the mapping configuration 'Analyze Table Statements'.
    I have set target table property 'Statistics Collection' to 'MONITORING'.
    My requirement is to gather stats on the target table, after the target table is loaded/updated.
    According to Oracle's OWB 10gR2 User Document (B28223-03, Page#. 24-5)
    Analyze Table Statements
    If you select this option, Warehouse Builder generates code for analyzing the target
    table after the target is loaded, if the resulting target table is double or half its original
    size.
    My issue is that when my target table size is not doubled or half its original size then traget table DOES NOT get analyzed.
    I am looking for a way or settings in OWB 10gR2, to gather stats on my target table no matter its size after the target table is loaded/updated.
    Thanks for your help in advance...
    ~Salil

    Hi
    Unfortunately we have to disable automatic stat gather on the 10g database.
    My requirement needs to extract data from one database and then load into my TEMP tables and then process it and finally load into my datawarehouse tables.
    So I need to make sure to analyze my TEMP tables after they are truncated and loaded and subsequently updated, before I can process the data and load it into my datawarehouse tables.
    Also I need to truncate All TEMP tables after the load is completed to save space on my target database.
    If we keep the automatic stats ON my target 10g database then it might gather stats for those TEMP tables which are empty at the time of gather stat.
    Any ideas to overcome this issue is appreciated.
    Thanks
    Salil

  • Performance tuning - Gather stats and statID created

    SQL> EXEC DBMS_STATS.CREATE_STAT_TABLE('HR', 'SAVED_STATS');
    SQL> SELECT TABLE_NAME, NUM_ROWS, BLOCKS,EMPTY_BLOCKS, AVG_SPACE, USER_STATS, GLOBAL_STATS
    2 FROM USER_TABLES
    3 WHERE TABLE_NAME = 'MYCOUNTRIES';
    TABLE_NAME NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE USE
    GLO
    MYCOUNTRIES 0 0 0 0 NO
    YES
    SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=>'HR',TABNAME=>'MYCOUNTRIES',ESTIMATE_PERCENT=>10,STATOWN=>'HR',STATTAB=>'SAVED_STATS',STATID=>'PREVIOUS1');
    TABLE_NAME NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE USE GLO
    MYCOUNTRIES 25 5 0 0 NO YES
    SQL> select statid, type, count(*)
    2 from saved_stats
    3 group by statid, type;
    STATID T COUNT(*)
    PREVIOUS1 C 3
    PREVIOUS1 T 1
    Qn) Are the statistics which are stored based on statid ? ie. everytime I re-gather stats should I be mentioning a seperate statID name, so that a new version of stats is created/stored in a seperate statID.

    Are the statistics which are stored based on statid ? ie. everytime I re-gather stats should I be mentioning a >seperate statID name, so that a new version of stats is created/stored in a seperate statID.Yes.
    From http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm#i1036461
    statid Identifier (optional) to associate with these statistics within stattab

  • How to exclude tables from default scheduled stats job in 10.2.0.4

    I am using Oracle default stats job GATHER_STATS_JOB in my database. But i need to exclude stats gathering for few tables as part of my business requirement.

    Welcome to the forums.
    As I am sure you read the docs on DBMS_STATS at tahiti.oracle.com what was it about the method for addressing it in the docs that you don't think will work for you.
    Hint: The correct answer to my question is not "I didn't read the docs because I thought someone here would read them for me." ;-)

  • Sql slow afterweekly STATS-JOB,then run analyze table it is fast again

    Oracle R11.2.0.2 :
    I hade some slow sql / reports and found the effect,
    that the sql is slow obvious after the weekend ,
    when STATS - JOB BSLN_MAINTAIN_STATS_JOB and other Jobs were running weekly on SYS.
    I did run dbms_stats.GATHER_TABLE_STATS on schema
    it doesn't help.
    But when
    run ANALYZE TABLE afterwards on only one or two tables of the schema
    the sql / reports performance is well and fast.
    in the dba_tables I can see the last_analyze - date
    and in GLOBAL_STATS = NO ( when Table runs with ANALYZE ),
    GLOBAL_STATS = YES( when Table runs with STATS )
    what does the ANALYZE TABLE command doing good and let my sql run well and fast,
    while dbms_stats.GATHER_TABLE_STATS
    seems not work well in this situation ?
    regards

    astramare wrote:
    Oracle R11.2.0.2 :
    I hade some slow sql / reports and found the effect,
    that the sql is slow obvious after the weekend ,
    when STATS - JOB BSLN_MAINTAIN_STATS_JOB and other Jobs were running weekly on SYS.
    I did run dbms_stats.GATHER_TABLE_STATS on schema
    it doesn't help.
    What options do you use for the gather_stats command ?
    Do you also have collected system stats?
    But when
    run ANALYZE TABLE afterwards on only one or two tables of the schema
    the sql / reports performance is well and fast.Analyze table is deprecated, but still does its work for some part. It is not as complete as dbms_stats
    >
    in the dba_tables I can see the last_analyze - date
    and in GLOBAL_STATS = NO ( when Table runs with ANALYZE ),
    GLOBAL_STATS = YES( when Table runs with STATS )
    It must have to do something with the way you use it..
    HTH
    FJFranken

Maybe you are looking for

  • Automatic Backup not working like it should

    Is anyone else having any problems with their iDevice not doing the automatic iCloud backups?  Ever since I installed iOS 5, I have had to run the iCloud backup manually and its a little concerning that it wont run automatically.

  • Muse crashes every time I open a certain site.

    My client asked that I change one of the YouTube videos on her site to a different one. Everytime I embed the code for the new video Muse crashes. Now I can't even open the site without Muse crashing so I can't even get into her site to remove the vi

  • Why is the App Store telling me to repurchase apps?

    So, I recently got an iPad 2, and I was wanting to download some universal apps I had bought for my iPhone (GTA 3 and GarageBand, for example), but the app store is telling me that I need to buy the apps, again. My iPad is associated with the same Ap

  • Cash Discount taken incoming Payments

    Hi folks, when we allocation incoming payments to open AR, discounts might be taken from customers. We use FB05 for this. Discount GL is automatically chosen (OBXI) and correctly calculated. However, tax needs to be adjusted as well. This is not auto

  • Adobe flash won't download because I forst have to close Mozilla Firefox How do I do that

    when I go to Comcast and try to watch any video it says that I must install Adobe Flash Player first. so I try and get thru all the screens except the last....which says: The installer will automatically continue when the conflicting applications are