baichaofeng123

数据库用户管理(权限)

用户管理:
创建用户:
create users 用户名 indentified by 密码

删除用户:
drop user 用户名;
如果该用户下面已经存在表等一些数据库对象,则必须用级联删除
drop user 用户名 cascade;

创建session(会话)权限:
一个新用户想访问数据库,必须授予创建session的权限.
grant 权限 to 用户.
例如:给test用户创建session的权限:grant create session yo test;
text 用户可以连接,但是不能有任何操作(如创建表);

用户角色:
角色是一堆权限的集合;
在oracle中提供了两个角色,可直接将这两个角色给用户:
--connect角色
--resource角色
create role myrole;创建一个角色myrole
grant create table to myrole;授予创建表的权限
drop role myrole;删除角色

锁住一个用户:
alter user 用户名 account lock/unlock

对象授权;
如果一个用户要访问其他用户,则必须将其查询权限给要访问的用户;
grant 权限 (select,update,insert,delete)on yonghu.table to 用户
grant select on scott.emp to test;--将Scott下emp的查询权限给test
grant all on scott.emp to test;--将scott用户下emp表的所有权限给test
grant update(ename)on emp to test;--将emp表的ename更新权限给test

权限回收:
revoke 权限 on yonghu.table from 用户
--revoke select on scott.emp from test;--将表emp的查询权限从test处收回.

分类:

技术点:

相关文章:

  • 2021-11-26
  • 2021-08-14
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2021-04-01
  • 2021-12-31
猜你喜欢
  • 2021-12-31
  • 2021-11-18
  • 2022-12-23
  • 2021-12-05
  • 2021-04-18
  • 2022-01-16
  • 2021-06-22
相关资源
相似解决方案