码迷,mamicode.com
首页 > 数据库 > 详细

oracle权限管理

时间:2017-06-28 23:18:21      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:employee   管理   最小   count   acl   sys   user   sysdba   tempfile   

 

授权原则:最小权限原则

通过角色给用户授权可以方便简化管理员管理权限

 

业务账号创建:
  创建特定表空间:
    CREATE TABLESPACE TBS1 DATAFILE ‘/u01/app/oracle/oradata/PROD4/PROD4/TBS1.DBF‘ SIZE 100M;
  创建特点临时表空间:
    create temporary tablespace temp2 tempfile ‘/u01/app/oracle/oradata/PROD4/PROD4/temp2.dbf‘ size 50m ;
  创建业务用户:
    create user "mytest" profile "DEFAULT" identified by 123456 default tablespace "tbs1" temporary tablespace "temp2" account unlock;
  给用户授权:
    grant RESOURCE to mytest;

给员工创建oracle账号:
  SQL> create user fxh identified by "123456";
  SQL> grant connect to fxh;
  SQL> grant select on hr.employees to fxh;

 

帐户解锁
  SQL> alter user hr identified by 123456 account unlock;

 

权限查询:

  1、查询某个用户具有的权限:

    查询某个用户具有的角色:
      select grantee,granted_role from dba_role_privs where grantee=‘HR‘;

    查询某个用户具有的系统权限:
      select grantee,privilege from dba_sys_privs where grantee=‘HR‘;

    查询某个用户具有的对象权限:
      select GRANTEE,OWNER,TABLE_NAME,PRIVILEGE from dba_tab_privs WHERE grantee=‘HR‘;

  2、查询某个角色的权限:

    查询某个角色具有的对像权限:
      SQL> select * from role_tab_privs where role=‘AA‘;

    查询某个角色中具有什么系统权限:
      select privilege from role_sys_privs where role=‘RESOURCE‘;

    查询某个角色中包含有什么角色
      select granted_role from role_role_privs where role=‘SYSDBA‘;

 

oracle权限管理

标签:employee   管理   最小   count   acl   sys   user   sysdba   tempfile   

原文地址:http://www.cnblogs.com/fanxuanhui-linux/p/7091847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!