您的位置:首页 > 数据库 > Oracle

Oracle权限传递的介绍

2020-03-08 13:02 1611 查看

过年在家比较无聊(非常时期),开始整理这些年中Oracle教学的一些实验文档,后面争取做到每天一篇文章出来(尽量。。。)。
今天来给大家讲讲Oracle权限的基础知识。 Oracle权限分为系统的权限和对象权限两个部分,这两种权限在日常工作中如何区分?在什么样场景下去使用?相信大家通过查找一下官方资料可以获取到答案:
系统权限:
A system privilege gives a user the ability to perform a particular action, or to perform an action on any schema objects of a particular type. For example, the system privilege CREATE TABLE permits a user to create tables in the schema associated with that user, and the system privilege CREATE USER permits a user to create database users.

对象权限:
An object privilege gives a user the ability to perform a particular action on a specific schema object. Different object privileges are available for different types of schema objects. The privilege to select rows from the EMPLOYEES table or to delete rows from the DEPARTMENTS table are examples of object privileges.
以上为官方文档的摘录,简单的理解就是操作数据库系统的就是系统权限(全局性),操作用户已创建的对象就叫对象权限(局部性)。

熟悉了如上的权限以后, 我们来明确一个比较重要的问题,那就是权限是否可以传递?

实验如下:
环境介绍:
数据库版本: oracle12C
用户: jack, rose

系统权限回收:

1)创建用户、赋权:
CREATE USER rose IDENTIFIED BY rose;
CREATE USER jack IDENTIFIED BY jack;
Sys:
GRANT create session TO rose WITH ADMIN OPTION;
WITH ADMIN OPTION:
■Grant the privilege or role to another user or role, unless the role is a GLOBAL role
■Revoke the privilege or role from another user or role
■Alter the privilege or role to change the authorization needed to access it
■Drop the privilege or role
■Grant the role to a program unit in the grantee’s schema.
■Revoke the role from a program unit in the grantee’s schema.
2) rose登录系统,赋权给jack :
GRANT create session TO jack;
此时,我们的两个主人公 jack, rose 都应该能够登录数据库。

3)收回Rose的权限:(sys用户执行)
revoke create session from rose ;

疑问:该系统权限是否已经回收?

对象权限回收
1)登录scott用户,并赋予rose查询emp对象的权限
conn scott/tiger
GRANT SELECT ON emp TO rose WITH GRANT OPTION;

2)rose将查询的权限赋给jack
GRANT SELECT ON scott.emp TO jack;
此时登录jack用户,是可以查询scott.emp表的相关信息的。
3)回收ROSE的查询权限
revoke select on emo from rose ;

疑问:jack对象权限是否已经回收?

答案:
系统权限可以传递下去,对象权限不能够传递。即上述的式样中, 第一个实验对于jack的权限没有影响; 第二个实验,如回收rose的查询权限,那么jack的查询权限也被回收。

  • 点赞
  • 收藏
  • 分享
  • 文章举报
南唐老吴 发布了10 篇原创文章 · 获赞 1 · 访问量 2673 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: