Professional Documents
Culture Documents
CCS0014 Lab Exercise 8
CCS0014 Lab Exercise 8
EXERCISE
8
DCL Queries
This study source was downloaded by 100000829421545 from CourseHero.com on 03-31-2022 02:09:53 GMT -05:00
https://www.coursehero.com/file/56756897/CCS0014-Lab-Exercise-8docx/
I. OBJECTIVES
Creating users:
• The database administrator (DBA) creates users with the CREATE USER statement.
After a user is created, the DBA can grant specific system privileges to that user
An application developer, for example, may have the following system privileges:
- CREATE SESSION
- CREATE TABLE
- CREATE SEQUENCE
- CREATE VIEW
- CREATE PROCEDURE
Create a role:
CREATE ROLE manager;
Grant privileges to a role:
This study source was downloaded by 100000829421545 from CourseHero.com on 03-31-2022 02:09:53 GMT -05:00
https://www.coursehero.com/file/56756897/CCS0014-Lab-Exercise-8docx/
Grant a role to users:
GRANT create table, create view
TO manager;
The DBA creates your user account and initializes your password.
You can change your password by using the ALTER USER statement.
You use the REVOKE statement to revoke privileges granted to other users.
Privileges granted to others through the WITH GRANT OPTION clause are also revoked.
INSTRUCTIONS:
Scenario
Team up with other students for this exercise about controlling access to database objects.
Task
This study source was downloaded by 100000829421545 from CourseHero.com on 03-31-2022 02:09:53 GMT -05:00
https://www.coursehero.com/file/56756897/CCS0014-Lab-Exercise-8docx/
Write the appropriate SQL statement for the following queries. The result of the queries
will be checked from your computer.
1. What privilege should a user be given to log on to the Oracle server? Is this a system privilege or
an object privilege?
3. If you create a table, who can pass along privileges to other users on your table?
You can, or anyone you have given those privileges to, by using WITH GRANT OPTION
4. You are the DBA. You are creating many users who require the same system privileges. What
should you use to make your job easier?
Create a role containing the system privileges and grant the role to the users.
6. User1 is the owner of the EMP table and grants the DELETE privilege to User2 by using the
WITH GRANT OPTION clause. User2 then grants the DELETE privilege on EMP to User3.
User1 now finds that User3 has the privilege and revokes it from User2. Which user can now
delete from the EMP table?
Only User21
7. You want to grant SCOTT the privilege to update data in the DEPARTMENTS table. You also
want to enable SCOTT to grant this privilege to other users. What command do you use?
8. Grant another user query privilege on your table. Then, verify whether that user can use the
privilege. Note: For this exercise, team up with another group. For example, if you are user
ora21, team up with another user ora22.
a. Grant another user privilege to view records in your REGIONS table. Include an option
for this user to further grant this privilege to other users.
GRANT select
ON regions
TO WITH GRANT OPTION;
This study source was downloaded by 100000829421545 from CourseHero.com on 03-31-2022 02:09:53 GMT -05:00
https://www.coursehero.com/file/56756897/CCS0014-Lab-Exercise-8docx/
c. Have the user pass on the query privilege to a third user (for example, ora23).
GRANT select
ON <team1_oraxx>.regions
TO <team3_oraxx>;
d. Take back the privilege from the user who performs step b.
REVOKE select
ON regions
FROM <team2_oraxx>;
10. Take back the privileges on the COUNTRIES table granted to another user.
TEAM 1
GRANT select
ON departments
TO <team1_oraxx>;
TEAM 2
GRANT select
ON departments
TO <team2_oraxx>;
This study source was downloaded by 100000829421545 from CourseHero.com on 03-31-2022 02:09:53 GMT -05:00
https://www.coursehero.com/file/56756897/CCS0014-Lab-Exercise-8docx/
13. Add a new row to your DEPARTMENTS table. Team 1 should add Education as department
number 500. Team 2 should add Human Resources as department number 510. Query the other
team’s table.
15. Query all the rows in the other team’s DEPARTMENTS table by using your synonym.
17. Remove the row you inserted into the DEPARTMENTS table in step 13 and save the changes.
This study source was downloaded by 100000829421545 from CourseHero.com on 03-31-2022 02:09:53 GMT -05:00
https://www.coursehero.com/file/56756897/CCS0014-Lab-Exercise-8docx/
IV. ASSESSMENT
Note: The following rubrics/metrics will be used to grade students’ output in the lab
exercise.
This study source was downloaded by 100000829421545 from CourseHero.com on 03-31-2022 02:09:53 GMT -05:00
https://www.coursehero.com/file/56756897/CCS0014-Lab-Exercise-8docx/
Powered by TCPDF (www.tcpdf.org)