用戶授權 grant create session, connect, resource to xxx;
授權試圖 grant select on KA04_N to HIS_DLL;
創建同義試圖 CREATE SYNONYM KA04_N FOR MCHIS.KA04_N;
查詢數據庫中的所有用戶 select * from dba_users;
鎖住用戶 alter user TEST_SELECT account lock;
給用戶解鎖 alter user TEST_SELECT account unlock;
建立用戶 create user xujin identified by xujin;
授權 grant create tablespace to xujin;
授權查詢 grant select on tabel1 to xujin;
授權更新 grant update on table1 to xujin;
授權存儲過程 grant execute on procedure1 to xujin
授權更新權限轉移給xujin用戶,許進用戶可以繼續授權 grant update on table1 to xujin with grant option;
--收回權限
--revoke select on table1 from xujin1; 收回查詢select表的權限;
--revoke all on table1 from xujin;
/*grant connect to xujin;
revoke connect from xujin
grant select on xezf.cfg_alarm to xujin;
revoke select on xezf.cfg_alarm from xujin;*/
--select table_name,privilege from dba_tab_privs where grantee='xujin' 查詢一個用戶擁有的對象權限
--select * from dba_sys_privs where grantee='xujin' 查詢一個用戶擁有的系統權限
--select * from session_privs --當錢會話有效的系統權限
--角色
--create role xujin1;--建立xujin1角色
--grant insert on xezf.cfg_alarm to xujin1; 將插入表的信息
--revoke insert on xezf.cfg_alarm from xujin1; 收回xujin1角色的權限
--grant xujin1 to xujin ; 將角色的權限授權給xujin;
-- create role xujin2;
--grant xujin1 to xujin2; 將角色xujin1授權給xujin2;
--alter user xujin default xujin1,xujin2; 修改用戶默認角色
-- DROP ROLE xujin1;刪除角色1;
--select * from role_sys_privs where role=xujin1;
--查看許進1角色下有什么系統權限;
--select granted_role,admin_option from role_role_privs where role='xujin2';
--查看xujin1角色下面有什么角色權限
--select * from role_sys_privs where role='xujin2';
--select table_name,privilege from role_tab_privs where role='xujin1';
--select * from dba_role_privs where grantee='xujin' --查看用戶下面有多少個角色;