企业如何通过vue小程序开发满足高效运营与合规性需求
249
2023-12-05
这篇文章主要介绍“Oracle自动收集统计信息怎么实现”,在日常操作中,相信很多人在Oracle自动收集统计信息怎么实现问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Oracle自动收集统计信息怎么实现”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
在Oracle的11g版本中提供了统计数据自动收集的功能。在部署安装11g Oracle软件过程中,其中有一个步骤便是提示是否启动这个功能(默认是启用这个功能)。一、查看自动收集统计信息的任务及状态:SQL> select client_name,status from dba_autotask_client;CLIENT_NAME STATUS---------------------------------------------------------------- --------auto optimizer stats collection ENABLEDauto space advisor ENABLEDsql tuning advisor DISABLEDSQL>二、禁止自动收集统计信息的任务SQL> exec DBMS_AUTO_TASK_ADMIN.DISABLE(client_name => auto optimizer stats collection,operation => NULL,window_name => NULL);PL/SQL procedure successfully completed.SQL> select client_name,status from dba_autotask_client;CLIENT_NAME STATUS---------------------------------------------------------------- --------auto optimizer stats collection DISABLEDauto space advisor ENABLEDsql tuning advisor DISABLED三、启用自动收集统计信息的任务SQL> exec DBMS_AUTO_TASK_ADMIN.ENABLE(client_name => auto optimizer stats collection,operation => NULL,window_name => NULL);PL/SQL procedure successfully completed.SQL> select client_name,status from dba_autotask_client;CLIENT_NAME STATUS---------------------------------------------------------------- --------auto optimizer stats collection ENABLEDauto space advisor ENABLEDsql tuning advisor DISABLED四、获得当前自动收集统计信息的执行时间:SQL> col WINDOW_NAME format a20SQL> col REPEAT_INTERVAL format a70SQL> col DURATION format a20SQL> set line 180SQL> select t1.window_name,t1.repeat_interval,t1.duration from dba_scheduler_windows t1,dba_scheduler_wingroup_members t2where t1.window_name=t2.window_name and t2.window_group_name in (MAINTENANCE_WINDOW_GROUP,BSLN_MAINTAIN_STATS_SCHED);WINDOW_NAME REPEAT_INTERVAL DURATION-------------------- ---------------------------------------------------------------------- --------------------WEDNESDAY_WINDOW freq=daily;byday=WED;byhour=22;byminute=0; bysecond=0 +000 04:00:00SATURDAY_WINDOW freq=daily;byday=SAT;byhour=6;byminute=0; bysecond=0 +000 20:00:00THURSDAY_WINDOW freq=daily;byday=THU;byhour=22;byminute=0; bysecond=0 +000 04:00:00TUESDAY_WINDOW freq=daily;byday=TUE;byhour=22;byminute=0; bysecond=0 +000 04:00:00SUNDAY_WINDOW freq=daily;byday=SUN;byhour=6;byminute=0; bysecond=0 +000 20:00:00MONDAY_WINDOW freq=daily;byday=MON;byhour=22;byminute=0; bysecond=0 +000 04:00:00FRIDAY_WINDOW freq=daily;byday=FRI;byhour=22;byminute=0; bysecond=0 +000 04:00:007 rows selected.其中:WINDOW_NAME:任务名 REPEAT_INTERVAL:任务重复间隔时间 DURATION:持续时间五.修改统计信息执行的时间:1.停止任务:SQL> BEGIN DBMS_SCHEDULER.DISABLE( name => "SYS"."THURSDAY_WINDOW", force => TRUE); --停止任务是true END; /SQL>2.修改任务的持续时间,单位是分钟:SQL> BEGIN DBMS_SCHEDULER.SET_ATTRIBUTE( name => "SYS"."THURSDAY_WINDOW",attribute => DURATION, value => numtodsinterval(60,minute)); END; /3.开始执行时间,BYHOUR=2,表示2点开始执行:SQL> BEGINDBMS_SCHEDULER.SET_ATTRIBUTE( name => "SYS"."THURSDAY_WINDOW", attribute => REPEAT_INTERVAL,value => freq=daily;byday=THU;byhour=10;byminute=40;bysecond=0); END; /4.开启任务:SQL> BEGIN DBMS_SCHEDULER.ENABLE(name => "SYS"."THURSDAY_WINDOW"); END; /5.查看修改后的情况:SQL> select t1.window_name,t1.repeat_interval,t1.duration from dba_scheduler_windows t1,dba_scheduler_wingroup_members t2where t1.window_name=t2.window_name and t2.window_group_name in (MAINTENANCE_WINDOW_GROUP,BSLN_MAINTAIN_STATS_SCHED);WINDOW_NAME REPEAT_INTERVAL DURATION-------------------- ---------------------------------------------------------------------- --------------------WEDNESDAY_WINDOW freq=daily;byday=WED;byhour=22;byminute=0; bysecond=0 +000 04:00:00SATURDAY_WINDOW freq=daily;byday=SAT;byhour=6;byminute=0; bysecond=0 +000 20:00:00THURSDAY_WINDOW freq=daily;byday=THU;byhour=10;byminute=40;bysecond=0 +000 01:00:00TUESDAY_WINDOW freq=daily;byday=TUE;byhour=22;byminute=0; bysecond=0 +000 04:00:00SUNDAY_WINDOW freq=daily;byday=SUN;byhour=6;byminute=0; bysecond=0 +000 20:00:00MONDAY_WINDOW freq=daily;byday=MON;byhour=22;byminute=0; bysecond=0 +000 04:00:00FRIDAY_WINDOW freq=daily;byday=FRI;byhour=22;byminute=0; bysecond=0 +000 04:00:00六.查看统计信息执行的历史记录--维护窗口组select * from dba_scheduler_window_groups;--维护窗口组对应窗口select * from dba_scheduler_wingroup_members--维护窗口历史信息select* from dba_scheduler_windows--查询自动收集任务正在执行的job select * from DBA_AUTOTASK_CLIENT_JOB;--查询自动收集任务历史执行状态select * from DBA_AUTOTASK_JOB_HISTORY;select * from DBA_AUTOTASK_CLIENT_HISTORY;
到此,关于“Oracle自动收集统计信息怎么实现”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~