(1)首先以管理员身份登录:
sqlplus system/xxx as sysdba
(2)创建用户并指定表空间
create user username identified by password
default tablespace user_data
temporary tablespace user_temp;
该用户创建的任何数据库对象都会保存在user_temp 和user_data表空间,
(3)给用户授予权限
grant connect,resource to username;
回收权限:
revoke 权限... from 用户名;
授DBA 权限化
Grant dba to 用户名;
(4)修改用户密码
alter user [username] identified by [password]
(5)下次登录时提示修改密码
alter user [username] password expir
(6)锁住用户
alter user [username] account lock
(7)解锁锁用户
alter user [username] account unlock
(8)把scott下emp表的两个权限给用户
grant select,delete on scott.emp to [username]
(9)回收权限
revoke select on scott.emp from [username]
(10)查看用户的角色权限1、查看当前用户拥有的角色权限信息:
select * from role_sys_privs;
2、查看所有用户:
select * from all_users;
3、查看当前用户的详细信息:
select * from user_users;
4、查看所有角色:
select * from dba_roles;
5、查看当前用户的角色信息:
select * from user_role_privs;
(11)当前用户下的表
select * from user_users;