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表空間的總結
- 12C關於CDB、PDB建立AWR的方法和總結
- 12C關於CDB、PDB引數的區別和總結
- 12C關於CDB、PDB 日誌檔案redo log的總結
- 12C關於CDB、PDB的官方解釋
- mysql關於臨時表的總結MySql
- mysql關於表空間的總結MySql
- oracle臨時表空間相關Oracle
- Sqlserver 關於臨時表和表變數的總結SQLServer變數
- oracle temp 表空間Oracle
- 12C多租戶關於CDB、PDB的常用SQL語句SQL
- oracle 12c PDB隨CDB啟動和連結PDB的方式Oracle
- Oracle臨時表空間檢視、新增臨時表空間資料檔案、修改預設臨時表空間 方法!Oracle
- 【12c cdb pdb】實驗
- mysql臨時表,臨時表空間,ibtmp1表空間暴增原因初探MySql
- Oracle 12C RMAN備份佔用大量臨時表空間Oracle
- Oracle Temp 表空間切換Oracle
- 4.2.1.8規劃臨時表空間
- 刪除臨時表空間組
- MySQL InnoDB臨時表空間配置MySql
- [20181108]with temp as 建立臨時表嗎.txt
- 消除臨時表空間暴漲的方法
- ORACLE臨時表總結Oracle
- 2.5.7 建立預設臨時表空間
- MySQL 5.7 新特性 共享臨時表空間及臨時表改進MySql
- oracle建立臨時表空間和資料表空間以及刪除Oracle
- 臨時表空間和回滾表空間使用率查詢
- oracle 臨時表空間的增刪改查Oracle
- Oracle 12c 新特性之臨時Undo--temp_undo_enabledOracle
- oracle11g 查詢臨時表空間的使用率和正在使用臨時表空間的使用者Oracle
- SQLServer如何釋放tempdb臨時表空間SQLServer
- Oracle臨時表的用法總結FLOracle
- 臨時表空間被佔滿的原因查詢
- 2.5.4.1 關於SYSAUX表空間UX
- 檢視temp表空間的消耗明細情況
- MYSQL造資料佔用臨時表空間MySql
- 【BAK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(三)CDB與PDB的備份方式Oracle
- 【ASK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(一)什麼是CDB與PDB?Oracle