在dbms_stats中可以通過gather_schema_stats和objecttab兩個procedure來完成對當前schema下沒有做過statstic的對像(index,table,cluster)的列表,我們來看下面的例子:
這是對scott這個schema下的object做的統計:
declare
l_owner varchar2(30) := 'SCOTT';
l_emptylst dbms_stats.objecttab;
begin
dbms_stats.gather_schema_stats(ownname => l_owner,
options => 'LIST EMPTY', objlist => l_emptylst);
for i in nvl(l_emptylst.first, 0) .. nvl(l_emptylst.last, 0) loop
dbms_output.put_line(l_emptylst(i).objtype || '/' || l_emptylst(i).objname);
end loop;
end;
輸出---------------
INDEX/PK_DEPT
INDEX/PK_EMP
INDEX/STAT_TAB
TABLE/BONUS
TABLE/SALGRADE
TABLE/STAT_TAB
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51843/,如需转载,请注明出处,否则将追究法律责任。