oracle创建表空间

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

1、先查询空闲空间

<!--[if !supportLists]--><!--[endif]-->select tablespace_name,file_id,block_id,bytes,blocks from dba_free_space; 

2、增加Oracle表空间

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

<!--[if !supportLists]--><!--[endif]-->select tablespace_name,file_id,bytes,file_name from dba_data_files; 

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

<!--[if !supportLists]--><!--[endif]-->alter database datafile   

<!--[if !supportLists]--><!--[endif]-->'需要增加的数据文件路径,即上面查询出来的路径  

<!--[if !supportLists]--><!--[endif]-->'resize 800M; 

4、创建Oracle表空间

<!--[if !supportLists]--><!--[endif]-->create tablespace test  

<!--[if !supportLists]--><!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/test01.dbf' size 8M  

<!--[if !supportLists]--><!--[endif]-->autoextend on  

<!--[if !supportLists]--><!--[endif]-->next 5M  

<!--[if !supportLists]-->10 <!--[endif]-->maxsize 10M;  

<!--[if !supportLists]-->11 <!--[endif]--> 

<!--[if !supportLists]-->12 <!--[endif]-->create tablespace sales  

<!--[if !supportLists]-->13 <!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

<!--[if !supportLists]-->14 <!--[endif]-->autoextend on  

<!--[if !supportLists]-->15 <!--[endif]-->next 50M  

<!--[if !supportLists]-->16 <!--[endif]-->maxsize unlimited  

<!--[if !supportLists]-->17 <!--[endif]-->maxsize unlimited 是大小不受限制  

<!--[if !supportLists]-->18 <!--[endif]--> 

<!--[if !supportLists]-->19 <!--[endif]-->create tablespace sales  

<!--[if !supportLists]-->20 <!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

<!--[if !supportLists]-->21 <!--[endif]-->autoextend on  

<!--[if !supportLists]-->22 <!--[endif]-->next 50M  

<!--[if !supportLists]-->23 <!--[endif]-->maxsize 1000M  

<!--[if !supportLists]-->24 <!--[endif]-->extent management local uniform;  

<!--[if !supportLists]-->25 <!--[endif]-->unform表示区的大小相同,默认为1M  

<!--[if !supportLists]-->26 <!--[endif]--> 

<!--[if !supportLists]-->27 <!--[endif]-->create tablespace sales  

<!--[if !supportLists]-->28 <!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

<!--[if !supportLists]-->29 <!--[endif]-->autoextend on  

<!--[if !supportLists]-->30 <!--[endif]-->next 50M  

<!--[if !supportLists]-->31 <!--[endif]-->maxsize 1000M  

<!--[if !supportLists]-->32 <!--[endif]-->extent management local uniform size 500K;  

<!--[if !supportLists]-->33 <!--[endif]-->unform size 500K表示区的大小相同,为500K  

<!--[if !supportLists]-->34 <!--[endif]--> 

<!--[if !supportLists]-->35 <!--[endif]-->create tablespace sales  

<!--[if !supportLists]-->36 <!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

<!--[if !supportLists]-->37 <!--[endif]-->autoextend on  

<!--[if !supportLists]-->38 <!--[endif]-->next 50M  

<!--[if !supportLists]-->39 <!--[endif]-->maxsize 1000M  

<!--[if !supportLists]-->40 <!--[endif]-->extent management local autoallocate;  

<!--[if !supportLists]-->41 <!--[endif]-->autoallocate表示区的大小由随表的大小自动动态改变,大表使用大区小表使用小区  

<!--[if !supportLists]-->42 <!--[endif]--> 

<!--[if !supportLists]-->43 <!--[endif]-->create tablespace sales  

<!--[if !supportLists]-->44 <!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

<!--[if !supportLists]-->45 <!--[endif]-->autoextend on  

<!--[if !supportLists]-->46 <!--[endif]-->next 50M  

<!--[if !supportLists]-->47 <!--[endif]-->maxsize 1000M  

<!--[if !supportLists]-->48 <!--[endif]-->temporary;  

<!--[if !supportLists]-->49 <!--[endif]-->temporary创建字典管理临时表空间  

<!--[if !supportLists]-->50 <!--[endif]--> 

<!--[if !supportLists]-->51 <!--[endif]-->create temporary tablespace sales  

<!--[if !supportLists]-->52 <!--[endif]-->tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  

<!--[if !supportLists]-->53 <!--[endif]-->autoextend on  

<!--[if !supportLists]-->54 <!--[endif]-->next 50M  

<!--[if !supportLists]-->55 <!--[endif]-->maxsize 1000M  

<!--[if !supportLists]-->56 <!--[endif]-->创建本地管理临时表空间,如果是临时表空间,所有语句中的datafile都换为tempfile  

<!--[if !supportLists]-->57 <!--[endif]--> 

<!--[if !supportLists]-->58 <!--[endif]-->8i系统默认创建字典管理临时表空间,要创建本地管理临时表空间要加temporary tablespace关键字  

<!--[if !supportLists]-->59 <!--[endif]-->创建本地管理临时表空间时,不得使用atuoallocate参数,系统默认创建uniform管理方式  

<!--[if !supportLists]-->60 <!--[endif]--> 

<!--[if !supportLists]-->61 <!--[endif]-->为表空间增加数据文件:  

<!--[if !supportLists]-->62 <!--[endif]-->alter tablespace sales add  

<!--[if !supportLists]-->63 <!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M  

<!--[if !supportLists]-->64 <!--[endif]-->autoextend on next 50M  

<!--[if !supportLists]-->65 <!--[endif]-->maxsize 1000M; 

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

为表空间增加数据文件:

<!--[if !supportLists]-->66 <!--[endif]-->alter tablespace sales add  

<!--[if !supportLists]-->67 <!--[endif]-->datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M  

<!--[if !supportLists]-->68 <!--[endif]-->autoextend on next 50M  

<!--[if !supportLists]-->69 <!--[endif]-->maxsize 1000M; 

5、更改自动扩展属性:

<!--[if !supportLists]-->70 <!--[endif]-->alter database datafile  

<!--[if !supportLists]-->71 <!--[endif]-->'/home/app/oracle/oradata/oracle8i/sales01.dbf',  

<!--[if !supportLists]-->72 <!--[endif]-->'/home/app/oracle/oradata/oracle8i/sales02.dbf'  

<!--[if !supportLists]-->73 <!--[endif]-->'/home/app/oracle/oradata/oracle8i/sales01.dbf  

<!--[if !supportLists]-->74 <!--[endif]-->autoextend off; 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值