Oracle创建用户与权限操作
2014-05-22 11:27
381 查看
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
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
相关文章推荐
- ORACLE创建表空间以及增加用户基本权限操作
- Oracle用户的创建及权限的操作
- oracle创建用户与权限操作
- oracle创建用户与权限操作(oracle学习笔记一)
- oracle 创建用户、赋权限、删除用户和一些基本查询操作
- ORACLE创建用户、创建表空间、分配权限、删除用户操作
- ORACLE 创建表空间,创建用户,赋予权限等操作
- Oracle创建用户,解锁用户,赋予用户权限等操作的设置
- Oracle:用户创建、权限分配(默认账号)
- Oracle 创建用户 赋权限 备份导入
- Oracle创建表空间、创建用户以及授权、查看权限
- Oracle用户创建、权限分配
- 用plsql登陆oracle,创建用户赋予权限
- oracle创建表空间并授予用户权限
- Oracle创建表空间、创建用户以及授权、查看权限
- oracle 用bat批处理调用.sql文件,创建或删除用户,给用户赋DBA权限,导入导出用户表
- oracle*用代码创建表空间,用户并赋权限
- 用plsql登陆oracle,创建用户赋予权限
- 关于ORACLE用户的创建,及赋予权限
- Oracle在linux中创建表空间、用户以及权限