Create and modify temporary tablespace of oralce

Source: Internet
Author: User

Create and modify temporary tablespace of oralce
A temporary tablespace is a disk space used to store the temporary data generated when you execute the order by lamp statement for sorting or summarizing. By default, all users use temp as the default temporary tablespace. However, other temporary tablespace can be used as the default temporary tablespace, which must be specified when the user is created.
When creating a temporary tablespace, you must use the temprary keyword. The temporary tablespace corresponds to a temporary file, which is specified by the tempfile keyword. That is to say, data files are no longer used in the temporary tablespace, but temporary files are used.

As follows:
SQL> create temporary tablespace mytemp tempfile 'f: \ oracledata \ mytemp. dbf' size 5 m autoextend on next 2 m maxsize 20 m;

The tablespace has been created.
In this case, you can find the mytemp. dbf file in the oracledata directory of drive F.

SQL> select tablespace_name,status from dba_tablespaces;TABLESPACE_NAME STATUS------------------------------ ---------SYSTEM ONLINESYSAUX ONLINEUNDOTBS1 ONLINETEMP ONLINEUSERS ONLINETEMPGROUP ONLINETEMPGROUP02 ONLINEMYBIGSPACE ONLINEBLOCKSPACE ONLINEINSPUR ONLINETESTSPACE ONLINETEST ONLINEMYTEMP ONLINE

12 rows have been selected.

In this case, we can find the MYTEMP tablespace in our tablespace.

Modify temporary tablespace
After creating a temporary tablespace, you can modify the tablespace. Because temporary files do not store permanent data and temporary data generated during operations such as knowledge storage sorting, the data stored in the temporary files is deleted by the system after the User Creation operation is complete, therefore, you do not need to adjust the temporary tablespace. However, when there are a large number of users and complicated operations, the temporary tablespace may be insufficient. In this case, the data administrator can add temporary files to increase the temporary tablespace.
To add or remove temporary files, use the add tempfile clause.
To modify the size of a temporary file, you can use the resize keyword.
You can also change the Temporary File status to offline or online.

SQL> select file#,status,name from v$tempfile;FILE# STATUS NAME-----------------------------------------------------------------------------------------------1 ONLINE D:\ORACLE\ORADATA\ORACLE12C\TEMP01.DBF2 ONLINE D:\ORACLE\ORADATA\ORACLE12C\PDBSEED\PDBSEED_TEMP012015-01-03_05-20-33-PM.DBF3 ONLINE D:\ORACLE\ORADATA\ORACLE12C\PDBORCL\PDBORCL_TEMP012015-01-03_05-44-35-PM.DBF4 ONLINE F:\ORACLEDATA\MYTEMP.DBF6 ONLINE F:\ORACLEDATA\TEMPGROUP01.DBF7 ONLINE F:\ORACLEDATA\TEMPGROUP02.DBF

You have selected 6 rows.

SQL> alter tablespace mytemp add tempfile 'f: \ oracledata \ mytemp2.dbf' size 10 m;

The tablespace has been changed.
SQL> select file#,status,name from v$tempfile;FILE# STATUS NAME----------------------------------------------------------------------------------------------1 ONLINE D:\ORACLE\ORADATA\ORACLE12C\TEMP01.DBF2 ONLINE D:\ORACLE\ORADATA\ORACLE12C\PDBSEED\PDBSEED_TEMP012015-01-03_05-20-33-PM.DBF3 ONLINE D:\ORACLE\ORADATA\ORACLE12C\PDBORCL\PDBORCL_TEMP012015-01-03_05-44-35-PM.DBF4 ONLINE F:\ORACLEDATA\MYTEMP.DBF5 ONLINE F:\ORACLEDATA\MYTEMP2.DBF6 ONLINE F:\ORACLEDATA\TEMPGROUP01.DBF7 ONLINE F:\ORACLEDATA\TEMPGROUP02.DBF

As shown above, a mytemp2.dbf file is generated under the oracledata folder of drive F.

The above articles are from the learning records.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.