1.修改用户密码
passw; --修改自己的密码
alter user xiaoming identified by m1234; --需要管理员权限用户才能给别的用户改密码
2.授予用户连接到数据库及建表等权限
grant connect to xiaoming; --授予xiaoming连接到数据库权限,需要管理员权限。connect为角色包含多种系统权限
grant resource to xiaoming; --授予xiaoming建表等权限,需要管理员权限。resource为角色包含多种系统权限
3.建表
create table test(userID char(10), name varchar2(10));
4.授予别的用户对本身的增删改查等对象权限
grant select on emp to xiaoming; -- 对象权限有select、insert、update、delete、 all 等
revoke select on emp to xiaoming; --收回对象权限
grant connect to xiaoming with admin option; --使得小明可以将获得的connect授予其他用户
grant select to xiaoming with grant option;
注意: revoke具有株连特性。即若scott赋予xiaoming 其emp表的select权限,xiaoming再将select 赋予xiaohong。然后,scott收回xiaoming对其emp表的select权限,则xiaohong将不再具有select scott.emp的权限.
revoke仅对对象权限株连,系统权限不株连