A tempfile is a file that is part of an Oracle database.
Tempfiles are used with TEMPORARY TABLESPACES
Temporary tablespaces are used for special operations, particularly for sorting data results on disk and for
hash joins in SQL. For SQL with millions of rows returned, the sort operation is too large for the RAM
area and must occur on disk.
The temporary tablespace is where this takes place
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> col name for a20
SQL> select name,open_mode,con_id from v$pdbs;
NAME OPEN_MODE CON_ID
-------------------- ---------- ----------
PDB$SEED READ ONLY 2
ORCLPDB READ WRITE 3
SQL> col tablespace_name for a15
SQL> select file_name,file_id,tablespace_name,con_id
from cdb_temp_files 2 ;
FILE_NAME FILE_ID TABLESPACE_NAME CON_ID
-------------------------------------------------- ---------- --------------- ----------
/u01/app/oracle/oradata/ORCL/orclpdb/temp01.dbf 3 TEMP 3
/u01/app/oracle/oradata/ORCL/temp01.dbf 1 TEMP 1
SQL>
dba_ 테이블을 통해서 자신의 컨테이너에 있는 정보만 조회
SQL> select file_name,file_id,tablespace_name
from dba_temp_files;
2
FILE_NAME FILE_ID TABLESPACE_NAME
-------------------------------------------------- ---------- ---------------
/u01/app/oracle/oradata/ORCL/temp01.dbf 1 TEMP
SQL>
컨테이너를 변경하면 dba_ 테이블을 통해서 자신의 컨테이너에 있는 정보만 조회 가능함
SQL> alter session set container=orclpdb;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
ORCLPDB
SQL> select file_name,file_id,tablespace_name
from dba_temp_files;
2
FILE_NAME FILE_ID TABLESPACE_NAME
-------------------------------------------------- ---------- ---------------
/u01/app/oracle/oradata/ORCL/orclpdb/temp01.dbf 3 TEMP
SQL>
컨테이너를 변경했으므로 cdb_ 테이블을 조회해도 자신의 컨테이너에 있는 정보만 조회 가능함
SQL> select file_name,file_id,tablespace_name,con_id
from cdb_temp_files;
2
FILE_NAME FILE_ID TABLESPACE_NAME CON_ID
-------------------------------------------------- ---------- --------------- ----------
/u01/app/oracle/oradata/ORCL/orclpdb/temp01.dbf 3 TEMP 3
SQL>
'Database > Oracle' 카테고리의 다른 글
26 - [Oracle 19C] V$containers, cdb_pdbs (0) | 2023.11.17 |
---|---|
25 - [Oracle 19C] DB name and DB version and instance name. (0) | 2023.11.17 |
23 - [Oracle 19C] To query data files (0) | 2023.11.17 |
22 - [Oracle 19C] to change container (cdb_, dba_) (0) | 2023.11.17 |
21 - [Oracle 19C] Dynamic Performance Views(v$ views) (0) | 2023.11.17 |