Oracle principle: operation mode of temporary table space

The temporary table space is used to store the user's temporary data, which is allowed to be overwritten. After the database is closed, the data in the temporary table space will be automatically deleted. In the dedicated connection mode, a user process corresponds to a server process. The temporary table space is on the hard disk, and the data retrieved from the SQL query is placed in the PGA (Program Global Area) and also in the server memory. For example, when the user executes SQL for sorting, the temporary table space is used for sorting. For example, the SQL statement: select * from ab order by a.col1 ,b.col2 desc.

Oracle will sort the queried data in the PGA. If there is too much data and the server memory is not enough to support the sorting, it will divide the queried data into multiple copies and place each copy in a temporary table space for sorting. Therefore, if the PGA is too small or the data is too large, it may cause more interaction with the external disk, resulting in a decrease in efficiency

A temporary table space group is composed of one or more temporary table spaces. Temporary table space cannot be explicitly created or deleted.

Query table space select * from dba_tablespaces.. As long as the value of the field CONTENTS is TEMPORARY, it is a temporary table space

Query all data files: select * from dba_data_files; You can query the storage location of the table space, except for temporary tables.

Query temporary table data files: select * from dba_temp_files;

Query the temporary tablespace group: select * from dba_tablespace_groups;;

Query the default temporary table space: select * from database_properties where PROPERTY_NAME='DEFAULT_TEMP_TABLESPACE';

Create a temporary table space:

create temporary tablespace temp2 tempfile 
'D:\ORACLE\ORADATA\ORCL\TEMP2_01.dbf' size 10m autoextend on
tablespace group temp_grp;

Table space change group: alter tablespace <tablename> tablespace group <groupname>.. --When groupname :='', remove the group.

Assign temporary files to the temporary table space: alter tablespace <spacename> add tempfile'<path/file name.dbf>' size [100m] autoextend on;

 

Modify the
default temporary tablespace : alter database default temporary tablespace [groupname or spacename]

Guess you like

Origin blog.csdn.net/superSmart_Dong/article/details/107347110