Oracle Roles (转载)

Oracle Roles
Version 10.2
 
General
Data Dictionary Objects Related to Roles
defrole$ user$
dba_rolessession_roles
dba_role_privsuser_application_roles
role_role_privsuser_role_privs
role_sys_privsv$pwfile_users
role_tab_privs 
System Privileges Related To Roles
alter any role create role drop any role grant any role

Installation roles
Role NameDescription
AQ_ADMINISTRATOR_ROLEPrivilege to administer Advanced Queuing 
AQ_USER_ROLEDeprecated
AUTHENTICATEDUSERDBUriServlet Security
CONNECTContains the create session privilege (only)
CSW_USR_ROLENot documented
CTXAPPEnables developers create Oracle Text indexes and index preferences, and to use PL/SQL packages.
CWM_USERUndocumented
DATAPUMP_EXP_FULL_DATABASEUndocumented
DATAPUMP_IMP_FULL_DATABASEUndocumented
DBAExample Database Administrator role. Should not be used
DELETE_CATALOG_ROLEAllow users to delete records from the system audit table (AUD$)
DMUSER_ROLEUndocumented
DM_CATALOG_ROLEUndocumented
EJBCLIENTUndocumented
EXECUTE_CATALOG_ROLEAllow users EXECUTE privileges for packages and procedures in the data dictionary

EXP_FULL_DATABASE
Providesthe privileges required to perform full and incremental databaseexports, and includes: SELECT ANY TABLE, BACKUP ANY TABLE, EXECUTE ANYPROCEDURE, EXECUTE ANY TYPE, ADMINISTER RESOURCE MANAGER, and INSERT,DELETE, and UPDATE on the tables SYS.INCVID, SYS.INCFIL, andSYS.INCEXP. Also the following roles: EXECUTE_CATALOG_ROLE andSELECT_CATALOG_ROLE.
GATHER_SYSTEM_STATISTICSTo update the dictionary system statistics a user must have DBA privileges or the GATHER_SYSTEM_STATISTICS role.
GLOBAL_AQ_USER_ROLERequiredto register through LDAP using JDBC connection parameters as thisrequires the ability to write access to the connection factory entriesin the LDAP server (which requires the LDAP user to be either thedatabase itself or be granted GLOBAL_AQ_USER_ROLE).

HS_ADMIN_ROLE
Providesprivileges for DBAs who need to use the DBA role using Oracle DatabaseHeterogeneous Services to access appropriate tables in the datadictionary.

Used to protect access to theHeterogeneous Services (HS) data dictionary tables (grants SELECT) andpackages (grants EXECUTE). It is granted to SELECT_CATALOG_ROLE andEXECUTE_CATALOG_ROLE such that users with generic data dictionaryaccess also can access the HS data dictionary.

IMP_FULL_DATABASE
Providesthe privileges required to perform full database imports. Includes anextensive list of system privileges (use view DBA_SYS_PRIVS to viewprivileges) and the following roles: EXECUTE_CATALOG_ROLE andSELECT_CATALOG_ROLE.

This role is provided for convenience in using the export and import utilities.
JAVADEBUGPRIVGrants permissions to run the Java debugger
JAVAIDPRIVUndocumented
JAVASYSPRIVGrants permissions for Java administrators including updating JVM-protected packages
JAVAUSERPRIVGrants permissions for Java users such as examining properties
JAVA_ADMINJava administration privileges including permission to modify PolicyTable.
JAVA_DEPLOYUndocumented
JMXSERVERProvidespermissions to start and maintain a JMX agent in a session. Theprocedure dbms_java.start_jmx_agent starts the agent in a specificsession that generally remains active for the duration of the session.
LOGSTDBY_ADMINISTRATORA prototype role created by default with RESOURCE, and EXECUTE on DBMS_LOGSTDBY privileges.

It is advisable to not use this role but rather to craft your own specific to your needs. Read Oracle's comments, in red with respect to RESOURCE. They apply here too.
MGMT_USERUndocumented
OEM_ADVISORRequired to run the Segment Advisor manually with Enterprise Manager.
OEM_MONITORUndocumented
OLAPI_TRACE_USERUndocumented
OLAP_DBATo create dimensional objects in any schema
OLAP_USERCreate dimensional objects
OLAP_XS_ADMINAdminister OLAP data security
ORDADMINAfterinstalling Oracle Multimedia DICOM, the ORDADMIN role is created, withthe database system privileges required for administration of the DICOMdata model repository.

