SlideShare a Scribd company logo
Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
14
Controlling User Access
14-2 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Objectives
After completing this lesson, you should
be able to do the following:
• Create users
• Create roles to ease setup and
maintenance of the security model
• Use the GRANT and REVOKE
statements to grant and revoke object
privileges
14-3 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Controlling User Access
Database
administrator
Users
Username and password
privileges
14-4 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Privileges
• Database security:
– System security
– Data security
• System privileges: Gain access to the
database
• Object privileges: Manipulate the
content of the database objects
• Schema: Collection of objects, such as
tables, views, and sequences
14-5 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
System Privileges
• More than 80 privileges are available.
• The DBA has high-level system
privileges:
– Create new users
– Remove users
– Remove tables
– Back up tables
14-6 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Creating Users
The DBA creates users by using the
CREATE USER statement.
SQL> CREATE USER scott
2 IDENTIFIED BY tiger;
User created.
CREATE USER user
IDENTIFIED BY password;
14-7 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
User System Privileges
GRANT privilege [, privilege...]
TO user [, user...];
• An application developer may have the
following system privileges:
– CREATE SESSION
– CREATE TABLE
– CREATE SEQUENCE
– CREATE VIEW
– CREATE PROCEDURE
• Once a user is created, the DBA can grant
specific system privileges to a user.
14-8 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Granting System Privileges
The DBA can grant a user specific system
privileges.
SQL> GRANT create table, create sequence, create view
2 TO scott;
Grant succeeded.
14-9 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
What Is a Role?
Allocating privileges
without a role
Allocating privileges
with a role
Privileges
Users
Manager
14-10 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Creating and Granting Privileges
to a Role
SQL> CREATE ROLE manager;
Role created.
SQL> GRANT create table, create view
2 to manager;
Grant succeeded.
SQL> GRANT manager to BLAKE, CLARK;
Grant succeeded.
14-11 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Changing Your Password
• The DBA creates your user account and
initializes your password.
• You can change your password by
using the ALTER USER statement.
SQL> ALTER USER scott
2 IDENTIFIED BY lion;
User altered.
14-12 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Object
Privilege Table View Sequence Procedure
ALTER ‫ض‬ ‫ض‬
DELETE ‫ض‬ ‫ض‬
EXECUTE ‫ض‬
INDEX ‫ض‬
INSERT ‫ض‬ ‫ض‬
REFERENCES ‫ض‬
SELECT ‫ض‬ ‫ض‬ ‫ض‬
UPDATE ‫ض‬ ‫ض‬
Object Privileges
14-13 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Object Privileges
• Object privileges vary from object to object.
• An owner has all the privileges on the object.
• An owner can give specific privileges on that
owner’s object.
GRANT object_priv [(columns)]
ON object
TO {user|role|PUBLIC}
[WITH GRANT OPTION];
14-14 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Granting Object Privileges
SQL> GRANT select
2 ON emp
3 TO sue, rich;
Grant succeeded.
SQL> GRANT update (dname, loc)
2 ON dept
3 TO scott, manager;
Grant succeeded.
• Grant query privileges on the EMP table.
• Grant privileges to update specific
columns to users and roles.
14-15 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Using WITH GRANT OPTION
and PUBLIC Keywords
• Allow all users on the system to query
data from Alice’s DEPT table.
SQL> GRANT select, insert
2 ON dept
3 TO scott
4 WITH GRANT OPTION;
Grant succeeded.
SQL> GRANT select
2 ON alice.dept
3 TO PUBLIC;
Grant succeeded.
• Give a user authority to pass along the
privileges.
14-16 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Confirming Privileges Granted
Data Dictionary Table Description
ROLE_SYS_PRIVS System privileges granted to roles
ROLE_TAB_PRIVS Table privileges granted to roles
USER_ROLE_PRIVS Roles accessible by the user
USER_TAB_PRIVS_MADE Object privileges granted on the
user’s objects
USER_TAB_PRIVS_RECD Object privileges granted to the
user
USER_COL_PRIVS_MADE Object privileges granted on the
columns of the user’s objects
USER_COL_PRIVS_RECD Object privileges granted to the
user on specific columns
14-17 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
How to Revoke Object Privileges
• You use the REVOKE statement to
revoke privileges granted to other
users.
• Privileges granted to others through the
WITH GRANT OPTION will also be
revoked.
REVOKE {privilege [, privilege...]|ALL}
ON object
FROM {user[, user...]|role|PUBLIC}
[CASCADE CONSTRAINTS];
14-18 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Revoking Object Privileges
As user Alice, revoke the SELECT and
INSERT privileges given to user Scott on
the DEPT table.
SQL> REVOKE select, insert
2 ON dept
3 FROM scott;
Revoke succeeded.
14-19 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Summary
Statement Action
CREATE USER Allows the DBA to create a user
GRANT Allows the user to give other users
privileges to access the user’s
objects
CREATE ROLE Allows the DBA to create a collection
of privileges
ALTER USER Allows users to change their
password
REVOKE Removes privileges on an object from
users
14-20 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved.
Practice Overview
• Granting other users privileges to your
table
• Modifying another user’s table through
the privileges granted to you
• Creating a synonym
• Querying the data dictionary views
related to privileges

