普通表空間:
1》 創建表空間:
Create tablespace tablespace_name
Datafile ‘E:\oracle\tablespace_datafile.dbf’ size 20M
Autoextend on
Next 5M
Maxsize 50M;
2》 添加數據文件:
Alter tablespace tablespace_name
Add datafile ‘E:\oracle\tablespace_new_add_datafile.dbf’
Size 20M
Autoextnend off;
3》 更改數據文件大小:
Alter database datafile ‘E:\oracle\tablespace_datafile.dbf’
Resize 50M
4》 更改表數據文件自增:
Alter database datafile ‘E:\oracle\tablespace_new_add_datafile.dbf’
Autoextend on
5》 查詢所有表空間名字等 :user_tablespaces;
6》 查詢默認表空間,臨時表空間:user_users
7》 查詢表空間空閑情況:dba_free_space
8》 查詢數據文件:dba_data_files
9》 查詢表空間狀態:dba_tablespaces
10》 移動數據文件:
① :alter tablespace tablespace_name offline
② :物理硬盤上移動數據文件
③ :alter tablespace tablespace_name
rename datafile ‘E:\oracle\old\tablespace_datafile.dbf’
to ‘E:\oracle\new\tablespace_datafile.dbf’
11》 刪除表空間:
Drop tablespace tablespace_name
Including contents and datafiles;(刪除內容和文件)
臨時表空間:
1》 創建臨時表空間:
Create temporary tablespace tablespace_name
Tempfile ‘E:\oracle\temptablespace_datafile.dbf’
Size 5M
Autoextend on
Next 3M
Maxsize 10M
2》 添加數據文件:
Alter tablespace tablespace_name
Add tempfile ‘E:\oracle\temptablespace_new_add_datafile.dbf’
Size 5M;
3》 更改數據文件大小:
4》 更改臨時文件狀態:
Alter database tempfile ‘E:\oracle\temptablespace_datafile.dbf’ offline
5》 創建臨時表空間組:
Create temporary tablespace temptablespace_name
Tempfile ‘E:\oracle\temptablespace_datafile.dbf’
Size 5M
Tablespace group tablespace_group_name
6》 把臨時表空間添加到表空間組:
Alter tablespace temptablespace_name tablespace group tablespace_group_name
7》 刪除表空間組 == 刪除表空間組中的所有表空間
Drop tablespace temptablespace_name including contents and datafiles