1:创建用户
create user zhaoyb identified by zhaoyb default tablespace HUAPUSALEDB create user 用户名 identified by 密码 default tablespace 默认表空间
2:给用户授权
grant connect,sysdba to zhaoyb grant 角色 to 用户 grant connect,resource,create any view,create any synonym,create database link to 用户名;
3:收回权限
revoke connect from zhaoyb revoke 角色 from 用户
4:删除用户
只删除用户 drop user zhaoyb ; drop user 用户名 ; 删除用户连同此用户创建的表(cascade) drop user 用户名 cascade;
5:查看用户
select * from dba_users; select * from all_users; select * from user_users;
6:查看用户系统权限
select * from dba_sys_privs; select * from all_sys_privs; select * from user_sys_privs;
7:查看用户对象权限
select * from dba_tab_privs; select * from all_tab_privs; select * from user_tab_privs;
8:查看所有角色
select * from dba_roles;
9:查看用户所拥有的角色
select * from dba_role_privs; select * from user_role_privs;
10:查看当前用户的缺省表空间
select username,default_tablespace from user_users;
11:查看某个角色的具体权限
如grant connect,resource,create session,create view to TEST;
12:查看RESOURCE具有那些权限
SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE='RESOURCE';
13:修改密码
alter user zhaoyb identified by 1234; alter user 用户 identified by 密码; 加密后的值用by values修改 alter user zhaoyb identified by values '2D594E86F93B17A1'; alter user 用户 identified by values '2D594E86F93B17A1';
14:查找用户的默认表空间
select username, DEFAULT_TABLESPACE from dba_users;