create user <user_name> identified by <password>; -----創建用戶、設置密碼
grant connect,resource to <user_name>; ---授權、其中connect、resource 爲兩個角色(role)
revoke connect,resource from <user_name> ;-----回收權限1)在resource角色裏包含了unlimited tablesapce 系統權限,意思是不限制用戶使用任何表空間,此權限太大,它包括可以訪問system表空間,在實際應用中一般要將此權限收回,然後再對用戶限制表空間配額(quoto)。
2)sys將resource角色授權給用戶,其中有9個系統權限,只有unlimited tablespace可以單獨收回(從角色裏收回系統權限的特例)。
-------------------------------------------------------------------------------------------------------
alter user <user_name> identified by <password> -----修改密碼
select username,account_status from dba_users; ----查看用戶狀態是否被鎖定alter user <user_name> account unlock ; --------解鎖用戶
alter system set resource_limit=true; ---開啓數據庫資源限制
create profile <profile_name> limit idle_time 3; ----設置profile中idle_time爲3分鐘,空閒會話3分鐘自動斷開
alter user <user_name> profile <profile_name> ; -----把profile分配給用戶
-------------------------------------------------------------------------------------------------------------
drop user <user_name> cascade ; -----級聯刪除用戶
SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='<user_name>';
----查看當前用戶佔用進程
ALTER SYSTEM KILL SESSION 'SID,SERIAL#'; ----結束進程