Oracle學習(十六) 使用者、角色和許可權

來源:互聯網
上載者:User

一、使用者

1、利用SQL建立使用者的文法格式如下:

    create user user_name --使用者名稱*/      [identified by password | externally | globally as 'external_name'] --以何種方式驗證使用者,驗證方式有3種:口令、外部和全域,      --口令表示利用建立使用者時提供的password進行驗證,外部表格示利用第三方程式來驗證,如作業系統的登入密碼,全域則指當有多個資料時,      --建立一個全域的使用者,其他資料庫都以這個使用者來驗證,只有使用口令的時候才需要關鍵字by*/      [default tablespace tablespace_name] --指定使用者的預設資料表空間*/      [temporary tablespace tablespace_name] --指定使用者的暫存資料表空間*/      [quota integer K | integer M | unlimited on tablespace_name] --在指定資料表空間能分配的最大空間*/      [profile profile_name] --指定概要檔案*/      [default role roleName,..n | all[except roleName,...n] | none] --指定使用者擁有的角色,default是將一個或多個預設的      --角色分給使用者,all[except role]是把所有的角色或除某些角色以外的角色分給使用者,none表示不指定角色*/      [password expire] --表示使password失效,這將強制使用者在第一次登入資料庫時更換密碼*/      [account lock | unlock] --賬戶是否鎖定*/  範例程式碼:      create user hello identified by world password expire;

2、利用SQL修改使用者的文法格式如下:

alter user user_name  identified by password | externally | globally as 'external_name'[default tablespace tablespace_name]  [temporary tablespace tablespace_name]  [quota integer K | integer M | unlimited on tablespace_name]  [profile profile_name]  [default role roleName | all[except roleName] | none]  [password expire]  [account lock | unlock]  例代碼:  alter user hello identified by helloworld;

3、利用SQL命令刪除使用者的文法格式如下:

drop user user_name [cascade]; --使用cascade會把使用者擁有的對象一起刪除*/  例代碼:  drop user hello cascade;

二、角色

1、利用SQL語句建立角色的文法格式如下:

create role role_name  [not identified]  [identified by password | externally | globally]

範例程式碼

create role hello;

2、利用SQL語句修改角色的文法格式如下:

alter role role_name  [not identified]  [identified by password | externally | globally]

3、利用SQL語句刪除角色的文法格式如下

drop role role_name

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.