Bo's Oracle Station

查看: 2958|回复: 0

课程第55次(2017-07-15星期六下午)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2017-7-15 15:29:03 | 显示全部楼层 |阅读模式
  1. select  substr(t.TABLE_NAME, 3,1 ) ,count(*)
  2. from dba_tables t
  3. where t.OWNER='SYS' and t.TABLESPACE_NAME='SYSAUX'
  4. and t.TABLE_NAME  like 'WR_$%'
  5. group by  substr(t.TABLE_NAME, 3,1 );
复制代码
  1. select  * from dba_views  v
  2. where v.view_name='DBA_ALERT_HISTORY';
  3.   
  4. select * from dict d
  5.   where d.table_name  like '%ACTIVE%';
  6.   
  7.   select  * from dba_views v
  8.    where v.view_name='DBA_HIST_ACTIVE_SESS_HISTORY';
复制代码
  1. select  t.TABLE_NAME
  2. from dba_tables t
  3. where t.OWNER='SYS' and t.TABLESPACE_NAME='SYSAUX'
  4. and t.TABLE_NAME  like 'WRH$%'
  5. order by t.TABLE_NAME;

  6. select  * from v$asm_diskgroup;

  7. select  t.TABLE_NAME
  8. from dba_tables t
  9. where t.OWNER='SYS' and t.TABLESPACE_NAME='SYSAUX'
  10. and t.TABLE_NAME  like 'WRI$%'
  11. order by t.TABLE_NAME;

  12. select  t.TABLE_NAME
  13. from dba_tables t
  14. where t.OWNER='SYS' and t.TABLESPACE_NAME='SYSAUX'
  15. and t.TABLE_NAME  like 'WRM$%'
  16. order by t.TABLE_NAME;


  17. select  * from WRM$_snapshot;

  18. select  t.TABLE_NAME
  19. from dba_tables t
  20. where t.OWNER='SYS' and t.TABLESPACE_NAME='SYSAUX'
  21. and t.TABLE_NAME  like 'WRR$%'
  22. order by t.TABLE_NAME;
复制代码
Screenshot.png

  1. SQL> exec dbms_stats.gather_table_Stats('HR','TABC') ;

  2. PL/SQL procedure successfully completed.

  3. SQL> insert into  tabc  values ( 'a1' ,1 ) ;

  4. 1 row created.

  5. SQL> commit;

  6. Commit complete.

  7. SQL> create index iabc on tabc ( uname ) ;

  8. Index created.

  9. SQL>  insert into  tabc  values ( 'a2' ,2  ) ;

  10. 1 row created.

  11. SQL> commit;

  12. Commit complete.

  13. SQL> exec dbms_stats.gather_table_Stats('HR','TABC') ;

  14. PL/SQL procedure successfully completed.

  15. SQL>
复制代码
  1. select  t.NUM_ROWS, t.LAST_ANALYZED
  2.   from dba_tables t
  3.   where t.OWNER='HR' and t.TABLE_NAME='TABC';
  4.   
  5.   select  i.NUM_ROWS , i.LAST_ANALYZED
  6.     from dba_indexes i
  7.          where i.OWNER='HR' and i.INDEX_NAME='IABC';
复制代码
  1. SQL> insert into tabc select  * from t04209_uname  where uvalue > 2   ;

  2. 99998 rows created.

  3. SQL> commit;

  4. Commit complete.

  5. SQL> update tabc  set uvalue=100 where uvalue < 99900 ;         

  6. 99899 rows updated.

  7. SQL> commit;

  8. Commit complete.

  9. SQL> exec dbms_Stats.gather_table_stats('HR','TABC') ;

  10. PL/SQL procedure successfully completed.

  11. SQL> begin
  12.   2   for i in 1..100
  13.   3   loop
  14.   4    update tabc  set uvalue=i where uname = 'a'||to_char(i);  
  15.   5   end loop;
  16.   6   commit;
  17.   7  end;
  18.   8  /

  19. PL/SQL procedure successfully completed.

  20. SQL> exec dbms_stats.gather_table_stats ('HR', 'TABC' , estimate_percent=>100 , method_opt=>'for all columns size auto for columns uvalue size 254' );

  21. PL/SQL procedure successfully completed.
复制代码
  1. SQL> exec dbms_stats.gather_table_stats ('HR', 'TABC' , estimate_percent=>100 ,  method_opt=>'for all columns size skewonly') ;

  2. PL/SQL procedure successfully completed.
复制代码
  1. begin
  2. dbms_stats.gather_schema_stats('HR');
  3. end;

  4. select  * from dict where table_name like 'DBA_%PREF%';

  5. select  * from DBA_TAB_STAT_PREFS;

  6. select   dbms_stats.get_prefs('method_opt')  from dual;
复制代码
  1. select  * from v$fixed_table
  2. where name like 'V$%STAT';

  3. select  * from v$fixed_table
  4. where name like 'V$%CLASS%';

  5. select   wait_class  from V$SYSTEM_WAIT_CLASS;
复制代码

Screenshot.png

  1. select   s.sid, s.SQL_HASH_VALUE, s.SQL_ID
  2.   from v$session s
  3.   where s.sid  in ( 40, 272 );
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-24 07:13 , Processed in 0.042044 second(s), 27 queries .

快速回复 返回顶部 返回列表