ORA-01031 means the current user tried an operation that needs a system privilege it does not have, such as CREATE USER, ALTER SYSTEM, or CREATE VIEW. The statement itself is correct; the account is not allowed to run it. The fix is either to run it as a user that has the privilege, or to have an administrator grant the missing privilege, as narrowly as possible.
Reproduce the Error
A developer account tries two administrative statements:
Example:
create user demo_someone no authentication; alter system set open_cursors = 500;
Output:
Error starting at line : 1 In command - create user demo_someone no authentication Error report - ORA-01031: insufficient privileges Error starting at line : 2 In command - alter system set open_cursors = 500 Error report - ORA-01031: insufficient privileges
Find What the Session Can Do
SESSION_PRIVS lists the system privileges in effect now, directly granted or through roles, and USER_ROLE_PRIVS lists the roles:
Example:
-- which of these system privileges does this session have?
select privilege from session_privs
where privilege in ('CREATE TABLE', 'CREATE VIEW', 'CREATE USER', 'ALTER SYSTEM')
order by privilege;
select granted_role from user_role_privs order by 1;Output:
PRIVILEGE _______________ CREATE TABLE CREATE VIEW GRANTED_ROLE ______________________ CTXAPP DB_DEVELOPER_ROLE SELECT_CATALOG_ROLE SODA_APP
CREATE TABLE and CREATE VIEW are there, CREATE USER and ALTER SYSTEM are not, which matches the two errors.
Fix: Grant the Missing Privilege
An administrator grants the privilege to the user, or to a role the user has:
Syntax:
grant create user to app_admin; grant create view to app_owner;
Grant only what the work needs. Administrative statements such as ALTER SYSTEM usually belong to a DBA account rather than an application schema.
Things to Know
- Privileges received through a role do not count inside definer's rights PL/SQL or for objects a view is built on; grant those directly.
- In Oracle AI Database 26ai, creating a view over a table you can read only through a role raises ORA-41904, "Missing object privilege ... to create a view", instead of ORA-01031.
- For a missing object privilege, such as SELECT on another schema's table, Oracle usually reports ORA-00942 instead, so the object's existence is not revealed.
Related Guides
Conclusion
ORA-01031 means the user lacks the system privilege for the statement. Check SESSION_PRIVS, then run the statement as an account that has the privilege, or have an administrator grant just that privilege, directly when views or PL/SQL depend on it.
