Controlling User Access
Database
administrator
Username and password
Privileges
Users
Privileges
• Database security:
– System security
– Data security
• System privileges: Gaining access to the database
• Object privileges: Manipulating the content of the
database objects
• Schemas: Collections of objects, such as tables,
views, and sequences
System Privileges
• More than 100 privileges are available.
• The database administrator has high-level system
privileges for tasks such as:
– Creating new users
– Removing users
– Removing tables
– Backing up tables
Creating Users
The DBA creates users by using the CREATE USER
statement.
CREATE USER user
IDENTIFIED BY password;
CREATE USER scott
IDENTIFIED BY tiger;
User created.
User System Privileges
• Once a user is created, the DBA can grant specific
system privileges to a user.
GRANT privilege [, privilege...]
TO user [, user| role, PUBLIC...];
• An application developer, for example, may have
the following system privileges:
– CREATE SESSION
– CREATE TABLE
– CREATE SEQUENCE
– CREATE VIEW
– CREATE PROCEDURE
Granting System Privileges
The DBA can grant a user specific system privileges.
GRANT create session, create table,
create sequence, create view
TO scott;
Grant succeeded.
What is a Role?
Users
Manager
Privileges
Allocating privileges Allocating privileges
without a role with a role
Creating and Granting Privileges to a Role
• Create a role
CREATE ROLE manager;
Role created.
• Grant privileges to a role
GRANT create table, create view
TO manager;
Grant succeeded.
• Grant a role to users
GRANT manager TO DEHAAN, KOCHHAR;
Grant succeeded.