我們可以通過下面的語句來查詢數據庫的默認臨時表空間:
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
oracle 默認臨時表空間
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.