Recently faced performance issue on database - overall system went slow.
From AWR reports it was noted that
[ sql_id b6usrg82hwsa3 -- call dbms_stats.gather_database_stats_job_proc ( ) ] was executed repeated number of times consuming high CPU.
Workaround was to disable Internal Automated tasks
SQL> SELECT CLIENT_NAME, STATUS FROM DBA_AUTOTASK_CLIENT;
CLIENT_NAME STATUS-----------------------------------------------------
auto optimizer stats collection enabled
auto space advisor enabled
sql tuning advisor enabled
Syntax to Disable :-
exec DBMS_AUTO_TASK_ADMIN.DISABLE('AUTO OPTIMIZER STATS COLLECTION', NULL, NULL);
begin DBMS_AUTO_TASK_ADMIN.disable(client_name=>'auto space advisor',operation=>NULL,window_name=>NULL);end;
Syntax to Enableexec DBMS_AUTO_TASK_ADMIN.ENABLE('AUTO OPTIMIZER STATS COLLECTION', NULL, NULL);
begin DBMS_AUTO_TASK_ADMIN.enable(client_name=>'auto space advisor',operation=>NULL,window_name=>NULL);end;
CPU performance showed much improvement after above action plan was implemented.
As the internal stats collection process is disabled, we need to run statistics manually
Procedure to Schedule Statistics Manually
create or replace procedure gather_db_stats_weeklyasbeginDBMS_STATS.gather_database_stats;end;/----- dbms scheduler programBEGINSYS.DBMS_SCHEDULER.CREATE_PROGRAM(program_name => 'gather_db_stats_weekly_PRG',program_type => 'STORED_PROCEDURE',program_action => 'gather_db_stats_weekly',number_of_arguments => 0,enabled => FALSE,comments => 'Gather Weekly Statistics on Database');SYS.DBMS_SCHEDULER.ENABLE(name => 'gather_db_stats_weekly_PRG');END;/--- dbms_scheduler job to run every week Saturday at 2:00 AMBEGINSYS.DBMS_SCHEDULER.CREATE_JOBSYS.DBMS_SCHEDULER.CREATE_JOB(job_name => 'SYS.EXEC_GATHER_DB_STATS_WEEKLY',start_date => TO_TIMESTAMP_TZ('2023/06/05 02:10:00.000000 Asia/Riyadh','yyyy/mm/dd hh24:mi:ss.ff tzr'),repeat_interval => 'Freq=Weekly;ByDay=SAT;ByHour=2;ByMinute=00',end_date => NULL,program_name => 'SYS.GATHER_DB_STATS_WEEKLY_PRG',comments => 'Weekly job on saturday');SYS.DBMS_SCHEDULER.ENABLE(name => 'SYS.EXEC_gather_db_stats_weekly');END;/
SET LINES 300SET PAGES 999COL CLIENT_NAME FOR A35COL CONSUMER_GROUP FOR A30COL WINDOW_GROUP FOR A20COL STATUS FOR A10SELECT CLIENT_NAME,STATUS,CONSUMER_GROUP,CLIENT_TAG,WINDOW_GROUPFROMDBA_AUTOTASK_CLIENT;
SET LINES 300SET PAGES 999COL CLIENT_NAME FOR A35COL CONSUMER_GROUP FOR A30COL WINDOW_GROUP FOR A20COL STATUS FOR A10SELECT CLIENT_NAME,STATUS,CONSUMER_GROUP,CLIENT_TAG,WINDOW_GROUPFROMDBA_AUTOTASK_CLIENT;
SET LINES 300SET PAGES 999COL WINDOW_NAME FOR A18COL REPEAT_INTERVAL FOR A72COL WINDOW_DURATION FOR A32COL ENABLED FOR A10SELECT WINDOW_NAME,REPEAT_INTERVAL,TO_CHAR(EXTRACT(DAY FROM DURATION),'90') || ' Days ' ||TO_CHAR(EXTRACT(HOUR FROM DURATION),'90') || ' Hours ' ||TO_CHAR(EXTRACT(MINUTE FROM DURATION),'90') || ' Minutes 'WINDOW_DURATION,ENABLEDFROMDBA_SCHEDULER_WINDOWS;
No comments:
Post a Comment