http://database.51cto.com/art/200910/158936.htm

1、先查询空闲空间

select tablespace_name,file_id,block_id,bytes,blocks from dba_free_space; 

2、增加Oracle表空间

先查询数据文件名称、大小和路径的信息,语句如下:

1.       select tablespace_name,file_id,bytes,file_name from dba_data_files; 

3、修改文件大小语句如下

1.       alter database datafile   

2.       '需要增加的数据文件路径,即上面查询出来的路径  

3.       'resize 800M; 

4、创建Oracle表空间

1.       create tablespace test  

2.       datafile '/home/app/oracle/oradata/oracle8i/test01.dbf' size 8M  

3.       autoextend on  

4.       next 5M  

5.       maxsize 10M;  

 

6.       create tablespace sales  

7.       datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

8.       autoextend on  

9.       next 50M  

10.   maxsize unlimited  

11.   maxsize unlimited 是大小不受限制  

12.    

13.   create tablespace sales  

14.   datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

15.   autoextend on  

16.   next 50M  

17.   maxsize 1000M  

18.   extent management local uniform;  

19.   uniform表示区的大小相同,默认为1M  

20.    

21.   create tablespace sales  

22.   datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

23.   autoextend on  

24.   next 50M  

25.   maxsize 1000M  

26.   extent management local uniform size 500K;  

27.   unform size 500K表示区的大小相同,为500K  

28.    

29.   create tablespace sales  

30.   datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

31.   autoextend on  

32.   next 50M  

33.   maxsize 1000M  

34.   extent management local autoallocate;  

35.   autoallocate表示区的大小随表的大小自动动态改变,大表使用大区小表使用小区  

36.    

37.   create tablespace sales  

38.   datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

39.   autoextend on  

40.   next 50M  

41.   maxsize 1000M  

42.   temporary;  

43.   temporary创建字典管理临时表空间  

44.    

45.   create temporary tablespace sales  

46.   tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

47.   autoextend on  

48.   next 50M  

49.   maxsize 1000M  

50.   创建本地管理临时表空间,如果是临时表空间,所有语句中的datafile都换为tempfile  

51.    

52.   8i系统默认创建字典管理临时表空间,要创建本地管理临时表空间要加temporary tablespace关键字

53.   创建本地管理临时表空间时,不得使用atuoallocate参数,系统默认创建uniform管理方式