Disable Automatic Optimizer Statistics

Hi there
I wanted to query user_tab_modifications to track, number of rows updated in a week. Since this view is refreshed automatically when Automatic Optimizer Statistics gathers statistics, i disabled the Automatic Optimizer Statistics. Now i am executing execute dbms_stats.FLUSH_DATABASE_MONITORING_INFO(); manually to get the view populated with number of rows updated.
My concern here is , will i get the exact number of rows updated in a week from user_tab_modifications by doing this ? Also, is there anything else that is also updating this view apart from optimizer statistics that are gathered on a table.
Thanks

You could try writing some PLSQL on your own.
How about :
SQL> create table count_X_updates (update_count number);
Table created.
SQL> insert into count_X_updates values (0);
1 row created.
SQL> commit;
Commit complete.
SQL>
SQL> create table X (col_1 varchar2(5), col_2 varchar2(5), col_3 number);
Table created.
SQL> insert into X values ('a','first',1);
1 row created.
SQL> commit;
Commit complete.
SQL>
SQL> create or replace trigger count_x_updates_trg
  2  after update of col_1,col_2,col_3
  3  on X
  4  for each row
  5  declare prev_cnt number;
  6  begin
  7  update count_X_updates set update_count = update_count+1;
  8* end;
SQL> /
Trigger created.
SQL>  update x set col_1 = 'b', col_2='secnd',col_3=2;
1 row updated.
SQL> commit;
Commit complete.
SQL> select * from count_X_updates;
UPDATE_COUNT
           1
SQL>  update x set col_1 = 'c' where col_3=2;
1 row updated.
SQL> commit;
Commit complete.
SQL> select * from count_X_updates;
UPDATE_COUNT
           2
SQL> select * from x;
COL_1 COL_2      COL_3
c     secnd          2
SQL>Note : This trigger code has to be improved because
a. Multiple sessions might get the same value
b. It introduces a point of serialisation -- multiple session will wait on a row lock on the table count_X_updates -- effectively meaning that all other sessions attempting to update X will wait (even if they are updating different rows in X) till each preceding one issues a COMMIT.
So, this demo code is only to show you PLSQL Triggers. But it cannot be used in Production.
Practice some PLSQL. Read up on autonomous transactions.
Hemant K Chitale

