Home > Database > Mysql Tutorial > Oracle用户角色权限管理

Oracle用户角色权限管理

WBOY
Release: 2016-06-07 15:03:13
Original
1053 people have browsed it

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 起用角色:给用户赋予角色,角色并不会立即起作用。 1.角色不能立即起作用。必须下次断开此次连接,下次连接才能起作用。 2.或者执行命令:有密码的角色set role testrole identified by tanfufa

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

 

  起用角色:给用户赋予角色,角色并不会立即起作用。

  1.角色不能立即起作用。必须下次断开此次连接,下次连接才能起作用。

  2.或者执行命令:有密码的角色set role testrole   identified by tanfufa 立即生效;

  3.无密码的角色:set role testrole;或set   role all except rolename_withpassword.

  把角色赋予角色,角色嵌套。

  create role testrole1;

  grant select on t1 to testrole1;

  create role testrole2;

  grant testrole1 to testrole2;

  grant r2 to testdb;

  角色管理:

  与角色有关系的视图:

  所有角色:

  select * from dba_roles;

  当前用户scott有哪些角色:

  select * from session_roles;

  建立角色模板:只举一个例子。大家去触类旁通。

  只读用户角色的建立的脚本:

  1.授予某模式下对象读权限给角色。

  SET PAGESIZE 0

  SET FEEDBACK OFF

  SET VERIFY OFF

  SPOOL s.sql

  SELECT 'GRANT SELECT ON "' || u.object_name || '" TO &1;'

  FROM user_objects u

  WHERE   u.object_type IN ('TABLE','VIEW','SEQUENCE')

  AND NOT EXISTS (SELECT '1'

  FROM all_tab_privs a

  WHERE   a.grantee = UPPER('&1')

  AND a.privilege   = 'SELECT'

  AND a.table_name = u.object_name);

  SPOOL OFF

  -- Comment out following line to prevent immediate run @s.sql

  SET PAGESIZE 14

  SET FEEDBACK ON

  SET VERIFY ON

  2.为模式权限对象创建同意词。

  SET PAGESIZE 0

  SET FEEDBACK OFF

  SET VERIFY OFF

  SPOOL temp.sql

  SELECT 'CREATE SYNONYM "' || a.table_name || '" FOR "' || a.owner || '"."' || a.table_name || '";'

  FROM all_tables a

  WHERE   NOT EXISTS (SELECT '1'

  FROM user_synonyms u

  WHERE   u.synonym_name = a.table_name

  AND u.table_owner   = UPPER('&1'))

  AND a.owner = UPPER('&1');

  SPOOL OFF

  -- Comment out following line to prevent immediate run

  @temp.sql

  SET PAGESIZE 14

  SET FEEDBACK ON

  SET VERIFY ON

  [1] [2] 

Oracle用户角色权限管理

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template