Create a user in Oracle
1. Open sql plus.
2. Syntax:
CREATE USER <username> IDENTIFIED BY <password>
Ex:
create user orcl identified by oracle;
Note: Right now you can access oracle with your account. To access, you need permissions granted by DBA.
3. Granting permissions for a user.
Syntax:
GRANT <connect/ resources/dba> TO <username>
Ex:
GRANT connect TO JOHN;
n User john can now connect to Oracle, but he can’t access any Oracle Objects.
GRANT resources TO JOHN;
n User john can now access tables, views, clusters etc. But he can’t create new users.
GRANT DBA TO JOHN;
n User john now became a DBA.
1. Revoking Permissions from the user.
Syntax: REVOKE <connect/ resources/dba> FROM <username>
Ex:
REVOKE DBA from JOHN;
n User john cannot create user, other advanced sql objects
REVOKE resources TO JOHN;
n User john can’t tables, views, clusters etc. But he can connect to Oracle.
REVOKE connect TO JOHN;
n User john can’t connect to Oracle. Dropping this user is Recommended.
Dropping an account in Oracle:
1. Login as DBA
2. Syntax:
DROP USER <username> [CASCADE]
Note:
CASCADE is used when there are any tables, views created by user.
CASCADE deletes the respective sql objects associated with the user.
3. Ex:
DROP USER JOHN;