从Oracle 11g开始,Oracle的自动化维护任务更智能化了,默认情况下,在安装数据库的过程中,如果启用自动化维护任务的话,数据库会在工作日的每晚22:00到第二天的凌晨2:00,周末的凌晨6:00到第二天的凌晨2:00,自动对数据库进行诸如优化器的统计信息收集、自动SQL的优化。且在自动化维护的过程中,数据库会使用较少的CPU资源,以防止自动化维护任务使用到过多的资源而影响到用户的正常使用。
其一,在使用DBCA建库的时候,我们可以看到这一自动维护任务的选项:
其二,如果启用了自动化维护任务的话,也可以从数据库的alert日志里看到下述信息:
Fri Mar 23 22:00:00 2012 Setting Resource Manager plan SCHEDULER[0x3007]:DEFAULT_MAINTENANCE_PLAN via scheduler window Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter Fri Mar 23 22:00:00 2012 Starting background process VKRM Fri Mar 23 22:00:00 2012 VKRM started with pid=24, OS id=10743 Fri Mar 23 22:00:33 2012 Begin automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Fri Mar 23 22:01:32 2012 End automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Fri Mar 23 22:05:56 2012 Thread 1 cannot allocate new log, sequence 8 Private strand flush not complete Current log# 1 seq# 7 mem# 0: +DATA/ocm11g/onlinelog/group_1.261.778667669 Current log# 1 seq# 7 mem# 1: +FLASH/ocm11g/onlinelog/group_1.257.778667673 Thread 1 advanced to log sequence 8 (LGWR switch) Current log# 2 seq# 8 mem# 0: +DATA/ocm11g/onlinelog/group_2.262.778667673 Current log# 2 seq# 8 mem# 1: +FLASH/ocm11g/onlinelog/group_2.258.778667675 Sat Mar 24 02:00:00 2012 Clearing Resource Manager plan via parameter Sat Mar 24 06:00:00 2012 Setting Resource Manager plan SCHEDULER[0x3008]:DEFAULT_MAINTENANCE_PLAN via scheduler window Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter Sat Mar 24 06:00:00 2012 Starting background process VKRM Sat Mar 24 06:00:01 2012 VKRM started with pid=29, OS id=15277 Sat Mar 24 06:00:21 2012 Begin automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Sat Mar 24 06:00:49 2012 End automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Sat Mar 24 06:02:05 2012 Thread 1 cannot allocate new log, sequence 9 Private strand flush not complete Current log# 2 seq# 8 mem# 0: +DATA/ocm11g/onlinelog/group_2.262.778667673 Current log# 2 seq# 8 mem# 1: +FLASH/ocm11g/onlinelog/group_2.258.778667675 Thread 1 advanced to log sequence 9 (LGWR switch) Current log# 3 seq# 9 mem# 0: +DATA/ocm11g/onlinelog/group_3.263.778667677 Current log# 3 seq# 9 mem# 1: +FLASH/ocm11g/onlinelog/group_3.259.778667677 Sat Mar 24 08:56:14 2012 Thread 1 advanced to log sequence 10 (LGWR switch) Current log# 1 seq# 10 mem# 0: +DATA/ocm11g/onlinelog/group_1.261.778667669 Current log# 1 seq# 10 mem# 1: +FLASH/ocm11g/onlinelog/group_1.257.778667673 Sat Mar 24 14:06:51 2012 Thread 1 cannot allocate new log, sequence 11 Private strand flush not complete Current log# 1 seq# 10 mem# 0: +DATA/ocm11g/onlinelog/group_1.261.778667669 Current log# 1 seq# 10 mem# 1: +FLASH/ocm11g/onlinelog/group_1.257.778667673 Thread 1 advanced to log sequence 11 (LGWR switch) Current log# 2 seq# 11 mem# 0: +DATA/ocm11g/onlinelog/group_2.262.778667673 Current log# 2 seq# 11 mem# 1: +FLASH/ocm11g/onlinelog/group_2.258.778667675 Sat Mar 24 18:11:25 2012 Thread 1 advanced to log sequence 12 (LGWR switch) Current log# 3 seq# 12 mem# 0: +DATA/ocm11g/onlinelog/group_3.263.778667677 Current log# 3 seq# 12 mem# 1: +FLASH/ocm11g/onlinelog/group_3.259.778667677 Sun Mar 25 02:00:00 2012 Clearing Resource Manager plan via parameter Sun Mar 25 02:00:30 2012 Thread 1 advanced to log sequence 13 (LGWR switch) Current log# 1 seq# 13 mem# 0: +DATA/ocm11g/onlinelog/group_1.261.778667669 Current log# 1 seq# 13 mem# 1: +FLASH/ocm11g/onlinelog/group_1.257.778667673 Sun Mar 25 06:00:00 2012 Setting Resource Manager plan SCHEDULER[0x3009]:DEFAULT_MAINTENANCE_PLAN via scheduler window Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter Sun Mar 25 06:00:00 2012 Starting background process VKRM Sun Mar 25 06:00:00 2012 VKRM started with pid=29, OS id=21059 Sun Mar 25 06:00:15 2012 Begin automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Sun Mar 25 06:00:33 2012 End automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Sun Mar 25 08:56:21 2012 Thread 1 advanced to log sequence 14 (LGWR switch) Current log# 2 seq# 14 mem# 0: +DATA/ocm11g/onlinelog/group_2.262.778667673 Current log# 2 seq# 14 mem# 1: +FLASH/ocm11g/onlinelog/group_2.258.778667675 Sun Mar 25 14:08:09 2012 Thread 1 cannot allocate new log, sequence 15 Private strand flush not complete Current log# 2 seq# 14 mem# 0: +DATA/ocm11g/onlinelog/group_2.262.778667673 Current log# 2 seq# 14 mem# 1: +FLASH/ocm11g/onlinelog/group_2.258.778667675 Thread 1 advanced to log sequence 15 (LGWR switch) Current log# 3 seq# 15 mem# 0: +DATA/ocm11g/onlinelog/group_3.263.778667677 Current log# 3 seq# 15 mem# 1: +FLASH/ocm11g/onlinelog/group_3.259.778667677 Sun Mar 25 22:08:35 2012 Thread 1 cannot allocate new log, sequence 16 Private strand flush not complete Current log# 3 seq# 15 mem# 0: +DATA/ocm11g/onlinelog/group_3.263.778667677 Current log# 3 seq# 15 mem# 1: +FLASH/ocm11g/onlinelog/group_3.259.778667677 Thread 1 advanced to log sequence 16 (LGWR switch) Current log# 1 seq# 16 mem# 0: +DATA/ocm11g/onlinelog/group_1.261.778667669 Current log# 1 seq# 16 mem# 1: +FLASH/ocm11g/onlinelog/group_1.257.778667673 Mon Mar 26 02:00:00 2012 Clearing Resource Manager plan via parameter Mon Mar 26 10:14:25 2012 Thread 1 advanced to log sequence 17 (LGWR switch) Current log# 2 seq# 17 mem# 0: +DATA/ocm11g/onlinelog/group_2.262.778667673 Current log# 2 seq# 17 mem# 1: +FLASH/ocm11g/onlinelog/group_2.258.778667675 Mon Mar 26 22:00:00 2012 Setting Resource Manager plan SCHEDULER[0x3003]:DEFAULT_MAINTENANCE_PLAN via scheduler window Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter Mon Mar 26 22:00:00 2012 Starting background process VKRM Mon Mar 26 22:00:00 2012 VKRM started with pid=24, OS id=9542 Mon Mar 26 22:00:30 2012 Begin automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Mon Mar 26 22:00:59 2012 End automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK" Mon Mar 26 22:02:17 2012 Thread 1 cannot allocate new log, sequence 18 Private strand flush not complete Current log# 2 seq# 17 mem# 0: +DATA/ocm11g/onlinelog/group_2.262.778667673 Current log# 2 seq# 17 mem# 1: +FLASH/ocm11g/onlinelog/group_2.258.778667675 Thread 1 advanced to log sequence 18 (LGWR switch) Current log# 3 seq# 18 mem# 0: +DATA/ocm11g/onlinelog/group_3.263.778667677 Current log# 3 seq# 18 mem# 1: +FLASH/ocm11g/onlinelog/group_3.259.778667677 Tue Mar 27 02:00:00 2012 Clearing Resource Manager plan via parameter
从上,上周五晚上22:00(Fri Mar 23 22:00:00 2012)到上周六凌晨2:00(Sat Mar 24 02:00:00 2012)数据库执行自动化维护任务,上周六、日凌晨6:00到次日凌晨2:00数据库执行自动化维护任务,本周一自动化维护任务的窗口又开始回到晚上22:00到次日凌晨2:00点之间。可见,Oracle 11g相比以前版本的数据库更加自动化、智能化。