Wednesday, 14 March 2018

Grant CREATE Table privileges to USER in Oracle - ORA-01031: insufficient privileges

When I tried to create the below table, I was getting an exception ORA-01031: insufficient privileges.

Table Name:
CREATE TABLE student (
    student_id      NUMBER PRIMARY KEY,
    student_name    VARCHAR2(30) NOT NULL,
    date_of_birth   DATE NOT NULL,
    address         VARCHAR2(200)

);

Exception:
Error starting at line : 1 in command -
CREATE TABLE student (
    student_id      NUMBER PRIMARY KEY,
    student_name    VARCHAR2(30) NOT NULL,
    date_of_birth   DATE NOT NULL,
    address         VARCHAR2(200)
)
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

Solution:
For the solution of the above Exception we need to Login to the Admin account, and Grant permission to create a table using GRANT CREATE ANY TABLE TO gsmuser; as shown below:
Thus after granting the privileges, we were able to create table 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