Oracle 10g資料表空間建立的完整步驟

來源:互聯網
上載者:User

Oracle Version:Oracle10.2.0.1

Author: Cocis

當在資料庫中建立使用者時,基於應用效能和管理方面的考慮,最好為不同的使用者建立獨立的資料表空間。

1.建立資料表空間

不論是Lnux環境,還是Wndows環境,都要首先建立好資料表空間的存放路徑,如:

/opt/oracle/oradata/cocis 或 D:\oracle\oradata\cocis

若事先不建立該目錄路徑,則在建立資料表空間的時候會出錯。

然後執行如下命令:

SQL> create tablespace cocis

2 datafile 'D:\oracle\oradata\cocis\cocis01.dbf'

3 size 100M AutoExtend On Next 10M Maxsize 2048M

4 extent management local

5 segment space management auto

6 /

資料表空間已建立。

2.為應用建立使用者

建立使用者的同時,為使用者指定預設的永久資料表空間和暫存資料表空間。

SQL> create user cocis identified by cocis

2 default tablespace cocis

3 temporary tablespace temp;

使用者已建立。

SQL> select username,default_tablespace,temporary_tablespace

2 from dba_users

3 where username='COCIS';

USERNAME                       DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE

------------------------------ ------------------------------ ------------------

COCIS                          COCIS                          TEMP

SQL> select username,user_id,password,default_tablespace,temporary_tablespace

2 from dba_users

3 where username='COCIS';

USERNAME                          USER_ID PASSWORD                       TEMPORARY_TABLESPACE

------------------------------ ---------- ------------------------------ -----------------------

COCIS                                  61 E031F623C0F15D34               COCIS

3.許可權的授予

SQL> grant connect,resource to cocis;

授權成功。

注釋:當使用者建立之後,一般只需要授予CONNECT和RESOURCE這兩個角色即可。若要單獨進行授權,則需執行單獨的授權命令,如grant create table to cocis;等。

SQL> revoke unlimited tablespace from cocis;

撤銷成功。

SQL> alter user cocis quota unlimited on cocis;

使用者已更改。

注釋:為了更嚴謹的管理,可以回收使用者的UNLIMITED TABLESPACE許可權,然後對使用者的空間限額進行單獨授權。

聯繫我們

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