We know that ORA-01031 Insufficient Privileges means current user did not have the right privilege to access or process the SQL statement.
We can see this error almost in every kind of SQL statement, sometimes you would never know what privilege you have required. We have several situation where we can face the ORA-01031 error.
While trying to create directory facing below error.
SQL> create directory CUST_DIR as ‘/data01/db/TEMP’;
create directory CUST_DIR as ‘/data01/db/TEMP’
*
ERROR at line 1:
ORA-01031: insufficient privileges
The ORA-01031 “insufficient privileges” error occurs when you attempt to execute a program or function for which you have not been granted the appropriate privileges.
You must have the “CREATE ANY DIRECTORY” system privilege to create directories with Oracle. To provide privilege, log into Oracle database with a user who possess the SYSDBA role.
SQL> connect system/manager as SYSDBA;
Connected.
SQL> grant create any directory to xxabc;
Granted.
SQL> connect xxabc/*
Connected.
SQL> create directory CUST_DIR as ‘/data01/db/TEMP’;
Directory created.