存储过程大概如下 create or replace PROCEDURE PROC_IN_CSE_LOGIN_TEST ( LOG_TIME_ DATE DEFAULT GETDAY(SYSDATE-1)) as BEGIN DBMS_MVIEW.REFRESH('load.USER_ALL','FAST'); COMMIT; END;
手动执行 exec PROC_IN_CSE_LOGIN_TEST ;
ORA-01031: 权限不足 ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2537 ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2743 ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2712 ORA-06512: 在 "CSE.PROC_IN_CSE_LOGIN_TEST", line 10 ORA-06512: 在 line 1 01031. 00000 - "insufficient privileges"
解决办法:使用authid current_user
create or replace PROCEDURE PROC_IN_CSE_LOGIN_TEST ( LOG_TIME_ DATE DEFAULT GETDAY(SYSDATE-1)) authid current_user is BEGIN DBMS_MVIEW.REFRESH('load.USER_ALL','FAST'); COMMIT; END;