The ORDADMIN role must be assigned to the administrator of the DICOM data model repository.
OWB$CLIENTPrivileges granted to PUBLIC are available to all sessions.
OWB_DESIGNCENTER_VIEWUndocumented
OWB_USERWith Oracle Warehouse builder enables a remote Oracle WorkFlow instance to connect to the services provided by the Control Center.
PLUSTRACETraditionally required to use AUTOTRACE but in 11gR1 it seems to function without this role being required.
PUBLIC-

RECOVERY_CATALOG_OWNER
Providesprivileges for owner of the recovery catalog. Includes: CREATE SESSION,ALTER SESSION, CREATE SYNONYM, CREATE VIEW, CREATE DATABASE LINK,CREATE TABLE, CREATE CLUSTER, CREATE SEQUENCE, CREATE TRIGGER, andCREATE PROCEDURE

RESOURCE
Providesthe following system privileges: CREATE CLUSTER, CREATE INDEXTYPE,CREATE OPERATOR, CREATE PROCEDURE, CREATE SEQUENCE, CREATE TABLE,CREATE TRIGGER, CREATE TYPE.

This role isprovided for compatibility with previous releases of Oracle Database.You can determine the privileges encompassed by this role by queryingthe DBA_SYS_PRIVS data dictionary view.

Note: Oracle recommends that you design your own roles for database security rather than relying on this role. This role may not be created automatically by future releases of Oracle Database.
SCHEDULER_ADMINAllowsthe grantee to execute the procedures of the DBMS_SCHEDULER package. Itincludes all of the job scheduler system privileges and is included inthe DBA role.
SELECT_CATALOG_ROLEProvides SELECT privilege on objects in the data dictionary. Also provides the HS_ADMIN_ROLE privilege.
SPATIAL_CSW_ADMINPrivilegesgranted the Catalog Services for the Web (CSW) account used by theOracle Spatial CSW cache manager to load all record type metadata, andrecord instances from the database into the main memory for the recordtypes that are cached.
SPATIAL_WFS_ADMINPrivilegesgranted the Web Feature Service (WFS) account used by the OracleSpatial WFS cache manager to load all feature type metadata, andfeature instances from the database into main memory for the featuretypes that are cached.
WFS_USR_ROLEPrivileges granted a Web Feature Service (WFS) user
WKUSERPrivileges that must be granted to database users hosting new  Oracle Ultra Search instances.
WM_ADMIN_ROLEContainsall Workspace Manager privileges with the grant option. By default, thedatabase administrator (DBA role) is granted the WM_ADMIN_ROLE role.
XDBADMINAllowsthe grantee to register an XML schema globally, as opposed toregistering it for use or access only by its owner. It also lets thegrantee bypass access control list (ACL) checks when accessing OracleXML DB Repository.
XDB_SET_INVOKERAllowsthe grantee to define invoker's rights handlers and to create or updatethe resource configuration for XML repository triggers. By default,Oracle Database grants this role to the DBA role but not to theXDBADMIN role.
XDB_WEBSERVICESAllowsthe grantee to access Oracle Database Web services over HTTPS. However,it does not provide the user access to objects in the database that arepublic. To allow public access, you need to grant the user theXDB_WEBSERVICES_WITH_PUBLIC role. For a user to use these Web services,SYS must enable the Web service servlets.
XDB_WEBSERVICES_OVER_HTTPAllowsthe grantee to access Oracle Database Web services over HTTP. However,it does not provide the user access to objects in the database that arepublic. To allow public access, you need to grant the user theXDB_WEBSERVICES_WITH_PUBLIC role.
XDB_WEBSERVICES_WITH_PUBLICAllows the grantee access to public objects through Oracle Database Web services.
Roles are treated like users in the data dictionarySELECT name USER_NAMES
FROM user$
WHERE type# = 1;

SELECT name ROLE_NAMES
FROM user$
WHERE type# = 0;
Controlling The Number Of Roles With An init.ora Parametermax_enabled_roles = <integer>
max_enabled_roles = 100
NOTE:
  • Roles can contain system privileges
  • Roles can contain object privileges
  • Roles can contain roles
  • Object privileges granted through roles do not work within procedures, functions, and packages. Those permissions must be granted explicitly to the user.
 
Creating Roles
Create RoleCREATE ROLE <role_name>;
CREATE ROLE read_only;
Create Password Protected RoleCREATE ROLE <role_name> IDENTIFIED BY <password>;
CREATE ROLE dba IDENTIFIED BY "S0^Sorry";
 
