Create a User
Duration: 5 to 10 minutes.
- Log in as a DBA user.
- Create a new user.
- Set the user's default table space to USERS.
- Grant the user RESOURCE and CREATE SESSION privileges.
- Grant the user the ability to select from the HR departments table.
- Grant the user the ability to insert into the HR departments table.
- Grant the user the ability to delete from the HR departments table.
- Connect as the new user.
- Execute the following: SELECT * FROM HR.DEPARTMENTS;
-- Connect as privileged user (system/<password>) and execute
-- the following commands
CREATE USER myusername IDENTIFIED BY mypassword;
GRANT CREATE SESSION, RESOURCE, CREATE SYNONYM, CREATE VIEW
GRANT SELECT ON hr.departments TO myusername;
GRANT INSERT ON hr.departments TO myusername;
GRANT DELETE ON hr.departments TO myusername;
-- Connect as the new user and execute a query to validate
-- that the user has been created and permissions granted
SELECT * FROM hr.departments;