创建新用户
创建用户
(用户除了需要拥有各种创建权限外,还需要分配相应的表空间才能开辟存储空间用于创建的表;)
--创建一个新用户
create user users
identified by passwords;
--给用户赋权(创建会话,创建表,创建序列,创建视图)
grant create session,create table,create sequence,create view
to users;
--给用户分配表空间;
alter user users quota unlimited
on users
--创建一个角色
create role first;
--给角色赋权
grant create session,create table,create sequence,create view
to first;
--将角色赋予用户
grant first to users;
--给users用户赋予查询employees表的权限
grant select on scott.employees to users;
--给users用户赋予更新departments表的权限
grant update on scott.departments to users;
--给users用户赋予同样分配权限的权限
grant select,insert
on scott.departments
to users
with grant option;
--使所有用户都拥有查询scott用户中departments表的权限
grant select on scott.departments
to public;
revoke select, insert
on departments
from scott;
--收回用户权限
revoke select ,insert
on scott.departments
from users
删除用户:
在DBA用户的命令窗口输入: drop user users cascade;
再回车键即可