我在使用dba_hist_seg_stat时遇到问题。它不会在新创建的表上记录有关该操作的信息。以下是完整的示例。我创建了一个表和3行,创建了一个快照,对一个表进行了很少的操作,创建了第二个快照,最后我试图为一个新表查找一个统计信息,但是选择什么也找不到。这是什么问题?我注意到经过一些操作后,我可以看到一些统计信息,但它是随机发生的。
-- create test data
drop table testXX
/
create table testXX
(
a VARCHAR2(8),
b VARCHAR2(255),
c INTEGER
)
tablespace SDATA
/
INSERT INTO testXX (a,b,c) VALUES ('23423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('13423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('03423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('23423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('13423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('03423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('23423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('13423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('03423424','234234', 2222)
/
INSERT INTO testXX (a,b,c) VALUES ('03423424','234234', 2222)
/
-- creating snapshoot
EXEC dbms_workload_repository.create_snapshot;
/
-- few sample select
SELECT * FROM testXX
/
SELECT * FROM testXX WHERE a='23423424'
/
-- creating final snapshoot
EXEC dbms_workload_repository.create_snapshot;
select
owner,
object_name,
LOGICAL_READS_DELTA,
BUFFER_BUSY_WAITS_DELTA ,
DB_BLOCK_CHANGES_DELTA ,
PHYSICAL_READS_DELTA ,
PHYSICAL_WRITES_DELTA ,
PHYSICAL_READS_DIRECT_DELTA ,
PHYSICAL_WRITES_DIRECT_DELTA
from
dba_hist_seg_stat s,
dba_hist_seg_stat_obj o,
dba_hist_snapshot sn
where
o.object_name = 'TESTXX'
and
s.obj# = o.obj#
AND
S.SNAP_ID=SN.SNAP_ID
AND
SN.SNAP_ID=(SELECT MAX(SNAP_ID) FROM DBA_HIST_SNAPSHOT)
order by
3 desc
/
and
s.obj# = o.obj#
order by
3 desc;