临时表空间组

临时表空间组

1、数据库版本
SQL> select * from v$version;

BANNER
----------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

2、建立一个临时表空间组group1,两个临时表空间成员temp1、temp2;临时表空间组不用显示创建,有成员时则存在
SQL> select * from dba_tablespace_groups;

未选定行

SQL> create temporary tablespace temp1
    tempfile 'G:\oracle\oradata\orcl11g\temp1.dbf' size 10m
    tablespace group tempgroup;

表空间已创建。

SQL> create temporary tablespace temp2
    tempfile 'G:\oracle\oradata\orcl11g\temp2.dbf' size 10m
    tablespace group tempgroup;

表空间已创建。

SQL> select * from dba_tablespace_groups;

GROUP_NAME                     TABLESPACE_NAME
------------------------------ ---------------
TEMPGROUP                      TEMP1
TEMPGROUP                      TEMP2

3、临时表空间可移动到另外一个临时表空间组
 
SQL> alter tablespace temp1 tablespace group t_group;

表空间已更改。

SQL> select * from dba_tablespace_groups;

GROUP_NAME                     TABLESPACE_NAME
------------------------------ ----------------------------
T_GROUP                        TEMP1
TEMPGROUP                      TEMP2

4、临时表空间也可以从组中独立出来

SQL> alter tablespace temp1 tablespace group '';

表空间已更改。

SQL> select * from dba_tablespace_groups;

GROUP_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
TEMPGROUP                      TEMP2

SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY';

TABLESPACE_NAME
------------------------------
TEMP
TEMP1
TEMP2

独立的表空间也可以再次加上组中
SQL> alter tablespace temp1 tablespace group tempgroup;

表空间已更改。

SQL> select * from dba_tablespace_groups;

GROUP_NAME                     TABLESPACE_NAME
------------------------------ ------------------------
TEMPGROUP                      TEMP1
TEMPGROUP                      TEMP2

5、表空间名不能跟组名相同

SQL> create temporary tablespace tempgroup tempfile 'G:\oracle\oradata\orcl11g\tempgroup.dbf' size 10m tablespace group tempgroup;
create temporary tablespace tempgroup tempfile 'G:\oracle\oradata\orcl11g\tempgroup.dbf' size 10m tablespace group tempgroup
*
第 1 行出现错误:
ORA-10918: TABLESPACE GROUP name cannot be the same as tablespace name

6、反之,如果组中无任何成员,则临时表空间组自动消失
SQL> select * from dba_tablespace_groups;

GROUP_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
GROUP2                         TEMP1
TEMPGROUP                      TEMP2

SQL> drop tablespace temp1 including contents and datafiles;

表空间已删除。

SQL> select * from dba_tablespace_groups;

GROUP_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
TEMPGROUP                      TEMP2

7、临时表空间组可以分派给一个用户
SQL> alter user lf temporary tablespace tempgroup;

用户已更改。

8、临时表空间组也可以在数据库层面设定为默认临时表空间
SQL> alter database default temporary tablespace tempgroup;

数据库已更改。

属于默认表空间组的数据文件都不能删除
SQL> drop tablespace temp2 including contents and datafiles;
drop tablespace temp2 including contents and datafiles
*
第 1 行出现错误:
ORA-10921: Cannot drop tablespace belonging to default temporary tablespace
group

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24996904/viewspace-768409/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24996904/viewspace-768409/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值