查看某表的统计信息
SQL> select table_name,NUM_ROWS, BLOCKS ,to_char(LAST_ANALYZED,'yyyymmdd hh24:mi:ss') from dba_tables where table_name='TSM_RATECOUNT';
TABLE_NAME NUM_ROWS BLOCKS TO_CHAR(LAST_ANAL
------------------------------ ---------- ---------- -----------------
TSM_RATECOUNT 142 5 20140723 22:02:05
SQL> select count(*) from TSM_RATECOUNT;
COUNT(*)
----------
142
收集统计信息
exec dbms_stats.gather_table_stats(ownname=> 'ADMIN',tabname=> 'a' cascade=> true ,no_invalidate=> false,degree =>4);
查看优化器模式(系统级别)
SQL> select name,value from V$parameter where name='optimizer_mode';
NAME VALUE
-------------------------------------------------------------------------------- ---------------------------------------------------
optimizer_mode ALL_ROWS
判断optimizer_mode参数设置(session级别)
conn /as sysdba
oradebug setospid
oradebug unlimit
oradebug dump processstate 10
oradebug tracefile_name
SQL> select table_name,NUM_ROWS, BLOCKS ,to_char(LAST_ANALYZED,'yyyymmdd hh24:mi:ss') from dba_tables where table_name='TSM_RATECOUNT';
TABLE_NAME NUM_ROWS BLOCKS TO_CHAR(LAST_ANAL
------------------------------ ---------- ---------- -----------------
TSM_RATECOUNT 142 5 20140723 22:02:05
SQL> select count(*) from TSM_RATECOUNT;
COUNT(*)
----------
142
收集统计信息
exec dbms_stats.gather_table_stats(ownname=> 'ADMIN',tabname=> 'a' cascade=> true ,no_invalidate=> false,degree =>4);
查看优化器模式(系统级别)
SQL> select name,value from V$parameter where name='optimizer_mode';
NAME VALUE
-------------------------------------------------------------------------------- ---------------------------------------------------
optimizer_mode ALL_ROWS
判断optimizer_mode参数设置(session级别)
conn /as sysdba
oradebug setospid
oradebug unlimit
oradebug dump processstate 10
oradebug tracefile_name