1.建立tablespace test:表示建立一個名為test的tablespace,test的大小為8M,自動成長步長為5M,最大空間是10M。
create tablespace test datafile '/home/app/oracle/oradata/oracle8i/test01.dbf' size 8M autoextend on next 5M maxsize 10M;
2.建立tablespace sales:表示建立一個名為sales的tablespace,sales的大小為800M,自動成長步長為50M,沒有最大空間限制。
create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M autoextend on next 50M maxsize unlimited maxsize UNLIMITED; --是大小不受限制
3.建立tablespace sales:表示建立一個名為sales的tablespace,sales的大小為800M,自動成長步長為50M,最大空間為1000M,
採用local管理方式,unform表示區的大小相同,預設為1000M。
create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M autoextend on next 50M maxsize 1000M extent management local uniform; --unform表示區的大小相同,預設為1000M
4.建立tablespace sales:表示建立一個名為sales的tablesapce,sales的大小為800M,自動成長步長為50M,最大空間為1000M,
採用local管理方式,uniform表示區的大小相同為500M。
create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M autoextend on next 50M maxsize 1000M extent management local uniform size 500K; --unform size 500K;表示區的大小相同,為500K
5.建立tablespace sales:表示建立一個名為sales的tablespace,sales的大小為800M,自動成長步長為50M,最大空間為1000M,
採用local管理方式,automaticate表示區的大小由隨表的大小自動動態改變,大表使用大的分區,小表使用小的分區。
create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M autoextend on next 50M maxsize 1000M extent management local autoallocate; --autoallocate表示區的大小由隨表的大小自動動態改變,大表使用大區小表使用小區
6.建立tablespace sales:表示建立一個名為sales的tablespace,sales的大小為800M,自動成長步長為50M,最大空間為1000M,
temporary表示建立字典管理暫存資料表空間。
create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M autoextend on next 50M maxsize 1000M temporary; --temporary建立字典管理暫存資料表空間
7.建立臨時tablespace sales:表示建立一個名為sales的temporary tablespace,並且datafile變成tempfile。
create temporary tablespace sales tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M autoextend on next 50M maxsize 1000M --建立本地管理暫存資料表空間,如果是暫存資料表空間,所有語句中的datafile都換為tempfile 8i系統預設建立字典管理暫存資料表空間,要建立本地管理暫存資料表空間要加temporary tablespace關鍵字
8.建立本地管理暫存資料表空間時,不得使用atuoallocate參數,系統預設建立uniform管理方式 為資料表空間增加資料檔案:
alter tablespace sales add datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M autoextend on next 50M maxsize 1000M;
9.為資料表空間增加資料檔案
alter tablespace sales add datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M autoextend on next 50M maxsize 1000M;
10.更改自動擴充屬性
alter database datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf', '/home/app/oracle/oradata/oracle8i/sales02.dbf' '/home/app/oracle/oradata/oracle8i/sales01.dbf autoextend off;
11.刪除資料表空間
Drop tablespace test INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
文法參考 orale tablespace&datafile -- oracle資料表空間