Oracle 資料庫建立、資料表空間建立、使用者建立 步驟

來源:互聯網
上載者:User

一、資料庫建立:

1、利用資料庫配置助手(DBCA,Database Configuration Assistant)圖形化方式

2、建立完成之後,找到  D:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN下的 tnsnames.ora 監聽設定檔開啟

配置一下新資料庫的資料庫名和sid

3、然後重新啟動 pl\sql登陸即可


二、建立暫存資料表空間:(如不建立則使用預設暫存資料表空間)

create temporary tablespace temp_hjb tempfile 'temp_file.dbf' size 10m;

修改資料表空間名稱:alter tablespace temp_hjb rename to hjb_temp;


三、建立永久資料表空間:(如不建立則使用預設永久資料表空間)

create tablespace hjb_data datafile 'hjb_data.dbf' size 10m;

修改資料表空間(聯機或離線)狀態:alter tablespace hjb_data online|offline;

查看錶空間的檔案名稱:select file_name from dba_data_files where tablespace_name = 'HJB_DATA';  (資料表空間名要大寫)

添加刪除資料表空間資料檔案:alter tablespace hjb_data add/drop data_file 'hjb_data.dbf';


四、建立使用者:(同時指定其暫存資料表空間和永久資料表空間)

create user wbs identified by wbs123 account unlock
default tablespace hjb
temporary tablespace hjb_temp;

刪除使用者:drop user hjb_wbs;


五、給新建立的使用者授權

grant connect,resource to wbs;  -把connect,resource許可權授權給新使用者

grant dba to wbs;  -把dba許可權授權給新使用者


註:

grant XXX to user;,grant是授權的作用,這裡的XXX可以是一個角色role,也可以是許可權

DBA:擁有全部特權,是系統最高許可權,只有DBA才可以建立資料庫結構。

RESOURCE:擁有Resource許可權的使用者只可以建立實體,不可以建立資料庫結構。

CONNECT:擁有Connect許可權的使用者只可以登入Oracle,不可以建立實體,不可以建立資料庫結構。

對於普通使用者:授予connect, resource許可權。 

對於DBA系統管理使用者:授予connect,resource, dba許可權。


資料庫使用者建立完成。

聯繫我們

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