oracle grant resource для чего
Oracle grant resource для чего
Privileges for object types exist at the system level and the schema object level.
7.1.1 System Privileges for Object Types
Oracle database defines the following system privileges for object types:
CREATE TYPE enables you to create object types in your own schema
CREATE ANY TYPE enables you to create object types in any schema
ALTER ANY TYPE enables you to alter object types in any schema
DROP ANY TYPE enables you to drop named types in any schema
EXECUTE ANY TYPE enables you to use and reference named types in any schema
UNDER ANY TYPE enables you to create subtypes under any non-final object types
UNDER ANY VIEW enables you to create subviews under any object view
The following roles are helpful:
The RESOURCE role includes the CREATE TYPE system privilege.
The DBA role includes all of these privileges.
7.1.2 Schema Object Privileges
Two schema object privileges apply to object types:
EXECUTE enables you to use the type to:
Define a column in a relational table.
Declare a variable or parameter of the named type.
EXECUTE lets you invoke the methods of a type, including the constructor.
Method execution and the associated permissions are the same as for stored PL/SQL procedures.
UNDER enables you to create a subtype or subview under the type or view on which the privilege is granted.
Only a grantor with the UNDER privilege WITH GRANT OPTION on the direct supertype or superview can grant the UNDER privilege on a subtype or subview.
The phrase WITH HIERARCHY OPTION grants a specified object privilege on all subtypes of the object. This option is meaningful only with the SELECT object privilege granted on an object view in an object view hierarchy. In this case, the privilege applies to all subviews of the view on which the privilege is granted.
7.1.3 Types Used in New Types or Tables
In addition to the permissions detailed in the previous sections, you need specific privileges to:
Create types or tables that use types created by other users.
Grant use of your new types or tables to other users.
You must have either the EXECUTE ANY TYPE system privilege or the EXECUTE object privilege for any type used to define a new type or table. You must have been granted these privileges explicitly, and not through a role.
7.1.4 Example: Privileges on Object Types
This section presents several related examples, creating users or schemas and then granting privileges on them.
This example requires you to create and use several passwords. If you plan to run the example, make these changes to your SQL code first.
For simplicity, this example does not perform the password management techniques that a deployed system normally uses. In a production environment, follow the Oracle Database password management guidelines, and disable any sample accounts.
See Oracle Database Security Guide for password management guidelines and other security recommendations.
Example 7-1 Creating User Schemas
Example 7-2 requires the input of a password, USER1 performs the CREATE and GRANT Data Definition Language (DDL) statements in the USER1 schema:
Example 7-2 Granting Privileges on Object Types
In Example 7-3, USER2 performs the CREATE DDL statement in the USER2 schema:
Example 7-3 Performing DDL Statements in USER2 Schema
Example 7-4 Performing Grants to USER3
In Example 7-5, USER3 has the necessary privileges to perform the following actions:
Example 7-5 Creating Tables and Types
7.1.5 Access Privileges on Objects, Types, and Tables
Object types only make use of the EXECUTE privilege.
However, object tables use all the same privileges as relational tables:
READ or SELECT lets you access an object and its attributes from the table.
UPDATE lets you modify attributes of objects in the table.
INSERT lets you add new objects to the table.
DELETE lets you delete objects from the table.
Similar table and column privileges regulate the use of table columns of object types.
Consider the schema and queries created below in Example 7-6:
Example 7-6 SELECT Privileges on Type Access
The second query, however, does not involve named types, so the database does not check type privileges.
Additionally, USER3 can perform queries such as these:
Note that in both queries, USER3 does not have explicit privileges on the underlying type. However, the statement succeeds because the type and table owners have the necessary privileges with the GRANT option.
Oracle database checks privileges on the following requests and returns an error if the requestor does not have the privilege for the action:
Pinning an object in the object cache using its REF value causes the database to check the READ or SELECT privilege on the object table containing the object and the EXECUTE privilege on the object type.
Modifying an existing object or flushing an object from the object cache causes the database to check the UPDATE privilege on the destination object table. Flushing a new object causes the database to check the INSERT privilege on the destination object table.
Deleting an object causes the database to check the DELETE privilege on the destination table.
Invoking a method causes the database to check the EXECUTE privilege on the corresponding object type.
Oracle database does not provide column level privileges for object tables.
Oracle Call Interface Programmer’s Guide for tips and techniques for using OCI program effectively with objects
Oracle Security by
Get full access to Oracle Security and 60K+ other titles, with free 10-day trial of O’Reilly.
There’s also live online events, interactive content, certification prep materials, and more.
The RESOURCE Role
The RESOURCE role grants a user the privileges necessary to create procedures, triggers and, in Oracle8, types within the user’s own schema area. Granting a user RESOURCE without CONNECT, while possible, does not allow the user to log in to the database. Therefore, if you really must grant a user RESOURCE, you have to grant CONNECT also — or, at least, CREATE SESSION — so the user can log in.
System Privileges for the RESOURCE Role
The system privileges for the RESOURCE role are shown in Table 5.2.
Table 5-2. RESOURCE Role System Privileges
CREATE TYPE (new in Oracle8)
Problems with the RESOURCE Role
There are several potential problems with the use of the RESOURCE role.
The Oracle-supplied roles can be moving targets
As we mentioned earlier in the section “About the Defaults,” the system privileges of an Oracle-supplied role may change with a new version or upgrade release. For example, the privileges listed in Table 5.2 are from an Oracle8 RESOURCE role. Note that in an Oracle7 database, the CREATE TYPE privilege does not exist. There is another problem that has as much or more impact on your database security, which we examine next.
UNLIMITED TABLESPACE access
Get Oracle Security now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.
Oracle grant resource для чего
Use the GRANT statement to grant:
System privileges to users and roles. Table 18-1 lists the system privileges (organized by the database object operated upon).
Object privileges for a particular object to users and roles. Table 18-2 lists the object privileges (organized by the database object operated upon).
Global roles (created with IDENTIFIED GLOBALLY ) are granted through enterprise roles and cannot be granted using the GRANT statement.
Notes on Authorizing Database Users
You can authorize database users through means other than the database and the GRANT statement.
Many Oracle Database privileges are granted through supplied PL/SQL and Java packages. For information on those privileges, refer to the documentation for the appropriate package.
Note on Oracle Automatic Storage Management
Note on Editionable Objects
A GRANT operation to grant object privileges on an editionable object actualizes the object in the current edition. See Oracle Database Development Guide for more information about editions and editionable objects.
CREATE USER and CREATE ROLE for definitions of local, global, and external privileges
Oracle Database Security Guide for information about other authorization methods and for information about privileges
REVOKE for information on revoking grants
You must have been granted the GRANT ANY PRIVILEGE system privilege. In this case, if you grant the system privilege to a role, then a user to whom the role has been granted does not have the privilege unless the role is enabled in user’s session.
GRANT
Use the GRANT statement to grant:
System privileges to users and roles.
Roles to users and roles. Both privileges and roles are either local, global, or external. Table 18-1 lists the system privileges (organized by the database object operated upon). Table 18-2 lists Oracle Database predefined roles.
Notes on Authorizing Database Users You can authorize database users through means other than the database and the GRANT statement.
Many Oracle Database privileges are granted through supplied PL/SQL and Java packages. For information on those privileges, please refer to the documentation for the appropriate package.
CREATE USER and CREATE ROLE for definitions of local, global, and external privileges
Oracle Database Security Guide for information about other authorization methods and for information about privileges
REVOKE for information on revoking grants
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.
Description of the illustration grant.gif
Description of the illustration grant_system_privileges.gif
Description of the illustration grant_object_privileges.gif
Description of the illustration on_object_clause.gif
Description of the illustration grantee_clause.gif
Use these clauses to grant system privileges.
Specify the system privilege you want to grant. Table 18-1 lists the system privileges, organized by the database object operated upon.
Oracle Database provides the ALL PRIVILEGES shortcut for granting all the system privileges listed in Table 18-1, except the SELECT ANY DICTIONARY privilege.
Specify the role you want to grant. You can grant an Oracle Database predefined role or a user-defined role. Table 18-2 lists the predefined roles.
«Granting a Role to a Role: Example» and CREATE ROLE for information on creating a user-defined role
IDENTIFIED BY Clause
CREATE USER for restrictions on usernames and passwords
Specify WITH ADMIN OPTION to enable the grantee to:
Grant the role to another user or role, unless the role is a GLOBAL role
Revoke the role from another user or role
Alter the role to change the authorization needed to access it
TO grantee_clause identifies users or roles to which the system privilege, role, or object privilege is granted.
Restriction on Grantees A user, role, or PUBLIC cannot appear more than once in TO grantee_clause.
PUBLIC Specify PUBLIC to grant the privileges to all users.
Restrictions on Granting System Privileges and Roles Privileges and roles are subject to the following restrictions:
A privilege or role cannot appear more than once in the list of privileges and roles to be granted.
You cannot grant a role to itself.
You cannot grant a role IDENTIFIED GLOBALLY to anything.
You cannot grant a role IDENTIFIED EXTERNALLY to a global user or global role.
Use these clauses to grant object privileges.
Specify the object privilege you want to grant. You can specify any of the values shown in Table 18-3. See also Table 18-4.
Restriction on Object Privileges A privilege cannot appear more than once in the list of privileges to be granted.
The on_object_clause identifies the object on which the privileges are granted. Directory schema objects and Java source and resource schema objects are identified separately because they reside in separate namespaces.
«Revoke Operations that Use GRANT ANY OBJECT PRIVILEGE: Example» for more information on using the GRANT ANY OBJECT PRIVILEGE system privilege for revoke operations
Specify WITH GRANT OPTION to enable the grantee to grant the object privileges to other users and roles.
WITH HIERARCHY OPTION
This clause is meaningful only in combination with the SELECT object privilege.
Table, view, or materialized view
Procedure, function, or package
Synonym for any of the preceding items
Directory, library, operator, or indextype
Java source, class, or resource
You cannot grant privileges directly to a single partition of a partitioned table.
DIRECTORY directory_name Specify a directory schema object on which privileges are to be granted. You cannot qualify directory_name with a schema name.
JAVA SOURCE | RESOURCE The JAVA clause lets you specify a Java source or resource schema object on which privileges are to be granted.
Listings of System and Object Privileges
Table 18-1 System Privileges
System Privilege Name | Operations Authorized | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Predefined Role | Purpose | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Object Privilege | Table | View | Sequence | Procedure, Function, Package (Note 1) | Material-ized View | Directory | Library | User- defined Type | Operator | Indextype |
---|---|---|---|---|---|---|---|---|---|---|
Object Privilege | Operations Authorized |
---|---|