Oracle 23.26PrivilegesLab-verified · 2026-11-30

ORA-41904: Missing object privilege on "OWNER"."TABLE" to create a view

The SELECT privilege on the other user's table comes only through a role, and a view needs it granted directly.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-41904: Missing object privilege on "LAB_B"."ITEMS" to create a view.

Jump to a cause

  1. 01SELECT on the table was granted to a role, not to you
  2. 02SELECT ANY TABLE comes through a role

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-30 · container image gvenzl/oracle-free:23-slim

Oracle 23ai (26ai) reports this case with a new code, ORA-41904.

Roles are not used when Oracle checks privileges for a view you own. In both cases below, SELECT COUNT(*) FROM lab_b.items worked in the same session, but CREATE VIEW on that table failed. The fix that worked was a direct GRANT SELECT ON items TO lab_a from the owner.

01SELECT on the table was granted to a role, not to you

The DBA created role item_reader, granted it SELECT on lab_b.items, and gave the role to lab_a. lab_a could query the table (COUNT 1), but CREATE VIEW v_items AS SELECT item_id, name FROM lab_b.items failed with ORA-41904.

After the owner ran GRANT SELECT ON items TO lab_a, the same CREATE VIEW returned "View created." and the view returned BOLT.

Setup
Setuprun as lab_b
CREATE TABLE items (item_id NUMBER PRIMARY KEY, name VARCHAR2(20));
INSERT INTO items VALUES (1, 'BOLT');
COMMIT;
OUTPUT
Table created.


1 row created.


Commit complete.
Setuprun as system
DROP ROLE IF EXISTS item_reader;
CREATE ROLE item_reader;
GRANT SELECT ON lab_b.items TO item_reader;
GRANT item_reader TO lab_a;
OUTPUT
Role dropped.


Role created.


Grant succeeded.


Grant succeeded.
Reproducerun as lab_a
SELECT COUNT(*) FROM lab_b.items;
CREATE VIEW v_items AS SELECT item_id, name FROM lab_b.items;
✕ ERROR
  COUNT(*)
----------
         1

1 row selected.

CREATE VIEW v_items AS SELECT item_id, name FROM lab_b.items
                                                       *
ERROR at line 1:
ORA-41904: Missing object privilege on "LAB_B"."ITEMS" to create a view.
Help: https://docs.oracle.com/error-help/db/ora-41904/
Fixrun as lab_b
GRANT SELECT ON items TO lab_a;
OUTPUT
Grant succeeded.

If other users will query your view, the owner must grant WITH GRANT OPTION; otherwise granting your view to them fails with ORA-01720.

After the fixrun as lab_a
CREATE VIEW v_items AS SELECT item_id, name FROM lab_b.items;
SELECT * FROM v_items;
✓ SUCCESS
View created.


   ITEM_ID NAME
---------- ------------------------------
         1 BOLT

1 row selected.

02SELECT ANY TABLE comes through a role

Here lab_a had no object grant at all, only the role report_role holding the system privilege SELECT ANY TABLE. The query worked, but CREATE VIEW again failed with ORA-41904.

The check showed REPORT_ROLE in user_role_privs and 0 rows in user_tab_privs for LAB_B.ITEMS. After a direct GRANT SELECT ON items TO lab_a, the view was created.

Setup
Setuprun as lab_b
CREATE TABLE items (item_id NUMBER PRIMARY KEY, name VARCHAR2(20));
INSERT INTO items VALUES (1, 'BOLT');
COMMIT;
OUTPUT
Table created.


1 row created.


Commit complete.
Setuprun as system
DROP ROLE IF EXISTS report_role;
CREATE ROLE report_role;
GRANT SELECT ANY TABLE TO report_role;
GRANT report_role TO lab_a;
OUTPUT
Role dropped.


Role created.


Grant succeeded.


Grant succeeded.
Reproducerun as lab_a
SELECT COUNT(*) FROM lab_b.items;
CREATE VIEW v_items AS SELECT item_id, name FROM lab_b.items;
✕ ERROR
  COUNT(*)
----------
         1

1 row selected.

CREATE VIEW v_items AS SELECT item_id, name FROM lab_b.items
                                                       *
ERROR at line 1:
ORA-41904: Missing object privilege on "LAB_B"."ITEMS" to create a view.
Help: https://docs.oracle.com/error-help/db/ora-41904/
Checkrun as lab_a
COLUMN granted_role FORMAT A15
SELECT granted_role FROM user_role_privs WHERE granted_role = 'REPORT_ROLE';
SELECT COUNT(*) AS direct_grants FROM user_tab_privs WHERE owner = 'LAB_B' AND table_name = 'ITEMS';
OUTPUT
GRANTED_ROLE
---------------
REPORT_ROLE

1 row selected.


DIRECT_GRANTS
-------------
            0

1 row selected.
Fixrun as lab_b
GRANT SELECT ON items TO lab_a;
OUTPUT
Grant succeeded.
After the fixrun as lab_a
CREATE VIEW v_items AS SELECT item_id, name FROM lab_b.items;
SELECT * FROM v_items;
✓ SUCCESS
View created.


   ITEM_ID NAME
---------- ------------------------------
         1 BOLT

1 row selected.

FAQ

What does ORA-41904 Missing object privilege to create a view mean?

You are creating a view on a table you do not own, and your SELECT on it is not granted directly to you. Privileges that come through a role do not count for views you own.

I can SELECT the table. Why does CREATE VIEW fail?

The SELECT works through a role, which is enough for queries in your session. A view keeps working after your session ends, so Oracle requires a direct grant.

How do I check whether a privilege is direct or through a role?

Direct object grants are in user_tab_privs. Roles you have are in user_role_privs. In our test the role was there and user_tab_privs had 0 rows for the table.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0