More Related Content

PPT
Controlling User Access -Data base
PDF
Sql ch 15 - sql security
PPT
Including Constraints -Oracle Data base
PPT
Les11[1]Including Constraints
PPT
Sequences and indexes
PPTX
User, roles and privileges
PPT
Les12[1]Creating Views
PPT
plsql Les08
Controlling User Access -Data base
Sql ch 15 - sql security
Including Constraints -Oracle Data base
Les11[1]Including Constraints
Sequences and indexes
User, roles and privileges
Les12[1]Creating Views
plsql Les08

What's hot (20)

PPT
plsql Les05
PPT
plsql Les09
PPT
Les01[1]Writing Basic SQL Statements
PPT
Creating and Managing Tables -Oracle Data base
PDF
Create user database management security
PDF
Sql grant, revoke, privileges and roles
PPTX
Lab2 ddl commands
PPT
plsql les06
PPT
Les13[1]Other Database Objects
PPT
07 Using Oracle-Supported Package in Application Development
PPT
Producing Readable Output with iSQL*Plus - Oracle Data Base
PPT
Les22[1]Advanced Explicit Cursor Concepts
PPT
Creating Views - oracle database
PPT
Database Objects
DOC
Oracle notes
PPT
Restricting and Sorting Data - Oracle Data Base
PPT
PPT
SQL WORKSHOP::Lecture 13
PPT
Les09[1]Manipulating Data
PPT
plsql Lec11
plsql Les05
plsql Les09
Les01[1]Writing Basic SQL Statements
Creating and Managing Tables -Oracle Data base
Create user database management security
Sql grant, revoke, privileges and roles
Lab2 ddl commands
plsql les06
Les13[1]Other Database Objects
07 Using Oracle-Supported Package in Application Development
Producing Readable Output with iSQL*Plus - Oracle Data Base
Les22[1]Advanced Explicit Cursor Concepts
Creating Views - oracle database
Database Objects
Oracle notes
Restricting and Sorting Data - Oracle Data Base
SQL WORKSHOP::Lecture 13
Les09[1]Manipulating Data
plsql Lec11
Ad

Similar to Les14[1]Controlling User Access (20)

PPT
PPT
PPTX
Oracle Database
PDF
Users66666666666666666666666666666666666666
PPTX
Oracle Database Security For Developers
PPTX
User Information in Oracle introduction.pptx
PPTX
Database administration
PPT
e computer notes - Controlling user access
PDF
Lecture Notes Unit4 Chapter13 users , roles and privileges
PPTX
Database 8.pptxAdvanced Database management system
PPTX
Database administration commands
PDF
Security in ORACLE RDBMS
PPTX
Clase 18 privilegios modificada
PPTX
Clase 18 privilegios modificada
PPT
DBMS Security.ppt
PPTX
Security in Relational model
PPTX
databasemanagementsystemsecuritycyb.pptx
PPT
Less06 users
PPTX
Discretionary access control(database).pptx
Oracle Database
Users66666666666666666666666666666666666666
Oracle Database Security For Developers
User Information in Oracle introduction.pptx
Database administration
e computer notes - Controlling user access
Lecture Notes Unit4 Chapter13 users , roles and privileges
Database 8.pptxAdvanced Database management system
Database administration commands
Security in ORACLE RDBMS
Clase 18 privilegios modificada
Clase 18 privilegios modificada
DBMS Security.ppt
Security in Relational model
databasemanagementsystemsecuritycyb.pptx
Less06 users
Discretionary access control(database).pptx
Ad

