Update statistics for database

I'm needing to update stats on all tables in the database, and an unsure how to do so, and haven't been able to find any documentation for it. Could someone help me in this, show me the code on how to make this happen.
Thanks

Hi,
There are multiple sites and articles that explain the issue in depth (just google oracle statistics, [http://www.oracle.com/technology/pub/articles/lewis_cbo.html] is a very good example).
Basically statistics help generate execution plans for your queries and DMLs.
It is recommended to gather statistics with the DBMS_STATS package ([http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_stats.htm]).
Regards,
Yuri
[http://it.toolbox.com/blogs/living-happy-oracle]

Similar Messages

  • AUTOMATIC UPDATE STATISTICS for VB* tables ON automatically

    Hello All,
    We had reviewed our ECC system with SAP and they recommended us to OFF the AUTOMATIC UPDATE STATISTICS for VBDATA, VBHDR and VBMOD.
    We executed the script EXEC sp_autostats <tablename>, 'OFF' but the status goes ON after a while.
    Checked the SAP note 771352 but did not get proper idea from it.
    MS SQL database used is 2008.
    Can someone suggest and share his/her experience.
    Regards,
    Mohit

    Hi Mohit,
    Did you ran the sap_z* script ?
    What is your SP level - did you check 1702325 - Alerts appear for VB tables
    Also, I asked to to use NORECOMPUTE - have you tried that ?
    Regards

  • Update Statistics for the database MS-SQL

    hi all ,
    I want to run the statistics programmatically ( update statistics ) and our database is MS-SQL. Can any one tell me which is the suitable function module to do the same.
    Thanks,
    Ram

    If you did not find this - I found the function module 'update_stats'.
    How this helps
    Or maybe you found somthing else?

  • SQL 2008 R2 Best Practices for Updating Statistics for a 1.5 TB VLDB

    We currently have a ~1.5 TB VLDB (SQL 2008 R2) that services both OLTP and DSS workloads pretty much on a 24x7x365 basis. For many years we have been updating statistics (full scan- 100% sample size) for this VLDB once a week on the weekend, which
    is currently taking up to 30 hours to complete.
    Somewhat recently we have been experiencing intermitent issues while statistics are being updated, which I doubt is just a coincidence. I'd like to understand exactly why the process of updating statistics can cause these issues (timeouts/errors). My theory
    is that the optimizer is forced to choose an inferior execution plan while the needed statistics are in "limbo" (stuck between the "old" and the "new"), but that is again just a theory. I'm somewhat surprised that the "old" statistics couldn't continue to
    get used while the new/current statistics are being generated (like the process for rebuilding indexes online), but I don't know all the facts behind this mechanism yet so that may not even apply here.
    I understand that we have the option of reducing the sample percentage/size for updating statistics, which is currently set at 100% (full scan).  Reducing the sample percentage/size for updating statistics will reduce the total processing time, but
    it's also my understanding that doing so will leave the optimizer with less than optimal statistics for choosing the best execution plans. This seems to be a classic case of not being able to have one’s cake and eat it too.
    So in a nutshell I'm looking to fully understand why the process of updating statistics can cause access issues and I'm also looking for best practices in general for updating statistics of such a VLDB. Thanks in advance.
    Bill Thacker

    I'm with you. Yikes is exactly right with regard to suspending all index optimizations for so long. I'll probably start a separate forum thread about that in the near future, but for now lets stick to the best practices for updating statistics.
    I'm a little disappointed that multiple people haven't already chimed in about this and offered up some viable solutions. Like I said previously, I can't be the first person in need of such a thing. This database has 552 tables with a whole lot more statistics
    objects than that associated with those tables. The metadata has to be there for determining which statistics objects can go (not utilized much if at all so delete them- also produce an actual script to delete the useless ones identified) and what
    the proper sample percentage/size should be for updating the remaining, utilized statistics (again, also produce a script that can be used for executing the appropriate update statistics commands for each table based on cardinality).
    The above solution would be much more ideal IMO than just issuing a single update statistics command that samples the same percentage/size for every table (e.g. 10%). That's what we're doing today at 100% (full scan).
    Come on SQL Server Community. Show me some love :)
    Bill Thacker

  • When need to update statistics for a table

    In Sybase we use "delete statistics ", "update all statistics " and "sp_recompile ", does Oracle need to do such things in any case? Thank you!

    Modern versions have a default job to do this, which may or may not be appropriate in its settings.  Volumes have been written about it.  Version and app dependent.  Highly recommend studying Jonathan Lewis' books.
    Stored procedures automatically recompile on use, although there can be issues dependent on bad design or configuration.

  • Database updates statistics maintenance plan issue.

    Hi team,
    We are configured one job through maintenance plan that job name is “database update statistics” and database size is 280 Gb, this job executing 13 to 15 hours but job was not finished  still it’s continually running.
    This same job I am running through below script it’s executing within 2 hours.
    Use database
    Go
    Exec sp_updatestats
    What is the main problem if this maintenance plan.
    Note: on this server no jobs and no traffic, only abc_update subpaln1 Job.

    Hello,
    Updating stats for whole database which is 280 G will always result in problem.It is better to run update statistics for tables and indexes which are changed frequently.
    Now to your question few points which sp_Updatestas list in BOL
    http://technet.microsoft.com/en-us/library/ms173804.aspx
    sp_updatestats updates statistics on disabled nonclustered indexes and does not update statistics on disabled clustered indexes.
    sp_updatestats updates only the statistics that require updating based on the rowmodctr information in the sys.sysindexes catalog view, thus avoiding unnecessary updates of statistics
    on unchanged rows.
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Update Statistics and Rebuild of Indexes

    Hi friends,
    If I execute the Update statistics for a given table thru DB20 does it have any effect on the indexes of this table or is it necessary to rebuild the index using db02
    Regards
    Aliila

    Updating Statistics does not rebuild index while in update states logs it will show you information regarding which indexes needs to be rebuiled which you can rebuild by brtools or executing rsanaora prg in se38.
    Shivam

  • IF Auto Update Statistics ENABLED in Database Design, Why we need to Update Statistics as a maintenance plan

    Hi Experts,
    IF Auto Update Statistics ENABLED in Database Design, Why we need to Update Statistics as a maintenance plan for Daily/weekly??
    Vinai Kumar Gandla

    Hi Vikki,
    Many systems rely solely on SQL Server to update statistics automatically(AUTO UPDATE STATISTICS enabled), however, based on my research, large tables, tables with uneven data distributions, tables with ever-increasing keys and tables that have significant
    changes in distribution often require manual statistics updates as the following explanation.
    1.If a table is very big, then waiting for 20% of rows to change before SQL Server automatically updates the statistics could mean that millions of rows are modified, added or removed before it happens. Depending on the workload patterns and the data,
    this could mean the optimizer is choosing a substandard execution plans long before SQL Server reaches the threshold where it invalidates statistics for a table and starts to update them automatically. In such cases, you might consider updating statistics
    manually for those tables on a defined schedule (while leaving AUTO UPDATE STATISTICS enabled so that SQL Server continues to maintain statistics for other tables).
    2.In cases where you know data distribution in a column is "skewed", it may be necessary to update statistics manually with a full sample, or create a set of filtered statistics in order to generate query plans of good quality. Remember,
    however, that sampling with FULLSCAN can be costly for larger tables, and must be done so as not to affect production performance.
    3.It is quite common to see an ascending key, such as an IDENTITY or date/time data types, used as the leading column in an index. In such cases, the statistic for the key rarely matches the actual data, unless we update the Statistic manually after
    every insert.
    So in the case above, we could perform manual statistics updates by
    creating a maintenance plan that will run the UPDATE STATISTICS command, and update statistics on a regular schedule. For more information about the process, please refer to the article:
    https://www.simple-talk.com/sql/performance/managing-sql-server-statistics/
    Regards,
    Michelle Li

  • PeopleSoft Database Update Statistics

    I am trying to find out what is the best practices for implementing the Update statistics on Psoft Database. Any help or documentation regarding will be a great help
    I am looking for
    what is the best practice for update statistics on oracle , Intervals , Tables , do we need to include any custom script to generate and include all big tables.

    I was the one who designed the pscbo_stats package to leverage the statistics collection techniques used in EBS and Seibel. (Mr. Sierra was the wizard who coded it.) I just noticed this thread and wanted to comment.
    If you are using the pscbo_stats, the gather_schema_stats() procedure will by default gather only stale statistics, so it can be run regularly. I suggest weekly. You can follow the contents of the pscbo_log table for historical data for all (non-dynamic) stats gathering activities.
    If you find there is a table that constantly stale and forcing you to think that the schema statistics should gathered more often, you may want to have two schedules - one weekly for schema, and one more often (daily?) to capture the more volatile objects excepting, of course, those that are already dynamically sampled.
    There may be objects that are volatile enough that they should be added to the Stage Table Exception table. (see the stage_table_ins() procedure) We added that feature to configure dynamic sampling to work on volatile table - tables that are not working storage for COBOL and App Engine but are so often stale that they should be dynamically sampled.
    I find that there are a few transactional tables that work well when dynamically sampled. For example, PSTREESELECT* tables can be problematic if they are dynamically rebuilt by a nVision report book - the end points can get stale quickly. They may be a good candidate for dynamic sampling.
    Lastly, I am very interested to know user experience with the pscbo_stats package. Please post your comments to the communities.oracle.com forum for "Install/Upgrade PSFT".

  • Database update statistics

    Hi
    I am in the middle of ECC 5.0 installation (IDES). At the step 29 database update statistics, system stops giving error
    CJS-00288  Could not update database statistics. DIAGNOSIS: Command brconnect -c -f crsyn -o SAPDEV returned 128, which is not a success code. SOLUTION: See brconnect.log for details.
    brconnect log is empty.

    Hi Sandhya
    Check the Link:  [Link |http://sap.ittoolbox.com/groups/technical-functional/sap-basis/ides-r3-47-installation-error-1701550]
    and SAP notes 593582 and 145777
    Edited by: Anindya Bose on Dec 10, 2009 2:38 PM

  • Oracle 11g upgrade: How to update stale statistics for sys and sysman?

    Hi,
    I am in the process of testing Oracle 11g upgrade from Oracle 10.2.0.3. I have run utlu111i.sql on the 10g database.
    The utility utlu111i.sql reports about the stale statistics for SYS and SYSMAN components.
    I executed dbms_stats.gather_dictionary_stats; dbms_stats.gather_schema_stats('SYS'); and dbms_stats.gather_schema_stats('SYSMAN');
    After that the utlu111i.sql still reports the stale statistics for sys and sysman. Does anyone know how to get rid off this warning successfully?
    Thanks,
    Sreekanth

    Does anyone know how to get rid off this warning successfully?Just ignore the warnings. Check The Utlu111i.Sql Pre-Upgrade Script Reports Stale Sys Statistics - 803774.1 from Metalink.

  • Infoview prompts for database logon screen when updating dynamic parameter

    I have already set up initial database ID/PW for the report in CMS, but when I I tried to update my parameter to schedule the report, it is requiring the user to enter database ID/PW again........Is there a way to set this up so that the user can bypass this step since it is quite annoying?
    Thanks.

    Is your lov created Business View Manager? If it is, you can store the userid and password in the data connection your business view is based on.
    1) Start Business View Manager. Close the default screen that appears.
    2) Click View > Repository Explorer on the menu bar.
    3) Expand the Dynamic Cascading Prompts folder. Locate the "Data Connection" for the appropriate dynamic parameter. It will be in the form of <parameter_name>_DC (i.e. it will have the name of the parameter and then '_DC').
    4) Double-click the Data Connection. "Property Browser" will appear.
    5) Type the database user name and password in that Property Browser.
    6) Set the Runtime Prompt to Never Prompt.
    7) Save the changes to the Data Connection.
    The prompt for database logon information will no longer appear when changing parameter values.
    Hitomi

  • With my  Os X 10.7.5 , I updated outlook for mac, it took a while, kept wanting me to close microsoft database Daemon,finally managed to upgrade to outlook 14.3.2, after new start is EVERTYTHING in outlook Gone. At the same time updated our laptop, with n

    with my  Os X 10.7.5 , I updated outlook for mac, it took a while, kept wanting me to close microsoft database Daemon,finally managed to upgrade to outlook 14.3.2, after new start is EVERTYTHING in outlook Gone. At the same time updated our laptop, with n

    This forum is for troubleshooting Apple Software Update for Windows, a software package for Windows designed to update Apple products that run on Windows, and not related to Microsoft Office in any way. I suggest you post Office related questions on Microsoft's own forums for their Mac products.
    http://www.officeformac.com/productforums

  • How to disable the timer job for "Database Statistics"

    I want to disable the database statistics timer job using the powershell, but I cant find the exact name of it in the list of timer jobs.
    tried
    Get-SpTimerjob to manually look for it Get-SPTimerJob SPDatabaseStatisticsJobDefinitionor and also looked for staadmin name job-database-statistics
    I even tried to look for it in the list of timer job definitions for a web application with no luck.
    I want to disable the timerjob, so that I can run proc_DefragmentIndices on sharepoint config and SharePoint admin databases.
    SELECT DB_ID() AS [sharepoint_admincontent_cab0c190-db30-4f2c-8b71-504b81d2b5d1];
    GO
    SELECT * FROM sys.dm_db_index_physical_stats
        (1, NULL, NULL, NULL , 'DETAILED');
    1 1131151075
    1 1
    CLUSTERED INDEX
    IN_ROW_DATA 2
    0 52.6315789473684
    1 1131151075
    1 1
    CLUSTERED INDEX
    IN_ROW_DATA 2
    1 0
    1 1131151075
    2 1
    NONCLUSTERED INDEX
    IN_ROW_DATA
    2 0
    80
    Thanks
    Nate

    Thank you Trevor, 
    As per this blog (http://www.houberg.com/2008/05/16/sharepoint-database-indexes-and-statistics/) it seems like
    Microsoft allows this (not explicitly though)
    I ran the Health Analyzer rule  for "Databases used by SharePoint have fragmented Indexes" for all servers.
    I am still seeing a lot of cluster and non clustered indexes having avg_fragmentation_in_percent
     > 60%.
    SELECT * FROM sys.dm_db_index_physical_stats (7, NULL, NULL, NULL , 'DETAILED');
    I finally thought that I should rebuild the indexes to fix the issue, but please suggest if that is not the correct approach to resolve the high fragmented indexes.
    thanks
    Nate

  • How to find for ex : kunnr is updating how many database tables

    Hi all
    How to find for ex : kunnr is updating how many database tables .
    Rgds
    Rafi .

    hi rafi
    go to se15->abap dictionary->fields->table fields-> give kunnr at  field name text box->press f8.
    then it will show ,in how many tables the kunnr field exist.the kunnr field updates those tables.
    don't forget reward points.
    kiran

Maybe you are looking for

  • ITunes 6.0.1 is a pain...

    I Dont feel like reading all the posts here so link me around. Doesn't anyone else have problems w/iTunes 6.0.1 or just 6.0? I can listen to my music fine but, if i quit which sometimes I do, when I goto open it again it messes up and goes real slow.

  • Converting XML document to HTMl using xsl

    Hi, I'm trying to convert an xml document into html page using xsl. But when I try to open the page in the browser nothing comes up. I'm not sure if I am using the PrintWriter correctly. StreamResult result = new StreamResult(new PrintWriter(new (Fil

  • A question about Oracle installer and a possible bug in JVM

    Hello, I appreciate if you could kindly guide me to solve the following problem. I'm trying to install Oracle11g Enterprise on a Linux system (Redhat Enterprise 5.3). There is no X system, and therefore I chose to install by using a response file in

  • Very brief about SD process

    Hi Experts... iam wrking as technical consultant..could please send me a document or link whick expalins very brief about SD process( i dont require pdf explain bout the full process). i need simple document which explains about SD  process, masterda

  • AspectJ usage for compilation error on field/class Member type

    Hello, I have stuck up with impleamentation of functionality to achieve following- I have class ABC and have multiple members in that. I want to give compiler error if the field type is List or non-primitive. I am trying this with AspectJ. But could