Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1916659
  • 博文数量: 498
  • 博客积分: 2078
  • 博客等级: 大尉
  • 技术积分: 1645
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-18 22:43
个人简介

安大

文章分类

全部博文(498)

文章存档

2017年(1)

2016年(2)

2015年(21)

2014年(90)

2013年(101)

2012年(267)

2011年(16)

分类:

2012-12-11 12:43:36

原文地址:创建Oracle表空间的步骤 作者:xmlamp

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

阅读(616) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~