Oracle 23.26PrivilegesLab-verified · 2026-11-29

ORA-01917: user or role 'APP_READ' does not exist

The grantee named in GRANT is neither an existing user nor an existing role.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-01917: user or role 'APP_READ' does not exist

Jump to a cause

  1. 01Granting to a role that has not been created
  2. 02Typo in the user name
  3. 03The user was created with a quoted lowercase name

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

ORA-01917 comes from GRANT when the name after TO is not an existing user or role. Unquoted names are uppercased, so the message shows the name Oracle actually looked for.

The three runs below are the usual causes. Check the name first: SELECT username FROM all_users for users and SELECT role FROM dba_roles for roles.

01Granting to a role that has not been created

A script granted SELECT ON orders TO app_read before the role existed and got ORA-01917: user or role 'APP_READ' does not exist. The asterisk points at the grantee.

dba_roles returned 0 rows for APP_READ. After SYSTEM ran CREATE ROLE app_read, the same GRANT succeeded and user_tab_privs_made showed APP_READ / ORDERS / SELECT.

Setup
Setuprun as system
BEGIN
  EXECUTE IMMEDIATE 'DROP ROLE app_read';
EXCEPTION WHEN OTHERS THEN NULL;
END;
/
OUTPUT
PL/SQL procedure successfully completed.
Setuprun as lab_a
CREATE TABLE orders (id NUMBER PRIMARY KEY, amount NUMBER);
OUTPUT
Table created.
Reproducerun as lab_a
GRANT SELECT ON orders TO app_read;
✕ ERROR
GRANT SELECT ON orders TO app_read
                          *
ERROR at line 1:
ORA-01917: user or role 'APP_READ' does not exist
Help: https://docs.oracle.com/error-help/db/ora-01917/
Checkrun as system
SELECT COUNT(*) AS role_count FROM dba_roles WHERE role = 'APP_READ';
OUTPUT
ROLE_COUNT
----------
         0

1 row selected.
Fixrun as system
CREATE ROLE app_read;
OUTPUT
Role created.
After the fixrun as lab_a
GRANT SELECT ON orders TO app_read;
COLUMN grantee FORMAT A10
COLUMN table_name FORMAT A10
COLUMN privilege FORMAT A10
SELECT grantee, table_name, privilege FROM user_tab_privs_made WHERE table_name = 'ORDERS';
✓ SUCCESS
Grant succeeded.


GRANTEE    TABLE_NAME PRIVILEGE
---------- ---------- ----------
APP_READ   ORDERS     SELECT

1 row selected.

02Typo in the user name

GRANT SELECT ON orders TO lab_bb failed with ORA-01917 for 'LAB_BB'.

all_users listed LAB_A and LAB_B. GRANT SELECT ON orders TO lab_b succeeded.

Setup
Setuprun as lab_a
CREATE TABLE orders (id NUMBER PRIMARY KEY, amount NUMBER);
OUTPUT
Table created.
Reproducerun as lab_a
GRANT SELECT ON orders TO lab_bb;
✕ ERROR
GRANT SELECT ON orders TO lab_bb
                          *
ERROR at line 1:
ORA-01917: user or role 'LAB_BB' does not exist
Help: https://docs.oracle.com/error-help/db/ora-01917/
Checkrun as lab_a
COLUMN username FORMAT A10
SELECT username FROM all_users WHERE username LIKE 'LAB%' ORDER BY username;
OUTPUT
USERNAME
----------
LAB_A
LAB_B

2 rows selected.
After the fixrun as lab_a
GRANT SELECT ON orders TO lab_b;
✓ SUCCESS
Grant succeeded.

03The user was created with a quoted lowercase name

The user was created as "report_user" in double quotes, so its name is stored in lowercase. GRANT CREATE SESSION TO report_user looked for REPORT_USER in uppercase and failed with ORA-01917.

dba_users showed the name as report_user in lowercase. GRANT CREATE SESSION TO "report_user" with the same quotes succeeded.

Setup
Setuprun as system
DROP USER IF EXISTS "report_user" CASCADE;
CREATE USER "report_user" IDENTIFIED BY "Lab#2026pw";
OUTPUT
User dropped.


User created.
Reproducerun as system
GRANT CREATE SESSION TO report_user;
✕ ERROR
GRANT CREATE SESSION TO report_user
                        *
ERROR at line 1:
ORA-01917: user or role 'REPORT_USER' does not exist
Help: https://docs.oracle.com/error-help/db/ora-01917/
Checkrun as system
COLUMN username FORMAT A12
SELECT username FROM dba_users WHERE UPPER(username) = 'REPORT_USER';
OUTPUT
USERNAME
------------
report_user

1 row selected.
After the fixrun as system
GRANT CREATE SESSION TO "report_user";
DROP USER "report_user" CASCADE;
✓ SUCCESS
Grant succeeded.


User dropped.

FAQ

How do I check whether a user or role exists in Oracle?

Users: SELECT username FROM all_users WHERE username = 'NAME';. Roles (needs DBA views): SELECT role FROM dba_roles WHERE role = 'NAME';.

Why does the message show my name in uppercase?

Unquoted identifiers are uppercased. If the user was created with double quotes and lowercase letters, you must use the same quotes in GRANT.

What is the difference between ORA-01917 and ORA-01918?

ORA-01917 is raised by GRANT when the grantee (user or role) is missing. ORA-01918 is raised by statements such as DROP USER or ALTER USER when the user is missing.

My install script fails with ORA-01917 on GRANT. What should I check?

The order of the script. CREATE ROLE and CREATE USER must run before the GRANT statements that use them.

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