- 以下存储过程编译正常,其中的SQL语句在PLSQL执行也正常,但是在存储过程中执行即报告错误:ORA-01031: insufficient privileges。
- create or replace procedure DBA_REBUILD_INDEX
- As
- Begin
- execute immediate 'alter index PK_DUBAI_STORAGE_OUT_MANIFEST rebuild online';
- execute immediate 'alter index WATERGAUGE_PK rebuild online';
- Return;
- end DBA_REBUILD_INDEX;
- 查找资料后发现,在存储过程中添加如下内容即可:Authid Current_User,修改后的存储过程结构如下
- create or replace procedure DBA_REBUILD_INDEX Authid Current_User
- As
- Begin
- execute immediate 'alter index PK_DUBAI_STORAGE_OUT_MANIFEST rebuild online';
- execute immediate 'alter index WATERGAUGE_PK rebuild online';
- Return;
- end DBA_REBUILD_INDEX;
本文转自zylhsy 51CTO博客,原文链接:http://blog.51cto.com/yunlongzheng/963831,如需转载请自行联系原作者