Friday, 23 March 2018

ORA-01031: insufficient privileges

Issue: ORA-01031: insufficient privileges

Scenario: Whenever I tried to create the below package  as shown below:
CREATE OR REPLACE PACKAGE test_services AS
    TYPE ref_cursor IS REF CURSOR;
    PROCEDURE get_service_data (
        textval    IN VARCHAR2,
        mycursor   OUT ref_cursor
    );

END test_services;

I was getting the below error:
Error starting at line : 1 in command -
CREATE OR REPLACE PACKAGE test_services AS
    TYPE ref_cursor IS REF CURSOR;
    PROCEDURE get_service_data (
        textval    IN VARCHAR2,
        mycursor   OUT ref_cursor
    );

END test_services;

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

Cause of the Issue: There is no GRANT privilege given to the USER to create a package.

Solution: Thus we need to login to the ADMIN account and GRANT package creation privilege using the below command

GRANT CREATE PROCEDURE TO gsmuser;
Now when we try to create the package it gets created successfully as shown below:
Hence the solution to the requirement.

If you like the post, please comment, share the post and do like me on Facebook

Thanks & Regards,
Susanto Paul.