存储过程如下: create or replace procedure ad.table_analyse_bill( p_BillMonth in number,--bill_month p_tail in number, p_nInsId in number, p_nSeqId in number, --no use p_nStatus out number, p_szErrorMsg out varchar2 ) is v_sql varchar2(2000); table_name var
Oracle重建所有表的索引的sql: SELECT 'alter index ' || INDEX_NAME || ' rebuild online nologging;' FROM USER_INDEXES WHERE TABLESPACE_NAME = 'xxx' AND STATUS = 'VALID' AND TEMPORARY = 'N' AND INDEX_TYPE = 'NORMAL' AND PARTITIONED = 'NO'; 然后把结果放到PLSQL命令容器执行即可. O
CREATE OR REPLACE PROCEDURE SchameB.PRC_GATHER_STATS AUTHID CURRENT_USER IS BEGIN SYS.DBMS_STATS.GATHER_TABLE_STATS('SchName', 'TableName', CASCADE => TRUE); END; / select owner,table_name,last_analyzed,num_rows from dba_tables where owner='SYSTEM' a
在11g中,默认自己主动收集统计信息的时间为晚上10点(周一到周五,4个小时),早上6点(周六,周日,20个小时),例如以下所看到的: select a.window_name, a.repeat_interval,a.duration from dba_scheduler_windows a, dba_scheduler_wingroup_members b where a.window_name = b.window_name and b.window_group_name = 'MAINT
1. 理解什么是统计信息 优化器统计信息就是一个更加详细描述数据库和数据库对象的集合,这些统计信息被用于查询优化器,让其为每条SQL语句选择最佳的执行计划.优化器统计信息包括: · 表的统计信息 o 行数 o Block数 o 行平均长度 · 列的统计信息 o 列中不同值的数量 o 列中null的数量 o 数据分布(柱状图/直方图) · 索引的统计信息 o 叶子块的数量 o 索引的高度 o 聚簇因子(cl
overview Oracle's cost-based optimizer (COB) uses statistics to calculate the selectivity (the fraction of rows in a table that the SQL statement's predicate chooses) of predicates and to estimate the "cost" of each execution plan. The COB will
GRANULARITY Determines the granularity of statistics to collect. This value is only relevant for partitioned tables. 参数可选项: GRANULARITY - The value determines granularity of statistics to collect (only pertinent if the table is partitioned). 'ALL' -