Oracle建立使用者設定許可權

2021-09-07 01:56:02 字數 1721 閱讀 2747

**:

create user test identified by "test"  --建立test使用者

default tablespace users

temporary tablespace temp

profile default;

grant connect,create view ,resource  to test;

grant unlimited tablespace to test;

--管理員授權

grant create session to test;--授予test使用者建立session的許可權,即登陸許可權

grant unlimited session to test;--授予test使用者使用表空間的許可權

grant create table to test;--授予建立表的許可權

grant drop table to test;--授予刪除表的許可權

grant insert table to test;--插入表的許可權

grant update table to test;--修改表的許可權

grant all to public;--這條比較重要,授予所有許可權(all)給所有使用者(public)

--oralce對許可權管理比較嚴謹,普通使用者之間也是預設不能互相訪問的

grant select on tablename to test;--授予test使用者檢視指定表的許可權

grant drop on tablename to test;--授予刪除表的許可權

grant insert on tablename to test;--授予插入的許可權

grant update on tablename to test;--授予修改表的許可權

grant insert(id) on tablename to test;

grant update(id) on tablename to test;--授予對指定表特定欄位的插入和修改許可權,注意,只能是insert和update

--撤銷許可權

基本語法同grant,關鍵字為revoke

--檢視許可權

select * from user_sys_privs;--檢視當前使用者所有許可權

select * from user_tab_privs;--檢視所用使用者對錶的許可權

--操作表的使用者的表

/*需要在表名前加上使用者名稱,如下*/

--許可權傳遞

即使用者a將許可權授予b,b可以將操作的許可權再授予c,命令如下:

grant alert table on tablename to test with admin option;--關鍵字 with admin option

grant alert table on tablename to test with grant option;--關鍵字 with grant option效果和admin類似

--角色

角色即許可權的集合,可以把乙個角色授予給使用者

create role myrole;--建立角色

grant create session to myrole;--將建立session的許可權授予myrole

grant myrole to test;--授予test使用者myrole的角色

drop role myrole;刪除角色

/*但是有些許可權是不能授予給角色的,比如unlimited tablespace和any關鍵字*/

oracle使用者建立及許可權設定

許可權 create session create table unlimited tablespace connect resource dba例 sqlplus nolog sql conn as sysdba sql create user username identified by pas...

oracle使用者建立及許可權設定

許可權 create session create table unlimited tablespace connect resource dba例 sqlplus nolog sql conn as sysdba sql create user username identified by pas...

oracle使用者建立及許可權設定

許可權 create session create table unlimited tablespace connect resource dba 例 sqlplus nolog sql conn as sysdba sql create user username identified by pa...