- 查看表空间
select * from dba_tablespaces; - 创建表空间
简单创建: create tablespace userdb datafile 'd:\datafile.dbf' size 200M;
复杂创建:create tablespace userdb datafile 'd:\datafile.dbf' size 200M autoextend on next 20M maxsize unlimited
extent management local
segment space management auto;
大文件表空间:create bigfile tablespace userdb datafile 'd:\datafile.dbf' size 200M autoextend on next 20M maxsize unlimited; - 删除表空间
删除表空间:drop tablespace userdb including contents ;
同时删除文件:drop tablespace userdb including contents and datafiles; - 扩展表空间
修改文件大小:alter database datafile 'd:\fatafile.dbf' resize 300M;
添加数据文件:alter dataspace userdb add datafile 'd:\datafile2.dbf' size ...;
将表空间的数据文件设成自动扩展:alter database datafile 'd:\datafile2.dbf' autoextend on next 5M maxsize unlimited; - 表空间重命名
alter tablespace userdb rename to userdb2; - 使表空间只读
alter tablespace userdb read only; - 使表空间离线/在线
alter tablespace userdb online/offline;