More from siavosh kaviani (20)

PDF
sara-shortCV SARA GHIASI TABRIZI Computer Science PhD Application
PDF
Introduction-to-the-Lean-Canvas.pdf
PPTX
Attaque chimique contre les écolières en Iran version 2.pptx
PDF
Short CV BA.pdf
PDF
Faegh Omidi Resume.pdf
PDF
Short CV CTO version 2.pdf
PDF
Short CV Marketing version 2.pdf
PDF
Short CV prof version 2.pdf
PDF
Siavosh Kaviani cv francais 2022 version 2.pdf
PDF
SiavoshKaviani-CV[2021] francais.pdf
PPSX
apex security demo.ppsx
PPT
Les23[1]Handling Exceptions
PPT
Les21[1]Writing Explicit Cursors
PPT
Les20[1]Working with Composite Datatypes
PPT
Les19[1]Writing Control Structures
PPT
Les18[1]Interacting with the Oracle Server
PPT
Les17[1] Writing Executable Statements
PPT
Les16[1]Declaring Variables
PPT
Les15[1]SQL Workshop
PPT
Les10[1]Creating and Managing Tables
sara-shortCV SARA GHIASI TABRIZI Computer Science PhD Application
Introduction-to-the-Lean-Canvas.pdf
Attaque chimique contre les écolières en Iran version 2.pptx
Short CV BA.pdf
Faegh Omidi Resume.pdf
Short CV CTO version 2.pdf
Short CV Marketing version 2.pdf
Short CV prof version 2.pdf
Siavosh Kaviani cv francais 2022 version 2.pdf
SiavoshKaviani-CV[2021] francais.pdf
apex security demo.ppsx
Les23[1]Handling Exceptions
Les21[1]Writing Explicit Cursors
Les20[1]Working with Composite Datatypes
Les19[1]Writing Control Structures
Les18[1]Interacting with the Oracle Server
Les17[1] Writing Executable Statements
Les16[1]Declaring Variables
Les15[1]SQL Workshop
Les10[1]Creating and Managing Tables

Recently uploaded (20)

PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Classroom Observation Tools for Teachers
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Insiders guide to clinical Medicine.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
master seminar digital applications in india
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Basic Mud Logging Guide for educational purpose
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Sports Quiz easy sports quiz sports quiz
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Supply Chain Operations Speaking Notes -ICLT Program
Module 4: Burden of Disease Tutorial Slides S2 2025
Classroom Observation Tools for Teachers
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Insiders guide to clinical Medicine.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Final Presentation General Medicine 03-08-2024.pptx
master seminar digital applications in india
Microbial disease of the cardiovascular and lymphatic systems
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
TR - Agricultural Crops Production NC III.pdf
Complications of Minimal Access Surgery at WLH
2.FourierTransform-ShortQuestionswithAnswers.pdf
Pre independence Education in Inndia.pdf
PPH.pptx obstetrics and gynecology in nursing
Basic Mud Logging Guide for educational purpose
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Sports Quiz easy sports quiz sports quiz

