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
ORA-01045 means the username and password were accepted, but the account is not allowed to open a session. Older releases say user APP_USER lacks CREATE SESSION privilege; logon denied; 23ai/26ai says Login denied. User APP_USER does not have CREATE SESSION privilege.
Unlike ORA-01017, the message tells you exactly what is missing. In the lab it came from a new user created with no grants, and from a role that holds CREATE SESSION but is not a default role. The message is in English even in Korean or Japanese environments because the session language is not set before login.
01New user created without GRANT CREATE SESSION
CREATE USER app_user IDENTIFIED BY ... alone gives no privileges. Logging in as app_user failed with ORA-01045.
The check showed no rows in dba_sys_privs or dba_role_privs (GRANTS = 0). After GRANT CREATE SESSION TO app_user, the login worked and SELECT user FROM dual returned APP_USER.
Setup
DROP USER IF EXISTS app_user CASCADE;
CREATE USER app_user IDENTIFIED BY "App_Pw_2026";User dropped.
User created.CONNECT app_user/"App_Pw_2026"@//localhost/FREEPDB1ERROR:
ORA-01045: Login denied. User APP_USER does not have CREATE SESSION privilege.
Help: https://docs.oracle.com/error-help/db/ora-01045/
Warning: You are no longer connected to ORACLE.COLUMN privilege FORMAT A20
SELECT 'DIRECT' AS how, privilege FROM dba_sys_privs WHERE grantee = 'APP_USER'
UNION ALL
SELECT 'ROLE ' || granted_role, NULL FROM dba_role_privs WHERE grantee = 'APP_USER';
SELECT COUNT(*) AS grants FROM dba_sys_privs WHERE grantee = 'APP_USER';no rows selected
GRANTS
----------
0
1 row selected.no rows selected and GRANTS 0 mean the user has no system privilege and no role at all.
GRANT CREATE SESSION TO app_user;Grant succeeded.Grant only CREATE SESSION for login. Add other privileges (CREATE TABLE etc.) separately as needed.
CONNECT app_user/"App_Pw_2026"@//localhost/FREEPDB1
COLUMN login_user FORMAT A12
SELECT user AS login_user FROM dual;LOGIN_USER
------------
APP_USER
1 row selected.02CREATE SESSION is in a role that is not a default role
app_role has CREATE SESSION and is granted to app_user, but ALTER USER app_user DEFAULT ROLE NONE had been run. Roles that are not default are not enabled at login, so the login failed with ORA-01045.
dba_role_privs showed APP_ROLE with DEFAULT_ROLE = NO. After ALTER USER app_user DEFAULT ROLE ALL, the login worked and session_roles showed APP_ROLE.
Setup
DROP USER IF EXISTS app_user CASCADE;
DROP ROLE IF EXISTS app_role;
CREATE USER app_user IDENTIFIED BY "App_Pw_2026";
CREATE ROLE app_role;
GRANT CREATE SESSION TO app_role;
GRANT app_role TO app_user;
ALTER USER app_user DEFAULT ROLE NONE;User dropped.
Role dropped.
User created.
Role created.
Grant succeeded.
Grant succeeded.
User altered.CONNECT app_user/"App_Pw_2026"@//localhost/FREEPDB1ERROR:
ORA-01045: Login denied. User APP_USER does not have CREATE SESSION privilege.
Help: https://docs.oracle.com/error-help/db/ora-01045/
Warning: You are no longer connected to ORACLE.COLUMN granted_role FORMAT A12
COLUMN privilege FORMAT A16
SELECT p.granted_role, p.default_role, r.privilege FROM dba_role_privs p JOIN role_sys_privs r ON r.role = p.granted_role WHERE p.grantee = 'APP_USER';GRANTED_ROLE DEF PRIVILEGE
------------ --- ----------------
APP_ROLE NO CREATE SESSION
1 row selected.The role holds CREATE SESSION, but the DEF column is NO, so it is off at login.
ALTER USER app_user DEFAULT ROLE ALL;User altered.DEFAULT ROLE ALL turns on every granted role at login. To enable only some, list them: DEFAULT ROLE app_role.
CONNECT app_user/"App_Pw_2026"@//localhost/FREEPDB1
COLUMN login_user FORMAT A12
COLUMN role FORMAT A12
SELECT user AS login_user FROM dual;
SELECT role FROM session_roles;LOGIN_USER
------------
APP_USER
1 row selected.
ROLE
------------
APP_ROLE
1 row selected.FAQ
How do I fix ORA-01045 user lacks CREATE SESSION privilege?
Connect as a DBA and run GRANT CREATE SESSION TO app_user;. If the privilege comes from a role, check that the role is a default role.
I granted a role with CREATE SESSION but still get ORA-01045. Why?
The role may not be a default role. In dba_role_privs check DEFAULT_ROLE; in the lab it was NO, and ALTER USER app_user DEFAULT ROLE ALL fixed it.
What is the difference between ORA-01045 and ORA-01017?
ORA-01017 means the login itself failed (wrong password, user or service). ORA-01045 means the credentials were accepted but the user is not allowed to create a session.
How do I check if a user has CREATE SESSION in Oracle?
Look in dba_sys_privs for direct grants and in dba_role_privs joined with role_sys_privs for grants through roles.
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