ORA-20005: object statistics are locked (stattype = ALL) 解决方法
ORA-20005: object statistics are locked (stattype = ALL) 解决方法
执行统计信息时,报错:begin
DBMS_STATS.GATHER_TABLE_STATS (ownname => '"TAG3"',
tabname => '"CITY_INFO_T"',
estimate_percent => 10
);
end;
执行请求的操作时遇到错误:
ORA-20005: object statistics are locked (stattype = ALL)
ORA-06512: 在 "SYS.DBMS_STATS", line 24281
ORA-06512: 在 "SYS.DBMS_STATS", line 24332
ORA-06512: 在 line 1供应商代码 20005
使用此方法解决问题:
SQL> exec dbms_stats.unlock_schema_stats(ownname => 'TAG3');
PL/SQL procedure successfully completed
再次执行编译信息时,执行正常。
declare
i varchar2(40);
begin
for i in (select t.TABLE_NAME
from user_tables t
where t.TABLESPACE_NAME = 'TAG3') loop
execute immediate 'analyze table ' || i.table_name ||
' compute statistics';
end loop;
end;
/
统计表空间或用户模式下的表信息。
最后检查下所属表中行数信息。
select t.owner,t.table_name,t.num_rows from dba_tables t where t.owner='TAG3' order by 3 desc
目录 返回
首页