Oracle基於學習3--Oracle建立使用者和授權

來源:互聯網
上載者:User

標籤:

Oracleserver端的操作,如以下一般:

 

 1)       安裝Oracleserver軟體

 2)       建立資料庫(安裝時自己主動建立)

 3)       配置監聽(安裝時自己主動配置)

 4)       啟動Oracle執行個體

 5)       建立使用者資料表空間

 6)       建立新使用者並授權

 

以下就開始講建立使用者資料表空間、建立新使用者並授權兩項:

 

 首先要用系統管理員登陸Oracle(sqlplus/as sysdba)

 ?  建立使用者資料表空間(D盤根資料夾建立名為ts_zhangsan的資料表空間)

  create tablespace ts_zhangsandatafile‘D:\zhangsan.dbf‘size30mautoextend on;

 ?  建立使用者(username為zhangsanpassword為pwd)

  create user zhangsan identified by pwd;

 ?  將資料表空間ts_zhangsan授權給使用者zhangsan

  alter user zhangsan default tablespace ts_zhangsan;

 ?  為使用者zhangsan授予串連資料庫、建立表、視圖,操作空間等許可權

  grant create session,create table,create view,unlimited tablespace to zhangsan;

 ?  使用者zhangsan串連到Oracle

  conn zhangsan/pwd

 

註:

 ?  首先要授權 create session,然後才幹串連Oracle

 ?  然後要授權 tablespace才幹進行建立活動

 ?  然後要授權 create table才幹建立table(view同理)

 ?  假設為全部使用者授權,就用to public,如:

  Grant create sessionto public

 ?  回收許可權用revoke from。如(順序與授權相反)

  revoke create table from zhangsan;

  revoke create session from zhangsan;

 ?  假設使用者以下有表,則不能直接刪除(drop),除非在刪除語句後面加上cascade來強制移除,這樣全部跟使用者相關的東西自然也都被刪除:

 

  

 

著作權聲明:本文部落格原創文章,部落格,未經同意,不得轉載。

Oracle基於學習3--Oracle建立使用者和授權

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.