国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

數據庫默認臨時表空間

2024-07-21 02:38:45
字體:
來源:轉載
供稿:網友

  數據庫默認臨時表空間
  
  作者:gototop
  
   在9i之前,假如一個數據庫用戶沒有被指定默認臨時表空間,那么Oracle就會使用system表空間作為該用戶的臨時表空間,這是很危險的。在9i里面,database可以被指定一個默認臨時表空間。這樣假如數據庫用戶沒有被明確指定臨時表空間,oracle 9i就會自動指定database的默認臨時表空間作為該用戶的臨時表空間。
  
   我們可以通過下面的語句來查詢數據庫的默認臨時表空間:
  
  SQL> select * from database_PRoperties where property_name = 'DEFAULT_TEMP_TABLESPACE';
  
  PROPERTY_NAME PROPERTY_VALUE DESCRipTION
  
  --------------------- ------------------- ------------------------
  
  DEFAULT_TEMP_TABLESPACE TEMP Name of default temporary 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%';
  
   TABLESPACE_NAME CONTENTS
  
   ------------------------------ ---------
  
   TEMP TEMPORARY
  
   TEMP2 TEMPORARY
  
   SQL> select TEMPORARY_TABLESPACE from dba_users where username='SCOTT';
  
   TEMPORARY_TABLESPACE
  
   ------------------------------
  
   TEMP2
  
   SQL> drop tablespace TEMP2 including contents and datafiles;
  
   Tablespace dropped.
  
   SQL> select TEMPORARY_TABLESPACE from dba_users where username='SCOTT';
  
   TEMPORARY_TABLESPACE
  
   ------------------------------
  
   TEMP2

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 朝阳市| 宁强县| 太保市| 五寨县| 临武县| 湛江市| 商南县| 黄浦区| 哈巴河县| 云南省| 皋兰县| 玛曲县| 高密市| 黄骅市| 泰顺县| 垦利县| 廉江市| 蚌埠市| 阜阳市| 乐都县| 临桂县| 金华市| 建昌县| 会理县| 安溪县| 雅江县| 峡江县| 鄂伦春自治旗| 通许县| 定边县| 西乌珠穆沁旗| 股票| 白城市| 扬州市| 丰原市| 晋州市| 西吉县| 印江| 仁化县| 南丹县| 廊坊市|