Managing User Privileges and Roles – Oracle DBA
A privilege is a permission to execute an action or to access another user’s objects.
The following are a few examples of privileges:
- The right to access the database
- The right to select data from another user’s tables
- The right to execute another user’s stored procedures
- The right to create new users
Types of privileges:
- System privileges
- Object privileges.
System privileges enable the user to perform an action on a type of object, where as object privileges give the user permission to perform the action on a specific object.
There are over 100 distinct system privileges. Each system privilege allows a user to perform a particular database operation or class of database operations.
System privileges can be very powerful, and should be granted only when necessary to roles and trusted users of the database.
System privilege table:
Analyze any table, cluster, or index in the database.
Audit any schema object in the database.
Enable and disable statement and privilege audit options.
Create a cluster in own schema.
|Create any cluster||
Create a cluster in any schema. Behaves similarly to create any table.
|Alter any cluster||
Alter any cluster in the database.
|Drop any cluster||
Drop any cluster in the database.
Alter the database; add files to the operating system via oracle, regardless of operating system privileges.
|Create database link||
Create private database links in own schema.
|Create any index||
Create an index in any schema on any table.
|Alter any index||
Alter any index in the database.
|Drop any index||
Drop any index in the database.
Create callout libraries in own schema.
|Create any library||
Create callout libraries in any schema
Drop callout libraries in own schema.
|Drop any library||
Drop callout libraries in any schema.
|Grant any privilege||
Grant any system privilege (not object privileges).
Create stored procedures, functions, and packages in own schema.
|Create any procedure||
Create stored procedures, functions, and packages in any schema. (requires that user also have alter any table, backup any table, drop any table, select any table, insert any table, update any table, delete any table, or grant any table privilege.)
|Alter any procedure||
Compile any stored procedure, function, or package in any schema.
|Drop any procedure||
Drop any stored procedure, function, or package in any schema.
|Execute any procedure||
Execute any procedure or function (stand-alone or packaged), or reference any public package variable in any schema.
Alter any profile in the database.
Drop any profile in the database.
Set costs for resources used in all user sessions.
|Public database link|
|Create public database link||
Create public database links.
|Drop public database link||
Drop public database links.
|Create public synonym||
Create public synonyms.
|Drop public synonym||
Drop public synonyms.
|Alter any role||
Alter any role in the database.
|Drop any role||
Drop any role in the database.
|Grant any role||
Grant any role in the database.
|Create rollback segment||
Create rollback segments.
|Alter rollback segment||
Alter rollback segments.
|Drop rollback segment||
Drop rollback segments.
Connect to the database.
Issue alter session statements.
Connect when the database has been started using startup restrict. (the osoper and osdba roles contain this privilege.)
Create a sequence in own schema.
|Create any sequence||Create any sequence in any schema.|
|Alter any sequence||Alter any sequence in any schema.|
|Drop any sequence||Drop any sequence in any schema.|
|Select anysequence||Reference any sequence in any schema.|
Create snapshots in own schema. (user must also have the create table privilege.)
Create snapshots in any schema. (user must also have the create any table privilege.)
|Alter snapshot||Alter any snapshot in any schema.|
|Drop any snapshot||Drop any snapshot in any schema.|
|Create synonym||Create a synonym in own schema.|
|Create synonym||Create any synonym in any schema.|
|Drop any synonym||Drop any synonym in any schema.|
|Alter system||Issue alter system statements.|
Create tables in own schema. Also allows grantee to create indexes (including those for integrity constraints) on table in own schema. (the grantee must have a quota for the tablespace or the unlimited tablespace privilege.)
|Create any table||
Create tables in any schema. (if grantee has create any table privilege and creates a table in another user’s schema, the owner must have space quota on that tablespace. The table owner need not have the create [any] table privilege.)
|Alter any table||
Alter any table in any schema and compile any view in any schema.
|Backup any table||
Perform an incremental export using the export utility of tables in any schema.
|Drop any table||Drop or truncate any table in any schema.|
|Lock any table||Lock any table or view in any schema.|
|Comment any table||
Comment on any table, view, or column in schema.
|Select any table||
Query any table, view, or snapshot in any schema.
|Insert any table||
Insert rows into any table or view in any schema.
|Update any table||
Update rows in any table or view in any schema.
|Delete any table||
Delete rows from any table or view in any schema.
Create tablespaces; add files to the operating system via oracle, regardless of the user’s operating system privileges.
Alter tablespaces; add files to the operating system via oracle, regardless of the user’s operating system privileges.
Take any tablespace offline, bring any tablespace online, and begin and end backups of any tablespace.
|Drop tablespace||Drop tablespaces.|
Use an unlimited amount of any tablespace. This privilege overrides any specific quotas assigned. If revoked, the grantee’s schema objects remain but further tablespace allocation is denied unless allowed by specific tablespace quotas. This system privilege can be granted only to users and not to roles. In general, specific tablespace quotas are assigned instead of granting this system privilege.
Force the commit or rollback of own in-doubt distributed transaction in the local database.
|Force any transaction||
Force the commit or rollback of any in-doubt distributed transaction in the local database.
|Create trigger||Create a trigger in own schema.|
|Create any trigger||
Create any trigger in any schema associated with any table in any schema.
|Alter any trigger||
Enable, disable, or compile any trigger in any schema.
|Drop any trigger||Drop any trigger in any schema.|
|Create any user||
Create users; assign quotas on any tablespace, set default and temporary tablespaces, and assign a profile as part of a create user statement.
|Become any user||
Become another user. (required by any user performing a full database import.)
Alter other users: change any user’s password or authentication method, assign tablespace quotas, set default and temporary tablespaces, assign profiles and default roles, in an alter user statement. (not required to alter own password.)
|Drop user||Drop another user.|
|Create view||Create a view in own schema.|
|Create any view||
Create a view in any schema. To create a view in another user’s schema, you must have create any view privileges, and the owner must have the required privileges on the objects referenced in the view.
|Drop any view||Drop any view in any schema.|
Accessing objects in the sys schema:
Users with explicit object privileges or those who connect with administrative privileges (sysdba) can access objects in the sys schema. Another means of allowing access to objects in the sys schema is by granting users any of the following roles:
This role can be granted to users to allow select privileges on data dictionary views.
This role can be granted to users to allow execute privileges for packages and procedures in the data dictionary.
This role can be granted to users to allow them to delete records from the system audit table (aud$).
Additionally, the following system privilege can be granted to users who require access to tables created in the sys schema:
- Select any dictionary
This system privilege allows query access to any object in the sys schema, including tables created in that schema. It must be granted individually to each user requiring the privilege. It is not included in grant all privileges, but it can be granted through a role.
$ Accessing frequently used dictionay objects:
Users with explicit object privileges and the sysdba can access dictionary objects. If, however, you need access to dictionary objects and do not have explicit object privileges, you can be granted the following roles:
Enables users to select all exported catalog views and tables granted to this role. Grant this role to users who must access all exported views and tables in the data dictionary.
Provides execute privilege on exported packages in the dictionary.
Enables users to delete records from the aud$ table.
These roles enable database administrators to access certain objects in the dictionary while maintaining dictionary security.
Each type of object has different privileges associated with it.
|Object privilege||Sql statements permitted|
|Alter||Alter object (table or sequence)|
|Delete||Delete from object (table or view)|
Execute object (procedure or function).references to public package variables
|Index||Create index on object (tables only)|
|Insert||Insert into object (table or view)|
Create or alter table statement defining a foreign key integrity constraint on object (tables only)
Select…from object (table, view, or snapshot). Sql statements using a sequence
|Update||Update object (table or view)|
Object privilege shortcut:
The all and all privileges shortcuts grant or revoke all available object privileges for a object. This shortcut is not a privilege, rather, it is a way of granting or revoking all object privileges with one word in grant and revoke statements. Note that if all object privileges are granted using the all shortcut, individual privileges can still be revoked.
Likewise, all individually granted privileges can be revoked using the all shortcut. However, if you revoke all, and revoking causes integrity constraints to be deleted (because they depend on a references privilege that you are revoking), you must include the cascade constraints option in the revoke statement.