oracle怎么付给新库权限,oracle创造用户与权限操作(oracle学习笔记一)

当前位置:我的异常网» 数据库 » oracle创造用户与权限操作(oracle学习笔记一)

oracle创造用户与权限操作(oracle学习笔记一)

www.myexceptions.net  网友分享于:2013-08-18  浏览:4次

oracle创建用户与权限操作(oracle学习笔记一)

1.创建用户create user

SQL>create user arthur identified by m123

(m123是密码,必须是以字母开头)

一般的普通用户是无权限用create user的

可以切换用户然后创建

#用system来创建用户arthur

SQL>conn system/密码

SQL>create user arthur identified by m123

------------------------------------

2.注意上面创建了arthur,但是它只是个孤零零的用户,

没有任何权限,所以下面的

链接语句也不会执行成功

SQL>conn arthur/m123,//没有权限,运行不成功

--------------------------------------

3.为了获得权限,用grant,收回一个权限revoke

可以让system来赋给arthur 权限

#首先登陆system

SQL>conn system/密码

SQL>grant connect to arhtur 回车//system把connect权限给予arthur

授权成功

然后执行链接

SQL>conn arthur/m123

就成功了

--------------------------------------

4.让用户arthur有权限建表,如果不付权限的话,arthur用户是不可以创建表的

SQL>conn system/密码

SQL>grant resource to arthur

授权成功

SQL>conn arthur/m123

SQL>create table table_name

--------------------------------------

5.希望arthur用户可以查询scott用户的emp表

授权者是:scott(因为emp是里面scott的表),

SQL>conn scott/密码

SQL>grant select on emp to arthur

授权成功

下面如果arthur想查询scott表emp可以用下面的语句(emp是表)

先登录

SQL>conn arthur/m123

SQL>select * from emp;//此句错误

SQL>select * from scott.emp;

说明此时arthur对emp只有查询权限

--------------------------------------

6.如果arthur用户想更新scott的emp,可以用下面的授权

SQL>conn scott/密码

SQL>grant update on emp to arthur

授权成功

说明此时arthur对emp只有更改权限

--------------------------------------

7.如果arthur用户可以修改/删除/查询/添加scott的emp表可以用下面的语句

SQL>conn scott/密码

SQL>grant all on emp to arthur

授权成功

收回权限(scott收回arthur对emp表的查询权限)

SQL>conn scott/密码

SQL> revoke select on emp from arthur

--------------------------------------

8'权限的传递,scott给arthur赋权限的同时,也允许arthur继续把权限传递下去

当然arthur传递的权限不能超越scott所受的权限

scott>--arthur>----somebody

如果是对象权限,就加入 with grant option

SQL> conn scott/密码

已连接

SQL>grant select on emp to arthur with grant option

下面arthur把对emp的选择权限受权给另一个用户 tom

#先登录

SQL>conn arthur/m123

SQL>grant select on emp to tom //此种写法错误,arthur里面没有emp表

SQL>grant select on scott.emp to tom

注意:当scott把arthur的权限select回收revoke时,tom对emp的select权限也是被回收了

如果是系统权限

system 赋权给arthur

grant conn to arthur with admin option

--------------------------------------

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值