Oracle User Privileges and ALTER USER
Commands
1. GRANT vs ALTER USER
Use GRANT to give system privileges, object privileges, or roles to a user or role.
Use ALTER USER to modify user-specific settings such as quotas, passwords, tablespaces,
and account status.
2. System Privileges
System privileges allow users to perform administrative actions across the database.
• CREATE SESSION
CREATE TABLE
CREATE VIEW
CREATE PROCEDURE
CREATE SEQUENCE
CREATE TRIGGER
CREATE USER
ALTER USER
DROP USER
GRANT ANY PRIVILEGE
GRANT ANY ROLE
SELECT ANY TABLE
INSERT ANY TABLE
UPDATE ANY TABLE
DELETE ANY TABLE
DROP ANY TABLE
ALTER ANY TABLE
CREATE ANY TABLE
EXECUTE ANY PROCEDURE
CREATE ROLE
DROP ANY ROLE
CREATE PUBLIC SYNONYM
3. Object Privileges
Object privileges are granted on specific database objects like tables, views, or procedures.
• SELECT
INSERT
UPDATE
DELETE
REFERENCES
EXECUTE
INDEX
ALTER
UNDER
4. Predefined Roles
Roles are collections of privileges that can be granted to users.
• CONNECT
RESOURCE
DBA
EXP_FULL_DATABASE
IMP_FULL_DATABASE
SELECT_CATALOG_ROLE
DELETE_CATALOG_ROLE
EXECUTE_CATALOG_ROLE
5. ALTER USER Capabilities
ALTER USER is used to modify user properties.
• Change password: ALTER USER demo IDENTIFIED BY newpass;
Set default tablespace: ALTER USER demo DEFAULT TABLESPACE users;
Set temporary tablespace: ALTER USER demo TEMPORARY TABLESPACE temp;
Assign tablespace quota: ALTER USER demo QUOTA 100M ON users;
Unlimited quota: ALTER USER demo QUOTA UNLIMITED ON users;
Lock account: ALTER USER demo ACCOUNT LOCK;
Unlock account: ALTER USER demo ACCOUNT UNLOCK;
Expire password: ALTER USER demo PASSWORD EXPIRE;
Assign a profile: ALTER USER demo PROFILE my_profile;
Enable CDB access: ALTER USER demo CONTAINER=ALL; (for multitenant/CDB)
Rename user (Oracle 23c+): ALTER USER demo RENAME TO demo_new;