33.12. Oracle 表空间
33.12.1. 查询空闲表空间
select tablespace_name,file_id,block_id,bytes,blocks from dba_free_space;复制
SQL> select file_name from dba_data_files; FILE_NAME --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /opt/oracle/oradata/orcl/users01.dbf /opt/oracle/oradata/orcl/undotbs01.dbf /opt/oracle/oradata/orcl/sysaux01.dbf /opt/oracle/oradata/orcl/system01.dbf /opt/oracle/oradata/orcl/example01.dbf /opt/oracle/oradata/orcl/neo.dbf 6 rows selected.复制
33.12.2. 创建表空间
create tablespace test datafile '/opt/app/oracle/oradata/test.dbf' size 8M autoextend on next 5M maxsize 10M;复制
maxsize unlimited 是大小不受限制
create tablespace test datafile '/opt/app/oracle/oradata/test.dbf' size 800M autoextend on next 50M maxsize unlimited复制
unform表示区的大小相同,默认为1M
create tablespace test datafile '/opt/app/oracle/oradata/test.dbf' size 800M autoextend on next 50M maxsize 1000M extent management local uniform;复制
unform size 500K表示区的大小相同,为500K
create tablespace test datafile '/opt/app/oracle/oradata/test.dbf' size 800M autoextend on next 50M maxsize 1000M extent management local uniform size 500K;复制
autoallocate 表示区的大小由随表的大小自动动态改变
create tablespace test datafile '/opt/app/oracle/oradata/test.dbf' size 800M autoextend on next 50M maxsize 1000M extent management local autoallocate;复制
temporary 创建字典管理临时表空间
create tablespace test datafile '/opt/app/oracle/oradata/test.dbf' size 800M autoextend on next 50M maxsize 1000M temporary;复制
例 33.2. 创建表空间实例
SQL> create tablespace ts_b01_def datafile '/opt/oracle/oradata/orcl/ts_b01_def.dbf' size 100m autoextend on; Tablespace created. SQL> create tablespace ts_b01_idx datafile '/opt/oracle/oradata/orcl/ts_b01_idx.dbf' size 100m autoextend on; Tablespace created.复制
33.12.2.1. 临时表空间
创建临时表空间,语句中的datafile都换为tempfile
create temporary tablespace test tempfile '/opt/app/oracle/oradata/test.dbf' size 800M autoextend on next 50M maxsize 1000M复制
33.12.3. 更改表空间属性
更改自动扩展属性
alter database datafile '/opt/app/oracle/oradata/test.dbf', '/opt/app/oracle/oradata/test01.dbf' '/opt/app/oracle/oradata/test02.dbf' autoextend off;复制
33.12.3.1. 修改表空间大小
先查询数据文件名称、大小和路径的信息,语句如下: select tablespace_name,file_id,bytes,file_name from dba_data_files; 增加表空间,修改文件大小语句如下 alter database datafile '需要增加的数据文件路径,即上面查询出来的路径 ' resize 800M;复制
33.12.4. 删除表空间
drop tablespace "空间名" including contents and datafiles drop tablespace test including contents and datafiles复制
Donations (打赏)
We accept PayPal through:
https://www.paypal.me/netkiller
Wechat (微信) / Alipay (支付宝) 打赏:
http://www.netkiller.cn/home/donations.html
作者相关文章:
《Netkiller Virtualization 手札》Docker 卷管理
Struts2 S2-046, S2-045 Firewall(漏洞防火墙)
Spring data mongodb @Document定义Enum/List/Map数据结构
转载请注明出处与作者声明,扫描二维码关注作者公众好,不定期更新文章
文章转载自netkiller,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
672次阅读
2025-04-18 14:18:38
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
632次阅读
2025-04-15 17:24:06
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
541次阅读
2025-04-20 10:07:02
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
489次阅读
2025-04-17 17:02:24
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
483次阅读
2025-04-22 00:20:37
一页概览:Oracle GoldenGate
甲骨文云技术
465次阅读
2025-04-30 12:17:56
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
464次阅读
2025-04-22 00:13:51
火焰图--分析复杂SQL执行计划的利器
听见风的声音
412次阅读
2025-04-17 09:30:30
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
371次阅读
2025-04-15 14:48:05
OR+DBLINK的关联SQL优化思路
布衣
352次阅读
2025-05-05 19:28:36