Oracle8i SQL Reference Release 3 (8.1.7) Part Number A85397-01 |
|
SQL Statements:
DROP SEQUENCE to UPDATE, 13 of 27
Use the GRANT
statement to grant:
PUBLIC
. Table 11-3 summarizes the object privileges that you can grant on each type of object. Table 11-4 lists object privileges and the operations that they authorize. You can grant any of these system privileges with the GRANT
statement.
See Also:
To grant a system privilege, you must either have been granted the system privilege with the ADMIN
OPTION
or have been granted the GRANT
ANY
PRIVILEGE
system privilege.
To grant a role, you must either have been granted the role with the ADMIN
OPTION
or have been granted the GRANT
ANY
ROLE
system privilege, or you must have created the role.
To grant an object privilege, you must own the object or the owner of the object must have granted you the object privileges with the GRANT
OPTION
. This rule applies to users with the DBA
role.
grant_system_privileges_and_roles_clause::=
grant_object_privileges_clause::=
grant_system_privileges_and_roles_clause
|
Specify the system privilege you want to grant. Table 11-1 lists the system privileges (organized by the database object operated upon). |
|
|
||
|
||
|
||
|
Oracle provides a shortcut for specifying all system privileges at once: |
|
|
|
|
role |
Specify the role you want to grant. You can grant an Oracle predefined role or a user-defined role. Table 11-2 lists the predefined roles. |
|
|
||
|
||
|
|
|
|
Specify |
|
|
If you grant a system privilege or role to a user without specifying |
|
|
To revoke the admin option on a system privilege or role from a user, you must revoke the privilege or role from the user altogether and then grant the privilege or role to the user without the admin option. |
|
|
Restriction: A user, role, or |
|
|
|
Specify |
Restrictions on granting system privileges and roles:
|
grant_object_privileges_clause
|
Specify the object privilege you want to grant. You can substitute any of the values shown in Table 11-3. See also Table 11-4. Restriction: A privilege cannot appear more than once in the list of privileges to be granted. |
|
|
Specify |
|
|
Specify the table or view column on which privileges are to be granted. You can specify columns only when granting the
For information on existing column object grants, query the
|
|
|
Specify
Restriction: You can specify |
|
|
|
|
|
|
Specify the schema object on which the privileges are to be granted. If you do not qualify |
|
||
|
|
|
|
|
Specify a directory schema object on which privileges are to be granted. You cannot qualify
|
|
|
The
|
Predefined Role | Purpose |
---|---|
|
These roles are provided for compatibility with previous versions of Oracle. You can determine the privileges encompassed by these roles by querying the See Also: Oracle8i Reference for a description of this view |
|
Note: Oracle Corporation recommends that you design your own roles for database security rather than relying on these roles. These roles may not be created automatically by future versions of Oracle. |
|
These roles are provided for accessing data dictionary views and packages. See Also: Oracle8i Administrator's Guide for more information on these roles |
|
These roles are provided for convenience in using the Import and Export utilities. See Also: Oracle8i Utilities for more information on these roles |
|
You need these roles to use Oracle's Advanced Queuing functionality. See Also: Oracle8i Application Developer's Guide - Advanced Queuing for more information on these roles |
|
This role is used by Enterprise Manager/Intelligent Agent. |
|
You need this role to create a user who owns a recovery catalog. See Also: Oracle8i Backup and Recovery Guide for more information on recovery catalogs |
|
A DBA using Oracle's heterogeneous services feature needs this role to access appropriate tables in the data dictionary and to manipulate them with the See Also: Oracle8i Distributed Database Systems and Oracle8i Supplied PL/SQL Packages Reference for more information |
Oracle also creates other roles that authorize you to administer the database. On many operating systems, these roles are called |
To grant the CREATE
SESSION
system privilege to richard
, allowing richard
to log on to Oracle, issue the following statement:
GRANT CREATE SESSIONTO richard;
To grant the CREATE
TABLE
system privilege to the role travel_agent
, issue the following statement:
GRANT CREATE TABLETO travel_agent;
travel_agent
's privilege domain now contains the CREATE
TABLE
system privilege.
The following statement grants the travel_agent
role to the EXECUTIVE
role:
GRANT travel_agentTO executive;
travel_agent
is now granted to executive
. executive
's privilege domain contains the CREATE
TABLE
system privilege.
To grant the executive
role with the ADMIN
OPTION
to THOMAS
, issue the following statement:
GRANT executiveTO thomas WITH ADMIN OPTION;
thomas
can now perform the following operations with the executive
role:
CREATE
TABLE
system privilege
To grant READ
on directory bfile_dir1
to user scott
, with the GRANT
OPTION
, issue the following statement:
GRANT READ ON DIRECTORY bfile_dir1 TO scottWITH GRANT OPTION;
To grant all privileges on the table bonus
to the user jones
with the GRANT
OPTION
, issue the following statement:
GRANT ALL ON bonus TO jonesWITH GRANT OPTION;
jones
can subsequently perform the following operations:
bonus
table
bonus
table to another user or role
To grant SELECT
and UPDATE
privileges on the view golf_handicap
to all users, issue the following statement:
GRANT SELECT, UPDATEON golf_handicap TO PUBLIC;
All users can subsequently query and update the view of golf handicaps.
To grant SELECT
privilege on the eseq
sequence in the schema elly
to the user blake
, issue the following statement:
GRANT SELECTON elly.eseq TO blake;
blake
can subsequently generate the next value of the sequence with the following statement:
SELECT elly.eseq.NEXTVALFROM DUAL;
To grant blake
the REFERENCES
privilege on the empno
column and the UPDATE
privilege on the empno
, sal
, and comm
columns of the emp
table in the schema scott
, issue the following statement:
GRANT REFERENCES (empno), UPDATE (empno, sal, comm)ON scott.emp TO blake;
blake
can subsequently update values of the empno
, sal
, and comm
columns. blake
can also define referential integrity constraints that refer to the empno
column. However, because the GRANT
statement lists only these columns, blake
cannot perform operations on any of the other columns of the emp
table.
For example, blake
can create a table with a constraint:
CREATE TABLE dependent(dependno NUMBER, dependname VARCHAR2(10), employee NUMBER CONSTRAINT in_emp REFERENCES scott.emp(empno) );
The constraint in_emp
ensures that all dependents in the dependent
table correspond to an employee in the emp
table in the schema scott
.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|