Automated Database Maintenance Task Management (ADMTM

)
Muhammad Rafi Aamiri Madani on Sunday, June 29, 2008

Introduction

Oracle 11g includes three automated database maintenance tasks:

 

Automatic Optimizer Statistics Collection Gathers stale or missing statistics for all schema objects. The task name is 'auto optimizer stats collection'. Automatic Segment Advisor Identifies segments that could be reorganized to save space. The task name is 'auto space advisor'.

Automatic SQL Tuning Advisor Identifies and attempts to tune high load SQL. The task name is 'sql tuning advisor'.

These tasks run during maintenance windows scheduled to open over night. Configuration of the maintenance tasks, their schedules and resource usage is possible using Enterprise Manager or PL/SQL APIs.

The "Automated Maintenance Tasks" screen displays the maintenance window for each task (Server > Automated Maintenance Tasks (link under Scheduler section)). Click the "Configure" button to navigate to the configuration screens.

Basic Task Configuration
The "Automated Maintenance Tasks Configuration" screen is the stating point for all maintenance task configuration.

The "Global Status" switch allows you to turn enable or disable all automated tasks for all maintenance windows.

/ BEGIN DBMS_AUTO_TASK_ADMIN.disable. EXEC DBMS_AUTO_TASK_ADMIN. EXEC DBMS_AUTO_TASK_ADMIN. END. operation => NULL.disable( client_name => 'auto space advisor'. BEGIN DBMS_AUTO_TASK_ADMIN. window_name => NULL). This can be done using the DBMS_AUTO_TASK_ADMIN package by specifying the task name in the CLIENT_NAME parameter of the DISABLE and ENABLE procedures. The "Task Settings" section allows you to enable or disable individual tasks from all maintenance windows. END. / . window_name => NULL).enable.enable( client_name => 'auto space advisor'.The DISABLE and ENABLE procedures of the DBMS_AUTO_TASK_ADMIN package achieve the same result if they are called with no parameters. operation => NULL.

window_name => 'MONDAY_WINDOW'). This can be done using the DBMS_AUTO_TASK_ADMIN package by specifying the CLIENT_NAME and WINDOW_NAME parameters of the DISABLE and ENABLE procedures. . BEGIN DBMS_AUTO_TASK_ADMIN. operation => NULL. DBMS_AUTO_TASK_ADMIN. The "Configure" button next to the "Optimizer Statistics Gathering" task takes you to the "Global Statistics Gathering Options" screen.disable( client_name => 'auto space advisor'. It allows tasks to be removed or added to individual maintenance windows. END. operation => NULL. operation => NULL.disable( client_name => 'sql tuning advisor'.disable( client_name => 'auto optimizer stats collection'. window_name => 'MONDAY_WINDOW'). DBMS_AUTO_TASK_ADMIN.The "Maintenance Window Group Assignment" section provides the most granular level of control. window_name => 'MONDAY_WINDOW'). / Task Parameter Configuration The "Task Settings" section of the "Automated Maintenance Tasks Configuration" screen includes two "Configure" buttons.

set_global_prefs('estimate_percent'. 'FALSE').set_tuning_task_parameter ('SYS_AUTO_SQL_TUNING_TASK'.With the exception of the history retention. 20).set_tuning_task_parameter ('SYS_AUTO_SQL_TUNING_TASK'. DBMS_SQLTUNE. 10000). EXEC DBMS_STATS.'ACCEPT_SQL_PROFILES'. BEGIN DBMS_SQLTUNE. Clicking the "Edit Window Group" button on the "Automated Maintenance Tasks Configuration" screen allows you to view and modify the . these settings can all be altered with the SET_GLOBAL_PREFS procedure in the DBMS_STATS package.set_tuning_task_parameter ('SYS_AUTO_SQL_TUNING_TASK'. with all windows collected into a window group called "MAINTENANCE_WINDOW_GROUP".'MAX_AUTO_SQL_PROFILES'.alter_stats_history_retention(90). DBMS_SQLTUNE. DBMS_SQLTUNE. 1200).'MAX_SQL_PROFILES_PER_EXEC'. / Maintenance Window Configuration The maintenance windows are defined using the Oracle Scheduler.'LOCAL_TIME_LIMIT'.set_tuning_task_parameter ('SYS_AUTO_SQL_TUNING_TASK'. The "Configure" button next to the "Automatic SQL Tuning" task takes you to the "Automatic SQL Tuning Settings" screen. '5'). These settings can all be altered with the SET_TUNING_TASK_PARAMETER procedure in the DBMS_SQLTUNE package. END. Oracle provide a separate active maintenance window for each day. EXEC DBMS_STATS.

window group. The whole window group can be enabled or disabled using this screen. DBMS_SCHEDULER. DBMS_SCHEDULER. / . Click the "Edit" button alter the window definition. BEGIN DBMS_SCHEDULER. 'minute')). force => TRUE). or in the "Automated Maintenance Tasks Configuration" screen.MAINTENANCE_WINDOW_GROUP'). These configuration changes can be performed using the SET_ATTRIBUTE procedure of the DBMS_SCHEDULER package.disable( name => 'SYS.enable( name => 'SYS. or using the ENABLE and DISABLE procedures in the DBMS_SCHEDULER package.MONDAY_WINDOW'). END.MONDAY_WINDOW'. attribute => 'DURATION'. DBMS_SCHEDULER. takes you to the "View Windows" screen. which gives you a summary of the window configuration. BEGIN DBMS_SCHEDULER. END. / Clicking on the window name on this screen.MONDAY_WINDOW'. force => TRUE).enable(name=>'SYS.MAINTENANCE_WINDOW_GROUP'.disable(name => 'SYS.set_attribute( name => 'SYS. value => numtodsinterval(180.

set_attribute( name => 'SYS.MONDAY_WINDOW'. All maintenance windows are assigned to the "DEFAULT_MAINTENANCE_PLAN" resource plan by default.If you wish to create additional maintenance windows. or create a new plan. attribute => 'RESOURCE_PLAN'. or using the DBMS_SCHEDULER package. you can edit this plan. value => 'MY_NEW_PLAN').MONDAY_WINDOW'.MONDAY_WINDOW'). force => TRUE). END. Resource Plan Configuration The "Edit Window" screen includes "View Resource Plan" and "Create Resource Plan" buttons. DBMS_SCHEDULER. These buttons take you to the resource manager maintenance screens. If necessary. BEGIN DBMS_SCHEDULER. DBMS_SCHEDULER.enable(name=>'SYS.disable(name => 'SYS. / Relevant Views The following views display information related to the automated database maintenance tasks:     DBA_AUTOTASK_CLIENT_JOB DBA_AUTOTASK_CLIENT DBA_AUTOTASK_JOB_HISTORY DBA_AUTOTASK_WINDOW_CLIENTS . you need assign it to the relevant maintenance windows in the "Edit Window" screen. make sure they are assigned to the "MAINTENANCE_WINDOW_GROUP" window group. If you create a new resource plan.

 DBA_AUTOTASK_CLIENT_HISTORY Posted by Muhammad Rafi Aamiri Madani .

Sign up to vote on this title
UsefulNot useful