Les14[1]Controlling User Access

  • 1. Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. 14 Controlling User Access
  • 2. 14-2 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Objectives After completing this lesson, you should be able to do the following: • Create users • Create roles to ease setup and maintenance of the security model • Use the GRANT and REVOKE statements to grant and revoke object privileges
  • 3. 14-3 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Controlling User Access Database administrator Users Username and password privileges
  • 4. 14-4 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Privileges • Database security: – System security – Data security • System privileges: Gain access to the database • Object privileges: Manipulate the content of the database objects • Schema: Collection of objects, such as tables, views, and sequences
  • 5. 14-5 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. System Privileges • More than 80 privileges are available. • The DBA has high-level system privileges: – Create new users – Remove users – Remove tables – Back up tables
  • 6. 14-6 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Creating Users The DBA creates users by using the CREATE USER statement. SQL> CREATE USER scott 2 IDENTIFIED BY tiger; User created. CREATE USER user IDENTIFIED BY password;
  • 7. 14-7 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. User System Privileges GRANT privilege [, privilege...] TO user [, user...]; • An application developer may have the following system privileges: – CREATE SESSION – CREATE TABLE – CREATE SEQUENCE – CREATE VIEW – CREATE PROCEDURE • Once a user is created, the DBA can grant specific system privileges to a user.
  • 8. 14-8 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Granting System Privileges The DBA can grant a user specific system privileges. SQL> GRANT create table, create sequence, create view 2 TO scott; Grant succeeded.
  • 9. 14-9 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. What Is a Role? Allocating privileges without a role Allocating privileges with a role Privileges Users Manager
  • 10. 14-10 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Creating and Granting Privileges to a Role SQL> CREATE ROLE manager; Role created. SQL> GRANT create table, create view 2 to manager; Grant succeeded. SQL> GRANT manager to BLAKE, CLARK; Grant succeeded.
  • 11. 14-11 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Changing Your Password • The DBA creates your user account and initializes your password. • You can change your password by using the ALTER USER statement. SQL> ALTER USER scott 2 IDENTIFIED BY lion; User altered.
  • 12. 14-12 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Object Privilege Table View Sequence Procedure ALTER ‫ض‬ ‫ض‬ DELETE ‫ض‬ ‫ض‬ EXECUTE ‫ض‬ INDEX ‫ض‬ INSERT ‫ض‬ ‫ض‬ REFERENCES ‫ض‬ SELECT ‫ض‬ ‫ض‬ ‫ض‬ UPDATE ‫ض‬ ‫ض‬ Object Privileges
  • 13. 14-13 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Object Privileges • Object privileges vary from object to object. • An owner has all the privileges on the object. • An owner can give specific privileges on that owner’s object. GRANT object_priv [(columns)] ON object TO {user|role|PUBLIC} [WITH GRANT OPTION];
  • 14. 14-14 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Granting Object Privileges SQL> GRANT select 2 ON emp 3 TO sue, rich; Grant succeeded. SQL> GRANT update (dname, loc) 2 ON dept 3 TO scott, manager; Grant succeeded. • Grant query privileges on the EMP table. • Grant privileges to update specific columns to users and roles.
  • 15. 14-15 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Using WITH GRANT OPTION and PUBLIC Keywords • Allow all users on the system to query data from Alice’s DEPT table. SQL> GRANT select, insert 2 ON dept 3 TO scott 4 WITH GRANT OPTION; Grant succeeded. SQL> GRANT select 2 ON alice.dept 3 TO PUBLIC; Grant succeeded. • Give a user authority to pass along the privileges.
  • 16. 14-16 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Confirming Privileges Granted Data Dictionary Table Description ROLE_SYS_PRIVS System privileges granted to roles ROLE_TAB_PRIVS Table privileges granted to roles USER_ROLE_PRIVS Roles accessible by the user USER_TAB_PRIVS_MADE Object privileges granted on the user’s objects USER_TAB_PRIVS_RECD Object privileges granted to the user USER_COL_PRIVS_MADE Object privileges granted on the columns of the user’s objects USER_COL_PRIVS_RECD Object privileges granted to the user on specific columns
  • 17. 14-17 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. How to Revoke Object Privileges • You use the REVOKE statement to revoke privileges granted to other users. • Privileges granted to others through the WITH GRANT OPTION will also be revoked. REVOKE {privilege [, privilege...]|ALL} ON object FROM {user[, user...]|role|PUBLIC} [CASCADE CONSTRAINTS];
  • 18. 14-18 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Revoking Object Privileges As user Alice, revoke the SELECT and INSERT privileges given to user Scott on the DEPT table. SQL> REVOKE select, insert 2 ON dept 3 FROM scott; Revoke succeeded.
  • 19. 14-19 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Summary Statement Action CREATE USER Allows the DBA to create a user GRANT Allows the user to give other users privileges to access the user’s objects CREATE ROLE Allows the DBA to create a collection of privileges ALTER USER Allows users to change their password REVOKE Removes privileges on an object from users
  • 20. 14-20 Copyright ‫س‬ Oracle Corporation, 1999. All rights reserved. Practice Overview • Granting other users privileges to your table • Modifying another user’s table through the privileges granted to you • Creating a synonym • Querying the data dictionary views related to privileges