1. 程式人生 > >oracle逐步學習總結之許可權和角色(基礎六)

oracle逐步學習總結之許可權和角色(基礎六)

原創作品,轉自請註明出處:https://www.cnblogs.com/sunshine5683/p/10236129.html

繼續上節的索引,這次主要總結oracle資料庫的許可權問題!(在總結的過程中,後續會不斷完善)

一、索引

1、單列索引:基於單個列建立的索引

建立單列索引:create index index_name on student(name);

2、複合索引

二、許可權

1、授予某使用者登入許可權

grant create session to user_name 

2、授予某個使用者建立表和建立檢視許可權

grant create table,create view to user_name 

3、授予許可權的同時希望該使用者可以同時將該許可權授予其他使用者

grant create table to user_name with admin option

 

4、授予使用者只修改scott.emp表的sal列

grant update on emp(sal) to user_name

5、授予某使用者只可以查詢scott.emp表的ename,sal資料

grant select on scott.emp(ename,sal) to user_name

6、授予index許可權

如果想在別的方案的表上建立索引,則必須具有index物件許可權,如:希望ken使用者可以在scott.emp表上建立索引,就給其index的物件許可權

grant index on scott.emp to ken

同時也可以使用with grant option選項(物件許可權,如果是系統許可權,則:with admin option)

三、角色

角色可以將許可權的授予步驟(許可權授完一般需要12個)

1、預定義角色

(1)connect角色

connect角色具有一般引用開發人員需要的大部分許可權,當建立一個使用者後,多數情況下只要授予使用者connect和resource角色就夠了,其中connect角色具有的使用者許可權如下

alter session

create cluster

create database link

create session

create table

create view

create sequence

(2)resource角色

resource角色具有應用開發人員所需的其他許可權,比如建立儲存過程,觸發器等。這裡需要注意的是,resource角色隱含了unlimited tablespace系統許可權。其中resource角色具有的使用者許可權如下:

create cluster

create indextype

create table

create sequence

create type

create procedure

create trigger

(3)dba角色

dba角色具有所有的系統許可權,以及with admin option選項,預設的dba使用者為sys和system,他們可以將任何系統許可權授予其他使用者,但是dba角色不具備sysdba和sysoper的特權(啟動和關閉資料庫)

2、自定義角色

暫時不總結,後面總結