oracle 错误:ORA-01031:权限不足
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31487289/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error: ORA-01031: insufficient privileges
提问by Do Nhu Vy
I have a problem.
我有个问题。
CREATE TABLE accounts(
id INTEGER,
name VARCHAR2(100)
)
/
CREATE OR REPLACE FUNCTION account_balance(account_id_in IN accounts.id%TYPE)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
/
Error:
错误:
Error starting at line : 1 in command -
CREATE OR REPLACE FUNCTION account_balance(account_id_in IN accounts.id%TYPE)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
Error report -
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges
Please help me resolve above error, thank you!
请帮我解决上面的错误,谢谢!
回答by sstan
As pointed out in the comments, you are missing the required permissions to create the function from whatever user account you are currently using.
正如评论中所指出的,您缺少从当前使用的任何用户帐户创建函数所需的权限。
Let's assume your less privileged login is called some_user
. To fix your problem, login as your more privileged account, and apply the following GRANT
statement:
假设您的权限较低的登录名为some_user
。要解决您的问题,请以您的特权帐户登录,并应用以下GRANT
语句:
grant create procedure to some_user;
Documentation: GRANT
文档:GRANT
CREATE PROCEDURE
: Create stored procedures, functions, and packages in the grantee's schema.
CREATE PROCEDURE
:在被授权者的架构中创建存储过程、函数和包。
回答by BuSaeed
Login as
登录为
sys as sysdba
then execute the following command after changing username to your username
然后在将用户名更改为您的用户名后执行以下命令
GRANT CREATE PROCEDURE TO username;