将主库的统计信息通过expdp/impdp传输到测试库,然后调用dbms_stats.import_table_stats导入,却遭遇以下错误
SQL> exec dbms_stats.import_table_stats(ownname => user,tabname => 'a',stattab => 'a_stat');
begin dbms_stats.import_table_stats(ownname => user,tabname => 'a',stattab => 'a_stat'); end;
ORA-20000: TABLE "SYS"."a_stat" does not exist or insufficient privileges
ORA-06512: at "SYS.DBMS_STATS", line 7115
ORA-06512: at "SYS.DBMS_STATS", line 8016
ORA-06512: at line 2
表明明属于justin用户,错误信息却显示该API去查找sys用户
调用10046,发现错误出现在哪里了,这是语句终止前最后一条
select obj#,type#,ctime,mtime,stime,status,dataobj#,flags,oid$, spare1, spare2 from obj$ where owner#=:1 and name=:2 and namespace=:3 and remoteowner is null and linkname is null and subname is null
END OF STMT
PARSE #12:c=1000,e=707,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=1273851541041681
BINDS #12:
kkscoacd
Bind#0
acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 p

在尝试通过dbms_stats.import_table_stats导入统计信息时,遇到ORA-20000错误,提示表不存在或权限不足。错误源于一个索引的所有者被错误地设为了SYS。解决方案是删除SYS用户下的索引并在正确用户下重建,或者在调用时指定statown参数。

1201

被折叠的 条评论
为什么被折叠?



