DBA_AUTOTASK_TASK 和 Dba_Autotask_Client 的区别

转自:

DBA_AUTOTASK_TASK 和 Dba_Autotask_Client 的区别-brjl-ChinaUnix博客

正文

自动维护任务都有哪些,知道点的会看dba_autotask开头的一些数据字典:

但很容易把DBA_AUTOTASK_TASK 当作任务列表信息,其实看收集统计信息等这些任务的状态应该看Dba_Autotask_Client。

DBA_AUTOTASK_TASK 用途:显示有关当前和过去自动维护任务的信息。 
这里的记录数是动态变化的,可能是3条,也可能是1条或者空。

有时DBA_AUTOTASK_TASK中状态与Dba_Autotask_Client中不一致,根据官方解释:

  1. 任务可以由不同/多个客户端使用。因此,即使我们禁用客户端,DBA_AUTOTASK_TASK 仍可能显示启用状态。在当前版本中,TASKS 只有一个 CLIENT。但是在 
  2. oracle 的未来版本中,TASKS 可以有多个 CLIENTS,因此 DBA_AUTOTASK_TASK 中的状态将显示为 ENABLED。
  3. 所以检查状态的正确方法是通过DBA_AUTOTASK_CLIENT。

这个 DBA_AUTOTASK_TASK 的内容是几个视图关联的结果,重要的信息来自KET$_CLIENT_TASKS这个基表,这个里面的数据是动态变化的,如果禁用掉某个任务则会消失一条,另外,自动清理作业也可能会清空这里的信息,或者因为窗口时间太短导致 DBA_AUTOTASK_TASK 为空(Doc ID 1610257.1)。

参考:
DBA_AUTOTASK_TASK 和 DBA_AUTOTASK_CLIENT 显示自动优化器统计收集的不同状态(文档 ID 858852.1)
How Can We Find Out Status Of Task 'Auto Optimizer Stats Collection' (Doc ID 779596.1)

附录:

DBA_AUTOTASK_TASK 和 DBA_AUTOTASK_CLIENT 显示自动优化器统计收集的不同状态(文档 ID 858852.1)

Applies to:

Oracle Database - Enterprise Edition - Version 11.1.0.6 to 11.2.0.3 [Release 11.1 to 11.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

We are Trying to Disable the Auto Optimizer Stats Collection in 11G.
DBA_AUTOTASK_CLIENT shows that the 'auto optimizer stats collection' is disabled. But DBA_AUTOTASK_TASK shows that the Task is Enabled.
 

BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'auto optimizer stats collection',
operation => NULL,
window_name => NULL);
END;
/

PL/SQL procedure successfully completed.

Checking the Status from DBA_AUTOTASK_TASK & DBA_AUTOTASK_CLIENT


SQL> select client_name,status from DBA_AUTOTASK_TASK;
.
CLIENT_NAME STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection ENABLED  <<=== 
auto space advisor ENABLED
sql tuning advisor ENABLED
.
SQL> select client_name,status from Dba_Autotask_Client;
.
CLIENT_NAME STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection DISABLED  <<=== 
auto space advisor ENABLED
sql tuning advisor ENABLED

Changes

Cause

This is expected Behavior.
The views assume that there is a one to many relationship between CLIENTS and TASKS.
Task can be used by different/multiple client.  So even though if we disable the client, the DBA_AUTOTASK_TASK may still show the status as enabled.  In current version, the TASKS has only one CLIENT. But in future version of  oracle , the TASKS can have multiple CLIENTS so the status in DBA_AUTOTASK_TASK will show as ENABLED.
So the correct way to check the status is through DBA_AUTOTASK_CLIENT.

Solution

Use DBA_AUTOTASK_CLIENT to check the status.
 

SQL> select client_name,status from Dba_Autotask_Client;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值