← Users & Privileges
Oracle · Users & Privileges

How to create a user in Oracle

Create an Oracle user with a default tablespace, quota, and CREATE SESSION, following least privilege.

Tested on11g12c19c21c23ai26ai

Create an account with a default tablespace, a quota, and the minimum privilege to connect.

This creates an account and grants access. Review the tablespaces and grants, and grant only what the account needs.

CREATE USER &&username IDENTIFIED BY "Replace_This_Passw0rd#"
  DEFAULT TABLESPACE users
  TEMPORARY TABLESPACE temp
  QUOTA UNLIMITED ON users;

GRANT CREATE SESSION TO &username;
-- Grant the rest through a role where possible:
-- GRANT <app_role> TO &username;

-- Verify (read-only)
SELECT username, account_status, default_tablespace, temporary_tablespace, created
FROM   dba_users
WHERE  username = UPPER('&username');
create-userprovisioning