標籤: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建立資料表空間及使用者