Oracle使用者許可權管理
sys;//系統管理員,擁有最高許可權
system;//本地管理員,次高許可權
scott;//普通使用者,密碼預設為tiger,預設未解鎖
sys;//系統管理員,擁有最高許可權
system;//本地管理員,次高許可權
scott;//普通使用者,密碼預設為tiger,預設未解鎖
二、登陸
sqlplus / as sysdba;//登陸sys帳戶
sqlplus sys as sysdba;//同上
sqlplus scott/tiger;//登陸普通使用者scott
sqlplus / as sysdba;//登陸sys帳戶
sqlplus sys as sysdba;//同上
sqlplus scott/tiger;//登陸普通使用者scott
三、管理使用者
create user zhangsan;//在管理員帳戶下,建立使用者zhangsan
alert user scott identified by tiger;//修改密碼
create user zhangsan;//在管理員帳戶下,建立使用者zhangsan
alert user scott identified by tiger;//修改密碼
四,授予許可權
1、預設的普通使用者scott預設未解鎖,不能進行那個使用,新建的使用者也沒有任何許可權,必須授予許可權
/*管理員授權*/
grant create session to zhangsan;//授予zhangsan使用者建立session的許可權,即登陸許可權
grant unlimited session to zhangsan;//授予zhangsan使用者使用表空間的許可權
grant create table to zhangsan;//授予建立表的許可權
grante drop table to zhangsan;//授予刪除表的許可權
grant insert table to zhangsan;//插入表的許可權
grant update table to zhangsan;//修改表的許可權
grant all to public;//這條比較重要,授予所有許可權(all)給所有使用者(public)
/*管理員授權*/
grant create session to zhangsan;//授予zhangsan使用者建立session的許可權,即登陸許可權
grant unlimited session to zhangsan;//授予zhangsan使用者使用表空間的許可權
grant create table to zhangsan;//授予建立表的許可權
grante drop table to zhangsan;//授予刪除表的許可權
grant insert table to zhangsan;//插入表的許可權
grant update table to zhangsan;//修改表的許可權
grant all to public;//這條比較重要,授予所有許可權(all)給所有使用者(public)
2、oralce對許可權管理比較嚴謹,普通使用者之間也是預設不能互相訪問的,需要互相授權
/*oralce對許可權管理比較嚴謹,普通使用者之間也是預設不能互相訪問的*/
grant select on tablename to zhangsan;//授予zhangsan使用者檢視指定表的許可權
grant drop on tablename to zhangsan;//授予刪除表的許可權
grant insert on tablename to zhangsan;//授予插入的許可權
grant update on tablename to zhangsan;//授予修改表的許可權
grant insert(id) on tablename to zhangsan;
grant update(id) on tablename to zhangsan;//授予對指定表特定欄位的插入和修改許可權,注意,只能是insert和update
grant alert all table to zhangsan;//授予zhangsan使用者alert任意表的許可權
/*oralce對許可權管理比較嚴謹,普通使用者之間也是預設不能互相訪問的*/
grant select on tablename to zhangsan;//授予zhangsan使用者檢視指定表的許可權
grant drop on tablename to zhangsan;//授予刪除表的許可權
grant insert on tablename to zhangsan;//授予插入的許可權
grant update on tablename to zhangsan;//授予修改表的許可權
grant insert(id) on tablename to zhangsan;
grant update(id) on tablename to zhangsan;//授予對指定表特定欄位的插入和修改許可權,注意,只能是insert和update
grant alert all table to zhangsan;//授予zhangsan使用者alert任意表的許可權
五、撤銷許可權
基本語法同grant,關鍵字為revoke
基本語法同grant,關鍵字為revoke
六、檢視許可權
select * from user_sys_privs;//檢視當前使用者所有許可權
select * from user_tab_privs;//檢視所用使用者對錶的許可權
select * from user_sys_privs;//檢視當前使用者所有許可權
select * from user_tab_privs;//檢視所用使用者對錶的許可權
七、操作表的使用者的表
/*需要在表名前加上使用者名稱,如下*/
select * from zhangsan.tablename
/*需要在表名前加上使用者名稱,如下*/
select * from zhangsan.tablename
八、許可權傳遞
即使用者A將許可權授予B,B可以將操作的許可權再授予C,命令如下:
grant alert table on tablename to zhangsan with admin option;//關鍵字 with admin option
grant alert table on tablename to zhangsan with grant option;//關鍵字 with grant option效果和admin類似
grant alert table on tablename to zhangsan with admin option;//關鍵字 with admin option
grant alert table on tablename to zhangsan with grant option;//關鍵字 with grant option效果和admin類似
九、角色
角色即許可權的集合,可以把一個角色授予給使用者
create role myrole;//建立角色
grant create session to myrole;//將建立session的許可權授予myrole
grant myrole to zhangsan;//授予zhangsan使用者myrole的角色
drop role myrole;刪除角色
/*但是有些許可權是不能授予給角色的,比如unlimited tablespace和any關鍵字*/
相關文章
- 【許可權管理】Oracle中檢視、回收使用者許可權Oracle
- Oracle使用者角色許可權管理Oracle
- Oracle使用者、許可權、角色管理Oracle
- 【使用者管理】oracle使用者、角色、許可權管理Oracle
- oracle 許可權管理Oracle
- Oracle使用者、許可權、角色管理【轉】Oracle
- Oracle 使用者許可權管理與常用許可權資料字典列表Oracle
- Oracle 使用者、物件許可權、系統許可權Oracle物件
- ORACLE使用者管理與許可權設定Oracle
- oracle使用者許可權Oracle
- oracle 使用者許可權Oracle
- mysql使用者許可權管理MySql
- 使用者物件許可權管理物件
- Oracle11g 使用者與許可權管理Oracle
- Oracle ERP許可權管理Oracle
- Oracle使用者及角色的許可權管理[Oracle基礎]Oracle
- MySQL 使用者管理與許可權管理MySql
- Oracle使用者與許可權Oracle
- 使用者許可權 plsql OracleSQLOracle
- MySQL 使用者及許可權管理?MySql
- MySQL使用者及許可權管理MySql
- MongoDB 使用者與許可權管理MongoDB
- 使用者許可權系統管理
- MySQL使用者與許可權管理MySql
- Oracle查詢使用者許可權Oracle
- Oracle檢視使用者許可權Oracle
- 檢視oracle 使用者許可權Oracle
- Oracle的物件許可權、角色許可權、系統許可權Oracle物件
- Linux使用者、組、許可權管理Linux
- 使用者角色許可權管理架構架構
- 使用者及檔案許可權管理
- Linux-許可權管理(ACL許可權)Linux
- ORACLE許可權Oracle
- MySQL-03.使用者管理和許可權管理MySql
- oracle的許可權管理的總結Oracle
- MySQL資料庫許可權體系入門(3)---管理使用者許可權MySql資料庫
- [學習]ORACLE使用者、角色、許可權Oracle
- Oracle 使用者許可權獲取ProcedureOracle