create user hillary identified by window default tablespace users temporary tablespace temp;
drop user user_name [cascade]; #如果被删除的用户拥有对象,则需要使用cascade关键字
alter user user_name identified by new_password;
password; #仅能修改当前用户的口令
++锁定/解锁用户
alter user user_name account [lock|unlock];
alter user user_name default tablespace new_def_tablespace [temporary tablespace new_temp_tablespace];
++给用户相应权限
grant system_prifvilege[,system_privilege] to user_name [with admin option]; #with admin option表示将要授予系统权限的用户
grant create session to hillary; #授予create session privilege
++查看当前系统用户信息
select username,password from dba_users;
++查看用户的系统权限
connect user/password;
select * from user_sys_privs;
++回收系统权限
revoke system_privilege [,system_privilege] from user_name
++为用户授予对象权限
grant object_privilege [(column_name)] on object_name to user_name [with grant option]
#object_privilege表示对象权限,column_name表示对象中的列名称,object_name表示指定的对象名称,with grant option 允许该用户将当前的对象权限转授予其他用户.
例:(1)为hillary用户授予对scott.authors表的select/insert/delete的对象权限.命令如下
connect scott/password;
grant select,insert,delete on scott.authors to hillary [with grant option];
(2)为hillary授予对scott.authors表中first_name和phone列的更新权限.
connect scott/password;
grant update (first_name,,phone) on scott.authors to hillary;
++回收授予的对象权限
revoke object_privilege on object_name from user_name
connect scott/password; revoke select,insert on scott.authors from hillary;
++角色创建 / 查看角色信息
create role role_name [identified by role_password];
select * from user_role_privs;