在对数据库的表空间使用率进行巡检的时候发现SYSAUX利用率过高,通常都会认为是WRH$、WRI$之类的对象造成的。这次发现了
SQLOBJ$PLAN对象也占用不少的存储空间,就去查找了一下关于SQLOBJ$PLAN表的作用,先说处理的方法可以直接truncate不会对数据库造成影响
truncate table SYS.SQLOBJ$PLAN
在mos中搜索只有一个PPT有关于SQLOBJ$PLAN的描述,个人根据字面理解就是存储的历史基线计划信息。

SYS.SQLOBJ$PLAN这个表的DDL语句
-- Create table
create table SQLOBJ$PLAN
(
signature NUMBER not null,
category VARCHAR2(128) not null,
obj_type NUMBER not null,
plan_id NUMBER not null,
statement_id VARCHAR2(30),
xpl_plan_id NUMBER,
timestamp DATE,
remarks VARCHAR2(4000),
operation VARCHAR2(30),
options VARCHAR2(255),
object_node VARCHAR2(128),
object_owner VARCHAR2(128),
object_name VARCHAR2(128),
object_alias VARCHAR2(261),
object_instance NUMBER,
object_type VARCHAR2(30),
optimizer VARCHAR2(255),
search_columns NUMBER,
id NUMBER not null,
parent_id NUMBER,
depth NUMBER,
position NUMBER,
cost NUMBER,
cardinality NUMBER,
bytes NUMBER,
other_tag VARCHAR2(255),
partition_start VARCHAR2(255),
partition_stop VARCHAR2(255),
partition_id NUMBER,
other LONG,
distribution VARCHAR2(30),
cpu_cost NUMBER,
io_cost NUMBER,
temp_space NUMBER,
access_predicates VARCHAR2(4000),
filter_predicates VARCHAR2(4000),
projection VARCHAR2(4000),
time NUMBER,
qblock_name VARCHAR2(128),
other_xml CLOB
)
tablespace SYSAUX
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 1
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table SQLOBJ$PLAN
add constraint SQLOBJ$PLAN_PKEY primary key (SIGNATURE, CATEGORY, OBJ_TYPE, PLAN_ID, ID)
using index
tablespace SYSAUX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
涉及的主键SQLOBJ$PLAN_PKEY,关于主键mos上有个相关问题案例How To Rebuild SQLOBJ$PLAN_PKEY If A Corrupted Block Is Found (Doc ID 2450722.1)




