oracle创建用户与权限操作(oracle学习笔记一)
来源:互联网 发布:logstash 采集数据库 编辑:程序博客网 时间:2024/04/30 04:23
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
--------------------------------------------------------------------------
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
--------------------------------------------------------------------------
- oracle创建用户与权限操作(oracle学习笔记一)
- oracle创建用户与权限操作
- Oracle学习笔记 --- 创建用户,权限
- Oracle学习笔记(2)创建用户及权限设置
- Oracle学习笔记(三)——Oracle用户的管理、权限与角色
- 韩顺平oracle视频笔记一(创建用户、角色、权限分配、账号锁定)
- Oracle 基本操作一:创建表空间、创建用户并赋予权限、创建表、维护表
- oracle学习笔记-用户与权限管理-(12)
- Oracle数据库学习笔记之用户与权限
- oracle学习用户创建和权限管理
- ORACLE 创建表空间,创建用户,赋予权限等操作
- oracle sys用户创建表空间、用户、权限笔记
- 【Oracle】用户与权限
- ORACLE创建用户操作
- Oracle用户创建、权限分配
- Oracle用户创建、权限分配
- oracle 创建用户 赋权限
- ORACLE 创建用户,权限等
- 关闭浏览器后session不失效 in servlet.
- java开发之——遍历文件夹的两种方式
- word不能输入中文
- pydev eclipse插件安装
- Android开发中wrap_content和fill_parent的区别
- oracle创建用户与权限操作(oracle学习笔记一)
- sockaddr_in sockaddr in_addr区别联系[转]
- java克隆的控制
- 用Eclipse开发iPhone Web应用程序
- C# 下ref和out 参数使用
- java中线程的同步的一个卖票的小案例
- 基于Power Threading在Compact Framework中实现APM模式
- 淘宝的api报UnknownHostException错误
- phpstorm + xdebug 远程断点调试,详解。