ivaneeo's blog

自由的力量,自由的生活。

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks

经过长时间学习创建Oracle表空间,于是和大家分享一下,看完本文你肯定有不少收获,希望本文能教会你更多东西。

1、先查询空闲空间

  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.  
  7. create tablespace sales  
  8. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  9. autoextend on  
  10. next 50M  
  11. maxsize unlimited  
  12. maxsize unlimited 是大小不受限制  
  13.  
  14. create tablespace sales  
  15. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  16. autoextend on  
  17. next 50M  
  18. maxsize 1000M  
  19. extent management local uniform;  
  20. unform表示区的大小相同,默认为1M  
  21.  
  22. create tablespace sales  
  23. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  24. autoextend on  
  25. next 50M  
  26. maxsize 1000M  
  27. extent management local uniform size 500K;  
  28. unform size 500K表示区的大小相同,为500K  
  29.  
  30. create tablespace sales  
  31. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  32. autoextend on  
  33. next 50M  
  34. maxsize 1000M  
  35. extent management local autoallocate;  
  36. autoallocate表示区的大小由随表的大小自动动态改变,大表使用大区小表使用小区  
  37.  
  38. create tablespace sales  
  39. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  40. autoextend on  
  41. next 50M  
  42. maxsize 1000M  
  43. temporary;  
  44. temporary创建字典管理临时表空间  
  45.  
  46. create temporary tablespace sales  
  47. tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  48. autoextend on  
  49. next 50M  
  50. maxsize 1000M  
  51. 创建本地管理临时表空间,如果是临时表空间,所有语句中的datafile都换为tempfile  
  52.  
  53. 8i系统默认创建字典管理临时表空间,要创建本地管理临时表空间要加temporary tablespace关键字  
  54. 创建本地管理临时表空间时,不得使用atuoallocate参数,系统默认创建uniform管理方式  
  55.  
  56. 为表空间增加数据文件:  
  57. alter tablespace sales add  
  58. datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M  
  59. autoextend on next 50M  
  60. maxsize 1000M; 

创建本地管理临时Oracle表空间,如果是临时表空间,所有语句中的datafile都换为tempfile8i系统默认创建字典管理临时表空 间,要创建本地管理临时表空间要加temporary tablespace关键字创建本地管理临时表空间时,不得使用atuoallocate参数,系统默认创建uniform管理方式

为表空间增加数据文件:

  1. alter tablespace sales add  
  2. datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M  
  3. autoextend on next 50M  
  4. maxsize 1000M; 

5、更改自动扩展属性:

  1. alter database datafile  
  2. '/home/app/oracle/oradata/oracle8i/sales01.dbf',  
  3. '/home/app/oracle/oradata/oracle8i/sales02.dbf'  
  4. '/home/app/oracle/oradata/oracle8i/sales01.dbf  
  5. autoextend off; 

以上介绍创建Oracle表空间,在这里拿出来和大家分享一下,希望对大家有用。

posted on 2010-12-02 09:37 ivaneeo 阅读(286) 评论(0)  编辑  收藏 所属分类: oralce-为什么这么强大

只有注册用户登录后才能发表评论。


网站导航: