In: Computer Science
Database - Data Control Language
Exercise
Write few system and object privileges.
Create user with your name and grant above discussed system and object privileges to the user created. Revoke update and select from the user which you have created.
System privileges allow users to perform a particular database operation or class of database operations. For example, in order to create a table, the user will require the create table privilege.
Also, the Objects have privileges associated with them, such as insert, update, and delete a table.
Create user with your name and grant system privileges to the user created.
CREATE USER user_name IDENTIFIED BY abcd1234; // abcd1234 is your password and can be anything
GRANT CONNECT, RESOURCE, DBA TO user_name;
GRANT CREATE SESSION GRANT ANY PRIVILEGE TO user_name;
GRANT UNLIMITED TABLESPACE TO user_name;
GRANT
SELECT,
INSERT,
UPDATE,
DELETE
ON
schema.customer
TO
user_name; // customer is your table
REVOKE ALL PRIVILEGES FROM user_name;
Create user with your name and grant object privileges to the user created.
First, create a new user called user_name and grant the
CREATE SESSION
to the user:
CREATE USER user_name IDENTIFIED BY abcd1234; //abcd1234 -> can be any strong string and that will be your password
GRANT CREATE SESSION TO user_name;
Second, grant the SELECT
object privilege on the
ot.customers
table (or any table that you want to
create) to the user_name user:
GRANT SELECT ON customers TO user_name;
REVOKE ALL PRIVILEGES FROM user_name;