Similar Messages

  • (10g) 자동 통계정보 수집(AUTOMATIC OPTIMIZER STATISTICS COLLECTION)

    제품 : ORACLE SERVER
    작성날짜 : 2006-07-21
    PURPOSE
    이 문서는 10g의 new feature인 자동 통계정보 수집(Automatic Optimizer
    Statistics Collection)에 대한 소개와 기능에 대한 자료이다.
    Explanation
    1. 개요
    Optimizer statistics는 GATHER_STATS_JOB에 의해서 자동으로
    수집된다. 이 JOB은 SYS 소유로서 OBJECT_TYPE이 JOB이다.
    이 JOB은 통계정보가 없거나 stale 상태의 통계정보를 갖는 DB 내의
    모든 OBJECT들에 대한 통계정보들을 수집한다.
    2. 자동 통계정보 수집을 위한 설정과 방식
    1) STATISTICS_LEVEL = TYPICAL | ALL
    2) 통계정보들은 predefined GATHER_STATS_JOB에 의해 수집된다.
    3) JOB이 수행될 때 JOB은 다음과 같은 사항들을 결정한다.
    - missing 또는 stale 상태의 통계정보를 갖는 object를 결정한다.
    - 좋은 통계정보를 생성하기 위해 필요한 적당한 sampling percentage.
    - histogram과 histogram의 사이즈를 요구하는 적절한 column.
    - 통계정보 수집에 대한 parallelism의 degree.
    - 어느 object에 대한 통계정보를 수집할지에 대한 우선순위
    3. GATHER_STATS_JOB에 대한 설명
    이 job은 데이타베이스 생성 시점에 생성되고 스케줄러에 의해 관리된다.
    GATHER_STATS_JOB 은 DBMS_STATS.GATHER_DATABASE_STATS_JOB_PROC procedure를
    call함으로써 통계정보를 수집한다.
    이 프로시져는 'GATHER AUTO' 옵션을 사용한 DBMS_STATS.GATHER_DATABASE_STATS
    procedure와 아주 유사한 형태로 동작한다. 이것과 다른 점은
    GATHER_DATABASE_STATS_JOB_PROC procedure는 통계정보를 수집해야 할
    Object에 대해 우선순위를 두고 순서대로 처리한다. 즉, 가장 많이
    통계정보가 update가 되어야 할 object를 가장 먼저 처리하는 것이다.
    이것은 maintenance window가 close되기 전에 가장 필요한 통계정보가
    먼저 수집되도록 하기 위함이다.
    4. Dictionary Objects에 대한 통계정보
    1) Oracle Database 10g부터 최적의 performance 결과를 얻기 위해 dictionary
    table들에 대한 통계정보도 수집할 수 있다.
    언제라도, DBMS_STATS.GATHER_SCHEMA_STATS procedure를 사용하여
    dictionary table들에 대한 통계정보를 수집하는 것이 가능하다.
    이 때 GATHER_SYS argument는 TRUE로 셋팅되어 있어야 한다.
    2) DBMS_STATS.GATHER_DICTIONARY_STATS라 하는 새로운 procedure도 사용
    하는 것이 가능하다. 이것을 사용하기 위해서는 ANALYZE ANY DICTIONARY
    라는 새로운 system privilege가 있어야 한다.
    이 권한은 만약 어떤 user가 SYSDBA 권한이 없는 경우 dictionary object와
    fixed object들을 analyze할 수 있도록 한다.
    3) GATHER_DATABASE_STATS라는 프로시져는 GATHER_FIXED라 불리우는 새로운
    argument를 가진다. 이 값은 default로 FALSE로 셋팅된다. 즉, 기본적으로
    fixed table들에 대해서는 통계정보를 생성하지 않도록 한다.
    전형적인 System WorkLoad가 있는 동안에는 fixed table들에 대하여
    한번만 analyze하면 충분하다.
    4) GATHER_FIXED_OBJECTS_STATS라는 procedure를 사용하여 fixed table들에
    대한 통계정보를 모으는 것도 가능하다. 또한 모든 fixed table들에 대하여
    통계정보를 delete하는 것도 가능하고, fixed table에 통계정보를
    export 또는 import하는 것도 가능하다.
    Example
    none
    Reference Documents
    <Note:266040.1>

    Hi,
    Please see here,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/stats.htm#i41448
    If the table/s are changing very frequently than its better to gather the stats manually.This would lead teh volatile table coming up into the stats job again and again.
    For the system stats and data dictionary stats,they are not collected by default.So there is no choice but to gather them manually.
    Aman....

  • Automatic Optimizer Statistics Collection Enabled still tables not analyzed

    Hello,
    We have Oracle 11g R1 database. Our automatic Optimizer Statistics Collection settings are enabled, still I don't see the tables being analyzed, any suggestions if I am missing any settings. All tables do get analyzed if I do manual statistics gathering.
    SQL> select CLIENT_NAME ,STATUS from DBA_AUTOTASK_CLIENT;
    CLIENT_NAME STATUS
    auto optimizer stats collection ENABLED
    auto space advisor ENABLED
    sql tuning advisor ENABLED
    Thanks,
    SK

    user599845 wrote:
    Hello,
    We have Oracle 11g R1 database. Our automatic Optimizer Statistics Collection settings are enabled, still I don't see the tables being analyzed, any suggestions if I am missing any settings. All tables do get analyzed if I do manual statistics gathering.
    SQL> select CLIENT_NAME ,STATUS from DBA_AUTOTASK_CLIENT;
    CLIENT_NAME STATUS
    auto optimizer stats collection ENABLED
    auto space advisor ENABLED
    sql tuning advisor ENABLED
    Thanks,
    SK
    still I don't see the tables being analyzed, post SQL & results that lead you to this conclusion.
    realize that statistics can be "collected" without updating LAST_ANALYZED column.
    if data within table does not change, the nothing would be gained by "updating" statistics to same values as now/before.

  • Cannot disable automatic attachment preview in Mavericks Mail?

    Hello All,
    I noticed after upgrading to Mavericks that Apple Mail started automatically previewing attachments again... I had disabled this in previous versions of OS X.  I tried to disable this again in the terminal using:
    defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
    But after re-starting Mail, attachments are being automatically previewed again.
    I consider this a security issue so I would like to disable automatic attachment previewing as soon as possible.  Has anyone been able to do this with the Mail included with Mavericks yet?

    Just a basic examplo:  getting an email with an open image, that the 2 people around me can immediately see, can pose a serious security for anything I'm doing with my Mac!
    So, you see, SECURITY is much more than a mere technical problem!
    Cheers
    That's a privacy problem, not a security problem.
    If you are receiving images in emails that the others arround you are not qualified to see, your office setup is the security problem, not Mail.
    Use a different email client that gives you the option. I have no idea what those are, though.

  • In My iphone 5s,i have disabled automatic download from whatsapp app.So whichever images,video i feel is good i download them and then save them to my camera roll section.So i want to know how can i remove the images from cache of my phone.

    In My iphone 5s,i have disabled automatic download from whatsapp app.So whichever images,video i feel is good i download them and then save them to my camera roll section.So i want to know how can i remove the images from cache of my phone which are downloaded and not saved,but they remain in cache.
    Even in some apps i have data which i want to remove,but cant find a way to remove them and they are in my cache eating up my memory.

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • Can't disable automatic login (wifi) in Mt. Lion 10.8.4

    Dear all, why i can't disable automatic login in Mt. Lion 10.8.4??
    i'm using a MBP 2.4Ghz/Intel core i5 / late 2011 model, running 10.8.4
    each time i turn the wifi on and select the name of network, it will automatically login without asking my password, (I just want it ask me for password every time coz i don't want the password stay on the computer!)
    and i had did the following already but the nightmare still go on, please kindly let me know if the issue can be fix? thanks a lot!!!
    1. network panel : click advance and remove all network names in the window, and unchecked the box "Remember networks this computer has joined".
    2. Security Panel : selected "Disable automatic login"
    3. Users & Groups panel : Automatic login : selected "off"
    4.inside the Library / Preferences folder : "com.apple.loginwindow.plist", "com.apple.airport.preferences.plist" & " NetworkInterfaces.plist" all are deleted
    thanks again!!!

    Open Keychain Access and locate the entry for the network logon, select the entry and press the Delete key. That will remove the password from your Keychain and the system will have to request your password to log onto the network. Note: keychain entries are securely encrypted so even if someone has access to your computer, it would be highly unlikely they would be able to retrieve the network password.

  • How to disable automatic opening of previously viewed items in Preview or TextEdit in Max OSX Lion?

    How to disable automatic opening of previously viewed items in Preview or TextEdit in Max OSX Lion? It was no such issue on Snow Leopard OS.
    Please help

    This is a new behavior introduced in Lion.  You can disable it completely via System Preferences, General: uncheck the "Restore windows..." box toward the bottom. 
    You can disable this behavior on a case by case basis by either closing all windows before quitting, or holding the option key while quitting, or holding the shift key while launching from dock.
    charlie

  • How do I disable automatic downloading?

    When I am on iTunes,files that I have already purchased and downloaded automatically begin downloading out of nowhere.  It gets very annoying, and I would like to know how to disable automatic downloading.

    Which operating system are you using?

  • Is there a way to change the automatic optimization of the Thumbnail images in Webgallery?

    Is there a way to change the automatic optimization of the Thumbnail images in webgallery found in Photoshop (CS3 or Photoshop elements-- I have both)?  The thumbnails come out so blurry that it's embarrassing (for an art site). Thanks.

    Thanks for your response. Your websites look great!  You are to be complimented on your fine design work.
    I've been doing custom sized thumbnails, at around 300px, but they are still a little blurry, like when JPEGs are over optimized and some isolated areas look like they are churning, one shape melting into another like boiling water.  Then, I tried even larger thumbnails, and then shrunk them to a smaller size using HTML commands, hoping  that shrinking them smaller would help tighten up the blurry churning areas. They looked a little better, but the churning areas remained.  When I open up the individual thumbnails in Photoshop and I try using the unsharp mask or the sharpen function, it gets even worse.

  • Optimizer Statistics collection after upgrade from 8i to 10R2

    I just upgraded database from 8.1.7 to 10R2 .
    What would the best approach for Optimizer Statistics collection. We would like to open database for test , but I afraid some quries going to run slow without latest stats. Should I run it manually or let Oracle run it’s default stats collection job later on.
    Any suggestions?

    user594143
    You really need a strategy before an upgrade like this, but you have two options -
    a) try to make the 10g stats collection identical to the 8i stats collection. Check the code you used to run, check the 8i default values for the parameters in your current dbms_stats() calls, and write them in explicitly when you run the code under 10g.
    OR
    b) do a full 10g conversion. Get rid of your own collection code, clear out most of the old settings you had in your parameter file for fiddling with the optimizer, do a 'gather_schema_stats' then leave 10g to do its default thing and fix any problems that appear.
    If you have testing time on a non-production system, then (b) is the strategic option - although personally I think it tends to collect too many histograms and still needs some refinement; if you don't have any testing time and you're going straight into production then (a) is the least threatening option (and if someone's made you do that, you might also set the optimizer_features_enable to 8.1.7 until you can do some proper upgrade tests).
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • SCE 2010 Subscriptions getting disabled automatically

    Hi Experts,
    we are using SCE 2010 server from last 4 years. Of late i have been noticing that the subscriptions are getting disabled automatically. i manually enabled it after which it sends alerts but after couple of minutes the subscriptions get disabled again.
    The database and hard drive spacing is fine. Let me know what could be the possible issue as in the event log i haven't noticed any alerts with regards to this issue.
    regards
    abubakar
    Md.Abubakar Noorani IT Systems Engineer Serco Ltd.

    Hi,
    When a subscription is created the user who created the subscriptions SID is associated with that subscription. There is a workflow that checks every half hour for SIDs no longer valid. They could be invalid because their accounts access that had been removed,
    or possibly because the account has been disabled or deleted. I suggest you re-create the subscription with the current Admin.
    Juke Chou
    TechNet Community Support

  • Internet Information Services (IIS) becomes Disabled automatically on SCCM 2012 Distribution Points

    Hi !
    Internet Information Services (IIS) is getting Disabled automatically on all of our SCCM 2012 Distribution Points.
    Please help and share configuration steps.
    Thank you.

    This is not anything ConfigMgr is doing. The cases I've seen similar to this have had a GPO responsible for this behavior from which the site systems needed to be excluded.
    Jason | http://blog.configmgrftw.com | @jasonsandys

  • MaxDB UpdAllStats - missing optimizer statistics for one name space

    Hi experts,
    every weekend the job UpdAllStats runs in the SAP systems hosted by us (weekdays just PrepUpdStats+UpdStats). Now we're facing the issue that in one system there are no optimizier statistics for all tables in one special name space - let's call it /XYZ/TABLE1 etc.
    We randomly checked tables in that name space via DB20/DB50 and no optimizer statistics could be found. So we randomly checked other tables like MARA, VBAK etc. - all optimizer statistics up to date for those tables.
    We even started the statistics refresh via DB20 manually for one of the tables - still no optimizer statistics appearing for this table.
    I mean it's an update over all optimizer statistics - I rechecked note 927882 - FAQ: SAP MaxDB UPDATE STATISTICS and some others but couldn't find any reason for these tables being exluded. Especially I don't understand why the manual statistics refresh wouldn't work...
    Does anybody have an idea why this could happen?
    Thanks for your ideas in advance!
    Regards
    Marie

    Hi again,
    well it seems to be more of a visualisation problem I guess.
    We figured out that in MaxDB Database Studio you can see the optimizier statistics but not in the SAP system itself.
    We'll keep you up to date.
    Best
    Marie
    Edit: it was really just a visualisation problem... DB Studio rhows the right values

  • IE, Disable 'Automatically Detect Settings' Via GPO

    Hi guys,
    We have recently been having a small problem with IE, whereby the 'automatically detect settings' check box will get ticked - resulting in our users not being able to traverse our proxy server.
    I use the User Configuration > Policies > Windows Settings > IE Maintenance > Connection to set up our proxy settings, however I can't see an option to explicitly disable the 'automatically detect settings' check box.
    Is this located somewhere else in an admin template, or am I simply missing an option that is right in front of me?
    Thanks.
    Glen

    here is a script that does the trick: source
    http://www.craig-tolley.co.uk/2011/08/30/disable-automatically-detect-settings-in-internet-explorer/
    Option Explicit
    On Error Resume Next
    'Create a constant for the HKEY_CURRENT_USER object
    Const HKCU = &H80000001
    'Define variables
    Dim strComputer
    Dim strRegistryKey
    Dim objRegistry
    Dim strRegistryValue
    DIm binValue
    strComputer = "."
    strRegistryKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
    strRegistryValue = "DefaultConnectionSettings"
    'Connect to the Registry
    Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
    'Retrieve the current settings.
    objRegistry.GetBinaryValue HKCU, strRegistryKey, strRegistryValue, binValue
    'Change the 'Automatically detect settings' box to unticked
    binValue(8) = 05
    'binValue(8) = 13 - Enable this line to check the box instead of uncheck
    'Save the changes
    objRegistry.SetBinaryValue HKCU, strRegistryKey, strRegistryValue, binValue

  • How do I disable automatic updating? I am about to switch to another browser because of the frequency with which I am delayed by an automatic update without the option to put it off to another time.

    I have been using Firefox and its ancestors since the beginning. I am at the end of my rope with it. When I click a link or open the browser it is because that is what I seek to have happen. Unless there is a way to turn off automatic updating, I am going to pack it in and find another platform. I cannot see what would be lost if Firefox would do its updating on the way out, when my attention has moved on, and it is not taking up my time. Is there a solution to this with Firefox?

    Hi,
    It is true that the Classic Theme Restorer add-on will NOT bring back all of your customized settings/appearance on Firefox 28, but it will help a little It's recommended that you stay on the latest version to receive the latest security fixes and bug patches but you're free to downgrade if you want.
    You can set these prefs in <code>about:config</code> to disable automatic updating:<br>
    app.update.auto - false<br>
    app.update.enabled - false<br>
    app.update.silent - false<br>

Maybe you are looking for