oracle表空间管理
1.分类:
数据表空间 datatablespace
临时表空间 temprary tablespace
回滚表空间 undo tablespace
索引表空间 index tablespace
本地表空间:extent management local
段自动管理:segement space management auto
2.数据表空间
2.1 创建:create tablespace USER1 datafile ‘/data/user1.dbf‘ size 20G;
2.2 更改自动扩展:alter database datafile ‘/data/user1.dbf‘ autoextend on next 5M maxsize 50G;
2.3 关闭自动扩展:alter database datafile ‘/data/user1.dbf‘ autoextend off;
2.4 扩充表空间:alter tablespace USER1 add datafile ‘/data/user2.dbf‘ size 10G ;
alter database datafile ‘/data/user1.dbf‘ resize 50G;
alter database datafile ‘/data/user1.dbf‘ autoextend on next 5M maxsize 50G;
2.5 表空间上线和下线;alter tablespace USER1 offline;
alter tablespace USER1 online;
2.6 表空间重命名: alter tablespace USER1 rename to USER11;
2.7 表空间只读: alter tablespace USER1 read only;
2.8 删除表空间: drop tablespace USER including contents;
3.临时表空间:
3.1 创建临时表空间:create temprary tablespace TEMP1 tempfile ‘/data/temp1.dbf‘ size 100M autoextend on next 5M maxsize 150M;
3.2 更改临时表空间: alter database default temprary tablespace TEMP1;
3.3 临时表空间组: alter tablespace TEMP1 tablespace group GROUP1;
3.4 默认临时表空间改为临时表空间组:alter database default temprary tablespace GROUP1;
3.5 将TEMP1从GROUP1中删除: alter tablespace TEMP1 tablespace group ‘‘;
4. 回滚表空间
4.1 创建回滚表空间:create UNDO tablespace UNDB1 datafile ‘/data/undo1.dbf‘ size 300M autoextend on next 5M maxsize 350M;
4.2 回滚表空间自动管理:UNDO_MANAGEMENT=auto
UNDO_TABLESPACE=UNDB1
4.3 删除回滚表空间:drop tablespace UNDB1 including contents;
4.4 回滚表空间中添加数据文件:alter tablespace UNDB1 add datafile ‘/data/UNDB2.dbf‘ size 10M autoextend on next 2M maxsize 20M;
4.5 切换回滚表空间: show parameter UNDO_TABLESPACE;
alter system set UNDO_TABLESPACE = UNDB2 scope=both;
本文出自 “常用文档” 博客,请务必保留此出处http://yujianglei.blog.51cto.com/7215578/1561191