oracle 默认临时表空间

   我们可以通过下面的语句来查询数据库的默认临时表空间:
  
  SQL> select * from database_properties where property_name = 'DEFAULT_TEMP_TABLESPACE';
   
   默认临时表空间的限制:
  
  1. 默认临时表空间必须是TEMPORARY的:
  
  SQL> alter database default temporary tablespace tools;
  
  alter database default temporary tablespace tools
  
  *
  
  ERROR at line 1:
  
  ORA-12902: default temporary tablespace must be SYSTEM or of TEMPORARY type
  
   2. 默认临时表空间一旦被指定,将无法在改成PERMANET:
  
  SQL> alter tablespace temp2 permanent;
  
  alter tablespace temp2 permanent
  
  *
  
  ERROR at line 1:
  
  ORA-12904: default temporary tablespace cannot be altered to PERMANENT type
  
  3. 在删除默认临时表空间必须先重新指定默认临时表空间:
  
  SQL> drop tablespace temp including contents and datafiles;
  
  drop tablespace temp including contents and datafiles
  
  *
  
  ERROR at line 1:
  
  ORA-12906: cannot drop default temporary tablespace
  
  SQL> create tablespace TEMP2
  
   2 datafile '/data1/ora9data/temp2_01.dbf' 
  
   3 size 100k TEMPORARY;
  
  Tablespace created.
  
  SQL> alter database default temporary tablespace TEMP2;
  
  Database altered.
  
  SQL> drop tablespace temp including contents and datafiles;
  
  Tablespace dropped.
  
   4. 默认临时表空间无法OFFLINE:
  
  SQL> alter tablespace temp offline;
  
  alter tablespace temp offline
  
  *
  
  ERROR at line 1:
  
  ORA-12905: default temporary tablespace cannot be brought OFFLINE
  
   5. 用户的临时表空间必须是TEMPORARY的(在9i之前没有这个限制,可以是PERMANENT): 
  
  SQL> alter user scott temporary tablespace TOOLS;
  
  alter user scott temporary tablespace TOOLS
  
  *
  
  ERROR at line 1:
  
  ORA-12911: permanent tablespace cannot be temporary tablespace
  
  SQL> create tablespace temp2 
  
   2 datafile '/data1/ora9data/temp2_01.dbf' 
  
   3 size 100k temporary;
  
  Tablespace created.
  
  SQL> alter user scott temporary tablespace temp2;
  
  User altered.
  
   6. 假如删除了用户的临时表空间,而这个临时表空间又不是数据库的默认临时表空间(假如是数据库的默认临时表空间是删不掉的),用户的临时表空间不会自动转换到数据库的默认临时表空间上:
  
  SQL> select tablespace_name, contents from dba_tablespaces where tablespace_name like 'TEMP%';
  
  
  
  SQL> drop tablespace TEMP2 including contents and datafiles;

  
  Tablespace dropped.
  
  SQL> select TEMPORARY_TABLESPACE from dba_users where username='SCOTT';
  
  TEMPORARY_TABLESPACE
  
  ------------------------------
  
  TEMP2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值