Oracle建立資料表空間及使用者

來源:互聯網
上載者:User

標籤:create   end   schema   space   lin   obj   cas   關聯   pac   

一、建立資料表空間

1、設定執行個體名

echo $ORACLE_SID

export ORACLE_SID=mvbpbang

2、sqlplus登入/sqlplus命令登入

  在安裝Oracle時,你需要記住設定的“全域資料庫名”(預設為orcl) 和 口令,在以兩種方式登入時:

  使用者名稱: sys(超級使用者==sysdba) / system(管理使用者 和sys想比區別在於system不能建立資料表空間)...

  口 令:sqlplus  / as sysdba;

3、建立暫存資料表空間/資料表空間/建立使用者/授權

  

  

 
1:建立暫存資料表空間create temporary tablespace user_temp  tempfile ‘Q:\oracle\product\10.2.0\oradata\Test\xyrj_temp.dbf‘ size 50m  autoextend on  next 50m maxsize 20480m  extent management local;   2:建立資料資料表空間create tablespace user_data   datafile ‘Q:\oracle\product\10.2.0\oradata\Test\xyrj_data.dbf‘ size 50m  autoextend on  next 50m maxsize unlimited  extent management local
segment space management auto; 第3步:建立使用者並指定資料表空間create user username identified by password default tablespace user_data temporary tablespace user_temp; 第4步:給使用者授予許可權grant connect,resource,dba to username;
 二、刪除使用者及資料表空間 

刪除user

drop user ×× cascade

說明: 刪除了user,只是刪除了該user下的schema objects,是不會刪除相應的tablespace的。

 刪除tablespace

drop  tablespace tablespace_name  including contents and datafiles;

 

SQL code
--刪除空的資料表空間,但是不包含物理檔案
drop tablespace tablespace_name;
--刪除非空資料表空間,但是不包含物理檔案
drop tablespace tablespace_name including contents;


--刪除空資料表空間,包含物理檔案
drop tablespace tablespace_name including datafiles;
--刪除非空資料表空間,包含物理檔案
drop tablespace tablespace_name including contents and datafiles;
--如果其他資料表空間中的表有外鍵等約束關聯到了本資料表空間中的表的欄位,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles cascade constraints;

---轉載---

http://www.cnblogs.com/xmaomao/p/3273102.html

 

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.