千家信息网

11g 自动收集统计信息

发表于:2024-11-20 作者:千家信息网编辑
千家信息网最后更新 2024年11月20日,13Automatic Optimizer Statistics Collection打开:BEGIN DBMS_AUTO_TASK_ADMIN.ENABLE( client_name =>
千家信息网最后更新 2024年11月20日11g 自动收集统计信息

13Automatic Optimizer Statistics Collection


打开:

BEGIN  DBMS_AUTO_TASK_ADMIN.ENABLE(     client_name => 'auto optimizer stats collection' ,    operation   => NULL,    window_name => NULL);END;/

关闭:

BEGIN  DBMS_AUTO_TASK_ADMIN.DISABLE(     client_name => 'auto optimizer stats collection',    operation   => NULL ,    window_name => NULL);END;/

数据库监视这每个表的变化信息,当变化超过10%就自动收集统计信息:

(查询统计信息是否过期?DBA_TAB_STATISTICS

Monitoring tracks the approximate number of INSERTs, UPDATEs, and DELETEs for that table and whether the table has been truncated since the last time statistics were gathered. You can access information about changes of tables in the USER_TAB_MODIFICATIONS view. Following a data-modification, there may be a few minutes delay while Oracle Database propagates the information to this view. Use the DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO procedure to immediately reflect the outstanding monitored information kept in the memory.

The GATHER_DATABASE_STATS or GATHER_SCHEMA_STATS procedures gather new statistics for tables with stale statistics when the OPTIONS parameter is set to GATHER STALE orGATHER AUTO. If a monitored table has been modified more than 10%, then these statistics are considered stale and gathered again.

When to Use Manual Statistics?
  • Volatile tables that are deleted or truncated and rebuilt during the course of the day.

  • Objects that are the target of large bulk loads which add 10% or more to the object's total size.


0