Assigning Privileges And Roles To Roles
Assign Privilege To A RoleGRANT <privilege_name> TO <role_name>;
GRANT create session TO read_only
Create A Role HeirarchyGRANT <role_name> TO <role_name>;
CREATE ROLE ap_clerk;

GRANT read_only TO ap_clerk;
GRANT select ON general_ledger TO ap_clerk;
GRANT insert ON ap_master TO ap_clerk;
GRANT update ON ap_master TO ap_clerk;
GRANT insert ON ap_detail TO ap_clerk;
GRANT update ON ap_detail TO ap_clerk;
Add Another Layer To The HeirarchyGRANT <roles and privileges> TO <role_name>;
CREATE ROLE ap_manager IDENTIFIED BY appwd;

GRANT ap_clerk TO ap_manager;
GRANT delete ON ap_master TO ap_manager;
GRANT delete ON ap_detail TO ap_manager;
GRANT select any table TO ap_manager;
 
Assigning Roles
Assigning Roles To UsersGRANT <roles_name> TO <user_name>;
GRANT read_only TO jcline;

GRANT ap_clerk TO jstough;
GRANT ap_clerk TO ckeizer;
GRANT ap_clerk TO rallen;

GRANT ap_manager TO escott;
 
Revoking Privileges From Roles
Revoke PrivilegeREVOKE <privilege_name> FROM <role_name>;
REVOKE select any table FROM ap_manager;
 
Revoking Roles
Revoke a role from a userREVOKE <role_name> FROM <user_name>;
REVOKE ap_manager FROM escott;
Revoke A Role And Drop Any Invalidated ConstraintsREVOKE ALL ON <table_name>
FROM <schema_name>
CASCADE CONSTRAINTS;
REVOKE ALL ON invoices
FROM abc
CASCADE CONSTRAINTS;
 
Activating & Decactivating Roles
Activating A RoleSET ROLE <role_name>;
SET ROLE ap_clerk;
Activating A Password Protected RoleSET ROLE <role_name> IDENTIFIED BY <role_password>;
SET ROLE ap_manager IDENTIFIED BY appwd;
Activating All RolesSET ROLE all;
Activating All Roles Except OneSET ROLE all EXCEPT <role_name>;
SET ROLE all EXCEPT ap_manager;
Deactivating A RoleCan not be done on an individual basis
Deactivating All RolesSET ROLE none;
 
Drop Role
Dropping A Role DROP ROLE <role_name>;
DROP ROLE manager_role;
 
PLUSTRACE Role
Creating And Assigning The PLUSTRACE Role Used By AUTOTRACEThis role must be created by SYS and grants SELECT on the following v_$ views:
  • V_$SESSTAT
  • V_$STATNAME
  • V_$MYSTAT
SQL> @c:/oracle/product/ora10/sqlplus/admin/plustrce.sql

GRANT plustrace TO uwclass;
 
Role Related Queries
All Roles Available In The DatabaseSELECT name
FROM user$
WHERE type# = 0;
Roles Granted To A UserSELECT *
FROM user_role_privs;
Privileges Granted To A RoleSELECT *
FROM role_sys_privs;
System Privileges SELECT DISTINCT privilege
FROM dba_sys_privs;
Grant SELECT On All Tables In A SchemaCREATE OR REPLACE PROCEDURE GRANT_SELECT AS

CURSOR ut_cur IS
SELECT table_name
FROM user_tables;

RetVal  NUMBER;
sCursor INT;
sqlstr  VARCHAR2(250);

BEGIN
  FOR ut_rec IN user_tabs_cur;
  LOOP
    sqlstr := 'GRANT SELECT ON '|| ut_rec.table_name
    || ' TO jwc7675';
    sCursor := dbms_sql.open_cursor;
    dbms_sql.parse(sCursor,sqlstr, dbms_sql.native);

    RetVal := dbms_sql.execute(sCursor);
    dbms_sql.close_cursor(sCursor);
  END LOOP;
END grant_select;
Roles Granted To SchemasSELECT grantee, granted_role
FROM dba_role_privs;
Tables And Columns That Can Be Modified by a UserSELECT *
FROM all_updatable_columns;
 
Other Related Topics
Autotrace
Consumer Groups
Object Privileges
Profiles
System Privileges
Users
 
Contact Us Legal Notices and Terms of UsePrivacy Statement
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值