Permissions

There is a need for an access control mechanism implemented in a multi-user environment. You have to be able to control who can access what. Thus Oracle implemented privileges to control the access and roles to encapsulate privileges.

Granting direct access to several users will become a bit clumsy after a while not to mention keeping them aligned. Thus Oracle introduced roles. With roles you can easily manage all privileges – by naming the set of privileges, keeping them organized, …

There are three main categories of privileges:

  • System privileges
  • Object privileges
  • the “Public” role

System privileges

System privileges allow a user to perform an action on objects or sets of objects. Only the user with ADMIN option (or instance admin) can grant this privilege! There 47 system privileges to be used – see the table below for more details.

PrivilegeDescription
ADMINAllows user to do any admin's tasks (bakcups, migration, user creation / deletion, ...)
ALTER / CREATE / DROP / FLUSH / LOAD / REFRESH / UNLOAD ANY CACHE GROUPAllows user to ALTER / CREATE / DROP / FLUSH / LOAD / REFRESH / UNLOAD any cache group
ALTER / CREATE / DROP ANY INDEXAllows a user to ALTER / CREATE / DROP any index
ALTER / CREATE / DROP ANY MATERIALIZED VIEWAllows a user to ALTER / CREATE / DROP any materialized view
ALTER / CREATE / DROP / EXECUTE ANY PROCEDUREAllows a user to ALTER / CREATE / DROP / EXECUTE any procedure, function or package
ALTER / CREATE / DROP / SELECT ANY SEQUENCEAllows a user to ALTER / CREATE / DROP / SELECT any sequence
ALTER / CREATE / DELETE / DROP / INSERT / SELECT / UPDATE ANY TABLEAllows a user to ALTER / CREATE / DELETE / DROP / INSERT / SELECT / UPDATE any table
ALTER / CREATE / DROP ANY VIEWAllows a user to ALTER / CREATE / DROP any view
CACHE_MANAGERAllows a user to do any operation with cache groups
CREATE / DROP PUBLIC SYNONYMAllows a user to CREATE / DROP a public synonym only
CREATE SESSIONAllow a user to connect to a database
CREATE / DROP ANY SYNONYMAllows a user to CREATE / DROP any synonym
XLAAllows a user to connect as an XLA reader

Object privileges

Object privileges allow a user to perform a particular action to a specific object or define access to a particular object. In Oracle, there is always an “object owner” which has the full right (all privileges) to an object created by him. The object owner can grant any privilege to another user (except few that are restricted to owners only; i.e. TRUNCATE). A user with ADMIN option can do the same.

PrivilegeDescription
DELETEApplies to:
- tables

Allows to delete data from a table
EXECUTEApplies to:
- package, procedure, function

Allows to execute a package, procedure or function
FLUSHApplies to:
- cache group

Allows to flush a cache group
INDEXApplies to:
- tables
- views

Allows to create an index on a view or table
INSERTApplies to:
- tables
- synonyms

Allows to insert data into a table or synonym
LOADApplies to:
- cache group

Allows to load a cache group
REFERENCESApplies to:
- tables
- materialized views

Allows to create a foreign key on a table or materialized view. It implicitly grants SELECT to a parent table!
REFRESHApplies to:
- cache group

Allows to refresh a cache group
SELECTApplies to:
- tables
- sequence
- view
- materialized view
- synonym

Allows to select data from a table, sequence, view, materialized view or synonym
UNLOADApplies to:
- cache group

Allows to unload a cache group
UPDATEApplies to:
- tables

Allows to update data in a table

PUBLIC

All users have by default PUBLIC role which allows them to access publicly available objects. This is very handy if you want to grant a privilegeĀ or role to everyone, you do not need to list down all users or roles and grant it to all of them you can grant it to PUBLIC and that’s it šŸ™‚