Manage users in Oracle by creating, altering, dropping accounts, and assigning roles/privileges for secure database access.
User management covers creating, modifying, and deleting database accounts and controlling their access through roles and system/object privileges.
Use CREATE USER
followed by GRANT
to assign login and usage rights.
CREATE USER ecommerce_read IDENTIFIED BY strongPwd1;
GRANT CREATE SESSION TO ecommerce_read;
GRANT SELECT ON Orders TO ecommerce_read;
Change passwords, default tablespaces, and quotas with ALTER USER
.
ALTER USER ecommerce_read IDENTIFIED BY strongerPwd2;
ALTER USER ecommerce_read DEFAULT TABLESPACE users;
Remove accounts with DROP USER
. Add CASCADE
to delete owned objects.
DROP USER ecommerce_read CASCADE;
Bundle permissions into roles, then grant them to users for easier administration.
CREATE ROLE order_manager;
GRANT SELECT, INSERT, UPDATE ON Orders TO order_manager;
GRANT order_manager TO john_doe;
Create least-privilege roles, enforce strong passwords, audit changes, and schedule periodic reviews.
Yes. Use ALTER USER username PASSWORD EXPIRE;
. The user must supply a new password during the next connection.
Execute ALTER USER username ACCOUNT LOCK;
. Unlock with ACCOUNT UNLOCK
when needed.
Grant CREATE TABLE
system privilege or assign a prebuilt role like RESOURCE
.