12C關於CDB、PDB 臨時temp表空間的總結
官方文件
1、每個容器都有屬於的自己的temp表空間,PDB不共享CDB的temp表空間,CDB有自己的temp表空間,每個PDB也有自己的tmep表空間
2、當前容器下建立的tempfile只屬於當前容器的temp表空間, 也就是說CDB下建立的tempfile只屬於CDB,某個PDB建立的tempfile只屬於這個PDB自己
3、 當前容器 可以刪除CDB和任意PDB的tempfile,也就是說CDB可以刪除任意PDB的tempfile,PDB也可以刪除CDB和任意PDB的tempfile
4、我們平時所說的temp表空間不做特殊說明就是指共享臨時表空間,12.2開始引入了"本地臨時表空間"的概念,"本地臨時表空間"必須是BIGFILE表空間並且不支援tablespace groups表空間組的形式,幾乎很少情況下會用到"本地臨時表空間",一般沒什麼大用,主要用於Oracle Real Application ClustersOr和acle Flex Clusters
5、CDB和任意PDB都可以建立本地臨時表空間,建立本地臨時表空間和建立普通臨時表空間語法上沒什麼區別,就是TEMPORARY TABLESPACE前面多一個"local",後面多一個"FOR ALL"或"FOR LEAF"
6、臨時檔案不能被備份並且沒有任何redo資訊產生,因此RMAN不會還原或恢復臨時檔案
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
4 POCP2 READ WRITE NO
5 POCP999 READ WRITE NO
SQL> select FILE_NAME,CON_ID from cdb_temp_files;
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_root1.dbf 1
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_2.dbf 4
/u02/data/test/temp_pocp999.dbf 5
/u02/data/test/temp_pocp999_02.dbf 5
SQL> alter tablespace temp add tempfile '/u02/data/test/temp_root1_2.dbf' size 10M;
SQL> select FILE_NAME,CON_ID from cdb_temp_files; --當前CDB新增加的tempfile只能加入當前CDB
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_root1.dbf 1
/u02/data/test/temp_root1_2.dbf 1
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_2.dbf 4
/u02/data/test/temp_pocp999.dbf 5
/u02/data/test/temp_pocp999_02.dbf 5
SQL> alter session set container=POCP2;
SQL> alter tablespace temp add tempfile '/u02/data/test/temp_pocp2_3.dbf' size 10M;
SQL> select FILE_NAME,CON_ID from cdb_temp_files;--當前PDB新增加的tempfile只能加入當前PDB
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_2.dbf 4
/u02/data/test/temp_pocp2_3.dbf 4
SQL> alter session set container=CDB$ROOT;
SQL> select FILE_NAME,CON_ID from cdb_temp_files;
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_root1.dbf 1
/u02/data/test/temp_root1_2.dbf 1
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_2.dbf 4
/u02/data/test/temp_pocp2_3.dbf 4
/u02/data/test/temp_pocp999.dbf 5
/u02/data/test/temp_pocp999_02.dbf 5
SQL> alter tablespace temp drop tempfile '/u02/data/test/temp_pocp2_2.dbf';--CDB可以刪除PDB的tempfile
SQL> select FILE_NAME,CON_ID from cdb_temp_files;
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_root1.dbf 1
/u02/data/test/temp_root1_2.dbf 1
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_3.dbf 4
/u02/data/test/temp_pocp999.dbf 5
/u02/data/test/temp_pocp999_02.dbf 5
SQL> alter session set container=POCP2;
SQL> alter tablespace temp drop tempfile '/u02/data/test/temp_root1_2.dbf'; --PDB可以刪除CDB的tempfile
SQL> select FILE_NAME,CON_ID from cdb_temp_files;
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_3.dbf 4
SQL> alter session set container=CDB$ROOT;
SQL> select FILE_NAME,CON_ID from cdb_temp_files;
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_root1.dbf 1
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_3.dbf 4
/u02/data/test/temp_pocp999.dbf 5
/u02/data/test/temp_pocp999_02.dbf 5
SQL> alter session set container=pocp2;
SQL> alter tablespace temp drop tempfile '/u02/data/test/temp_pocp999_02.dbf';
--PDB可以刪除其他PDB的tempfile
SQL> alter session set container=CDB$ROOT;
SQL> select FILE_NAME,CON_ID from cdb_temp_files;
FILE_NAME CON_ID
-------------------------------------------------- ----------
/u02/data/test/temp_root1.dbf 1
/u02/data/test/temp_pocp2.dbf 4
/u02/data/test/temp_pocp2_3.dbf 4
/u02/data/test/temp_pocp999.dbf 5
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> CREATE LOCAL TEMPORARY TABLESPACE for leaf temp_local tempfile '/u02/data/test/temp_local_root1.dbf' size 10M;
CREATE LOCAL TEMPORARY TABLESPACE for leaf temp_local tempfile '/u02/data/test/temp_local_root1.dbf' size 10M
*
ERROR at line 1:
ORA-32778: DDL operations are disabled on local temporary tablespaces FOR LEAF.
SQL> CREATE LOCAL TEMPORARY TABLESPACE for all temp_local tempfile '/u02/data/test/temp_local_root1.dbf' size 10M;
Tablespace created.
SQL> select tablespace_name,extent_management,bigfile,shared,con_id from cdb_tablespaces where contents='TEMPORARY';
TABLESPACE_NAME EXTENT_MAN BIG SHARED CON_ID
------------------------------ ---------- --- ------------- ----------
TEMP LOCAL NO SHARED 1
TEMP_LOCAL LOCAL YES LOCAL_ON_ALL 1
TEMP LOCAL NO SHARED 4
TEMP LOCAL NO SHARED 5
SQL> select file_name,tablespace_name,shared,inst_id,con_id from cdb_temp_files;
FILE_NAME TABLESPACE_NAME SHARED INST_ID CON_ID
---------------------------------------- --------------- ------------- ---------- ----------
/u02/data/test/temp_local_root1.dbf_1 TEMP_LOCAL LOCAL_ON_ALL 1 1
/u02/data/test/temp_root1.dbf TEMP SHARED 1
/u02/data/test/temp_pocp2.dbf TEMP SHARED 4
/u02/data/test/temp_pocp2_3.dbf TEMP SHARED 4
/u02/data/test/temp_pocp999.dbf TEMP SHARED 5
SQL> alter session set container=pocp2;
SQL> CREATE LOCAL TEMPORARY TABLESPACE for all temp_local_pocp2 tempfile '/u02/data/test/temp_local_pocp2_1.dbf' size 10M;
Tablespace created.
SQL> select file_name,tablespace_name,shared,inst_id,con_id from cdb_temp_files;
FILE_NAME TABLESPACE_NAME SHARED INST_ID CON_ID
---------------------------------------- -------------------- ------------- ---------- ----------
/u02/data/test/temp_local_pocp2_1.dbf_1 TEMP_LOCAL_POCP2 LOCAL_ON_ALL 1 4
/u02/data/test/temp_pocp2.dbf TEMP SHARED 4
/u02/data/test/temp_pocp2_3.dbf TEMP SHARED 4
Starting with Oracle Database 12c Release 2 (12.2), local temporary tablespaces are available. A local temporary tablespace stores separate, non-shared temp files for every database instance. A local temporary tablespace is used only for spilling temporary results of SQL statements, such as queries that involve sorts, hash aggregations, and joins. These results are only accessible within an instance. In contrast, a shared temporary tablespace resides on a shared disk and is available to all instances. To create a local temporary tablespace, use a CREATE LOCAL TEMPORARY TABLESPACE statement. Shared temporary tablespaces were available in prior releases of Oracle Database and were called "temporary tablespaces." In this Oracle Database Administrator’s Guide, the term "temporary tablespace" refers to a shared temporary tablespace unless specified otherwise.
Note:Local temporary tablespaces are new in Oracle Database 12c Release 2 (12.2). In previous releases, shared temporary tablespaces were simply called temporary tablespaces. Starting in this release, the term temporary tablespace refers to a shared temporary tablespace unless specified otherwise.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2675527/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 12C關於CDB、PDB 回滾undo表空間的總結
- Oracle Temp 臨時表空間Oracle
- Oracle TEMP臨時表空間概念Oracle
- 12C關於CDB、PDB建立AWR的方法和總結
- Oracle Temp臨時表空間處理Oracle
- 12C關於CDB、PDB引數的區別和總結
- 有關temp表空間的一點總結!
- 臨時表空間操作總結
- ORACLE臨時表空間總結Oracle
- 12C關於CDB、PDB 日誌檔案redo log的總結
- Oracle基礎 02 臨時表空間 tempOracle
- mysql關於臨時表的總結MySql
- 【TEMP】臨時表空間的工作原理及維護方法
- mysql關於表空間的總結MySql
- oracle臨時表空間相關Oracle
- Sqlserver 關於臨時表和表變數的總結SQLServer變數
- Oracle 12c 新特性 - 臨時表undo(TEMP UNDO)Oracle
- Oracle 11g中Temp臨時表空間、檔案的新特性Oracle
- 關於排序、sort_area_size、臨時表空間(轉)排序
- oracle的臨時表空間Oracle
- 臨時表空間的建立、刪除,設定預設臨時表空間
- 12C多租戶關於CDB、PDB的常用SQL語句SQL
- 關於oracle可傳輸表空間的總結Oracle
- oracle 臨時表空間Oracle
- oracle臨時表空間Oracle
- 關於移動臨時表空間檔案位置的問題
- Oracle臨時表空間檢視、新增臨時表空間資料檔案、修改預設臨時表空間 方法!Oracle
- 臨時表空間temporary tablespace相關操作
- oracle temp 表空間Oracle
- oracle 12c PDB隨CDB啟動和連結PDB的方式Oracle
- 【臨時表空間組】臨時表空間組的建立、維護及應用
- 關於oracle的表空間,分割槽表,以及索引的總結Oracle索引
- 批量處理時臨時增加回滾表空間臨時表空間檔案
- Oracle 臨時表空間的概念Oracle
- ORACLE臨時表空間的清理Oracle
- mysql臨時表,臨時表空間,ibtmp1表空間暴增原因初探MySql
- Oracle 臨時表空間概念Oracle
- oracle臨時表空間組Oracle