创建和修改临时表空间
创建临时表空间需要使用temporary,关键字为tempfile,一般用于执行排序等操作
SQL> create temporary tablespace mytemp
2 tempfile 'D:\oradata\mytemp.dbf'
3 size 5M autoextend on next 2M maxsize 20M;
SQL> select tablespace_name,status from dba_tablespaces;
增加临时文件,add tempfile,修改大小resize,也可修改状态为online或者offline
SQL> column name format A50
SQL> select file#,status,name from v$tempfile; 查看状态
SQL> alter tablespace mytemp
2 add tempfile 'D:\oradata\mytemp2.dbf'
3 size 5M;
SQL> select file#,status,name from v$tempfile;
临时表空间组
使用临时表空间组,可并发执行排序操作,避免空间不足问题
创建使用tablespace group在创建时指定一个组,查看临时表空间组信息,数据字典
dba_tablespace_groups,移动alter tablespace
SQL> create temporary tablespace tempgroup
2 tempfile 'D:\oradata\tempgroup01.dbf' size 5M
3 tablespace group group01;
SQL> select * from dba_tablespace_groups;
SQL> create temporary tablespace tempgroup02
2 tempfile 'D:\oradata\tempgroup02.dbf' size 5M
3 tablespace group group02;
SQL> select * from dba_tablespace_groups;
SQL> alter tablespace tempgroup tablespace group group02; //将tempgroup移动到group02
SQL> select * from dba_tablespace_groups;