TEMPORARY Tablespaces and TEMPFILES

Debezium报错处理系列之二十八: Expiring 1 record(s) for test-ts-0:120001 ms has passed since batch creation 阅读详情
What are Temporary Tablespaces:

Temporary tablespaces are used to manage space for database sortoperations and for storing global temporary tables. For example, ifyou join two large tables, and Oracle cannot do the sort in memory(see SORT_AREA_SIZE initialisation parameter), space will beallocated in a temporary tablespace for doing the sort operation.Other SQL operations that might require disk sorting are: CREATEINDEX, ANALYZE, Select DISTINCT, ORDER BY, GROUP BY, UNION,INTERSECT, MINUS, Sort-Merge joins, etc.

The DBA should assign a temporary tablespace to each user in thedatabase to prevent them from allocating sort space in the SYSTEMtablespace. This can be done with one of the followingcommands:

SQL> CREATE USER scott DEFAULT TABLESPACE data TEMPORARY TABLESPACE temp;

SQL> ALTER USER scott TEMPORARY TABLESPACE temp;

Note that a temporary tablespace cannot contain permanentobjects and therefore doesn't need to be backed up.

What are TEMPFILES?

Unlike normal data files, TEMPFILEs are not fully initialised(sparse). When you create a TEMPFILE, Oracle only writes to theheader and last block of the file. This is why it is much quickerto create a TEMPFILE than to create a normal database file.

TEMPFILEs are not recorded in the database's control file. Thisimplies that one can just recreate them whenever you restore thedatabase, or after deleting them by accident. This opensinteresting possibilities like having different TEMPFILEconfigurations between permanent and standby databases, orconfigure TEMPFILEs to be local instead of shared in a RAC(RAC是Oracle Real ApplicationCluster的简写,官方中文文档一般翻译为“真正应用群集”,它一般由两台或者两台以上同构计算机及共享存储设备构成,可提供强大的资料库处理能力,现在是Oracle10g Grid应用的重要组成部分) environment.

One cannot remove datafiles from a tablespace until you drop theentire tablespace. However, one can remove a TEMPFILE from adatabase. Look at his example:

SQL> ALTER DATABASE TEMPFILE'/oradata/temp02.dbf' DROP INCLUDING DATAFILES;

If you remove all tempfiles from a temporary tablespace, you mayencounter error: ORA-25153: Temporary Tablespace is Empty. Use thefollowing statement to add a TEMPFILE to a temporarytablespace:

SQL> ALTER TABLESPACE temp ADD TEMPFILE'/oradata/temp03.dbf' SIZE 100M;

Except for adding a tempfile, as illustrated in the aboveexample, you cannot use the ALTER TABLESPACE statement for alocally managed temporary tablespace (operations like rename, setto read only, recover, etc. will fail).

How does one create Temporary Tablespaces?

Oracle provides various ways of creating TEMPORARY tablespaces(mainly to provide backward compatibility). One should use the mostrecent method available:

- Prior to Oracle 7.3 - CREATE TABLESPACE temp DATAFILE...;
- Oracle 7.3 & 8.0 - CREATE TABLESPACE tempDATAFILE ... TEMPORARY;
- Oracle 8i and above - CREATE TEMPORARY TABLESPACE temp TEMPFILE...;

Oracle 8i and 9i example:

SQL> CREATE TEMPORARY TABLESPACE temp

      TEMPFILE '/oradata/mytemp_01.tmp' SIZE 20M

      EXTENT MANAGEMENT LOCAL UNIFORM SIZE 16M;

For best performance, the UNIFORM SIZE must be a multiple of theSORT_AREA_SIZE parameter.

Oracle 9i example using OMF (Oracle Managed Files):

SQL> CREATE TEMPORARY TABLESPACEtemp;

Default Temporary Tablespaces:

In Oracle 9i and above, one can define a Default TemporaryTablespace at database creation time, or by issuing an "ALTERDATABASE" statement:

ALTER DATABASE DEFAULT TEMPORARY TABLESPACEtemp;

The default Default Temporary Tablespace is SYSTEM. Eachdatabase can be assigned one and only one Default TemporaryTablespace. Using this feature, a Temporary Tablespace isautomatically assigned to users. The following restrictions applyto default temporary tablespaces:

- The Default Temporary Tablespace must be of typeTEMPORARY
- The DEFAULT TEMPORARY TABLESPACE cannot be taken off-line
- The DEFAULT TEMPORARY TABLESPACE cannot be dropped until youcreate another one.

To see the default temporary tablespace for a database, executethe following query:

SQL> SELECT * FROM DATABASE_PROPERTIESwhere PROPERTY_NAME='DEFAULT_TEMP_TABLESPACE';

All new users that are not explicitly assigned a TEMPORARYTABLESPACE, will get the Default Temporary Tablespace as itsTEMPORARY TABLESPACE. Also, when you assign a TEMPORARY tablespaceto a user, Oracle will not change this value next time you changethe Default Temporary Tablespace for the database.

Other Considerations:

Some performance considerations for temporary tablespaces:

- Always use temporary tablespaces instead of permanent contenttablespaces for sorting (no logging and uses one large sort segmentto reduce recursive SQL and ST space management enqueuecontention).
- Ensure that you create your temporary tablespaces as locallymanaged instead of dictionary managed (Use sort space bitmapinstead of sys.fet$ and sys.uet$ for allocating space).
- Always use TEMPFILEs instead of DATAFILEs (reduce backup andrecovery time + other advantages as described above)
- Stripe your temporary tablespaces over multiple disks toalleviate possible disk contention and to speed-up sortingoperations (user processes can read/write to it directly).

Monitoring Temporary Tablespaces and Sorting:

Unlike datafiles, tempfiles are not listed in V$DATAFILE andDBA_DATA_FILES. Use V$TEMPFILE and DBA_TEMP_FILES instead.

One can monitor temporary segments from V$SORT_SEGMENT andV$SORT_USAGE

DBA_FREE_SPACE does not record free space for temporarytablespaces. Use V$TEMP_SPACE_HEADER instead:

SQL> select TABLESPACE_NAME, BYTES_USED, BYTES_FREE from V$TEMP_SPACE_HEADER;

 

TABLESPACE_NAME                BYTES_USED BYTES_FREE

------------------------------ ---------- ----------

TEMP                             52428800   52428800

 

     TEMPORARY表空间和文件

                       

TEMPORARY 表空间是用来排序操作的,比如你操作几个大表,ORACLE没有足够的内存(sort_area_size)来排序,那么ORACLE就会分配 TEMPORARY表空间来排序。一些涉及排序的操作有CREATEINDEX, ANALYZE, Select DISTINCT, ORDER BY, GROUP BY, UNION,INTERSECT, MINUS, Sort-Merge joins等。

 

DBA应该给每个用户都设置一个默认TEMPORARY TABLESPACE,以防止用SYSTEM表空间排序。TEMPORARYTABLESPACE不包括永久性表空间,因此不需要备份。

 

TEMPORARY FILE也和其他数据文件不同,ORACLE在建立TEMPORARYFILE的时候只是标记文件的头和尾,这就是为什么建立TEMPORARY FILE比数据文件快的原因。

 

和数据文件的区别1:

在STANDBY结构下甚至PERMANENT和STANDBY数据库可以有不同的TEMPFILE,RAC结构下也可以每个节点配置各自的TEMPFILE。

 

和数据文件的区别2:

一个DATA表空间包含多个DATA FILE的情况下,不能单独删除其中的一个DATAFILE。但TEMPFILE可以。

SQL> select file_name||''||tablespace_name from dba_temp_files
  2  /

FILE_NAME||''||TABLESPACE_NAME
--------------------------------------------------------------------------------
D:\ORACLE\ORADATA\SVW\TEMP01.DBF TEMP

SQL> create temporary tablespacetemptest tempfile 'D:\ORACLE\ORADATA\SVW\TEMPtest.dmp' size10M
  2  /

Tablespace created.

 

  1* alter tablespace temptest addtempfile 'D:\ORACLE\ORADATA\SVW\TEMPTEST01.DMP' SIZE 10m
SQL> /

Tablespace altered.

SQL>  selectfile_name||' '||tablespace_name from dba_temp_files
  2  /

FILE_NAME||''||TABLESPACE_NAME
----------------------------------------------------------------
D:\ORACLE\ORADATA\SVW\TEMP01.DBF TEMP
D:\ORACLE\ORADATA\SVW\TEMPTEST.DMP TEMPTEST
D:\ORACLE\ORADATA\SVW\TEMPTEST01.DMP TEMPTEST

 

SQL> ALTER DATABASE TEMPFILE'/oradata/temp02.dbf' DROP INCLUDING DATAFILES;

SQL> ALTER DATABASE TEMPFILE'D:\ORACLE\ORADATA\SVW\TEMPTEST01.DMP' DROP INCLUDINGDATAFILES;

Database altered.

SQL> select file_name||''||tablespace_name from dba_temp_files
  2  /

FILE_NAME||''||TABLESPACE_NAME
--------------------------------------------------------------------------------
D:\ORACLE\ORADATA\SVW\TEMP01.DBF TEMP
D:\ORACLE\ORADATA\SVW\TEMPTEST.DMP TEMPTEST

 

甚至你可以删除TEMPORARY TABLESPACE下的所有 TEMPFILE

SQL> ALTER DATABASE TEMPFILE'D:\ORACLE\ORADATA\SVW\TEMPTEST.DMP' DROP INCLUDING DATAFILES;

Database altered.

SQL> select file_name||''||tablespace_name from dba_temp_files
  2  /

FILE_NAME||''||TABLESPACE_NAME
--------------------------------------------------------------------------------
D:\ORACLE\ORADATA\SVW\TEMP01.DBF TEMP

再增加TEMPFILE  

SQL> alter tablespace temptest addtempfile 'D:\ORACLE\ORADATA\SVW\TEMPTEST.DMP' size 10M;

Tablespace altered.

 

各版本语句的比较

<Oracle 7.3

     CREATE TABLESPACE temp DATAFILE ...; -

Oracle 7.3 &8.0

     CREATE TABLESPACE temp DATAFILE ...TEMPORARY;

>Oracle 8i and above

     CREATE TEMPORARY TABLESPACE temp TEMPFILE ...;

 

注意,如果加UNIFORM SIZE参数的话那么需要设置成SORT_AREA_SIZE才能达到最高性能.

 

相关语句

CREATE USER scott DEFAULT TABLESPACE data TEMPORARYTABLESPACE temp;

ALTER USER scott TEMPORARY TABLESPACE temp

 

ALTER DATABASE DEFAULT TEMPORARY TABLESPACEtemp;

 

SELECT * FROM DATABASE_PROPERTIES wherePROPERTY_NAME='DEFAULT_TEMP_TABLESPACE';

 

select TABLESPACE_NAME, BYTES_USED, BYTES_FREE fromV$TEMP_SPACE_HEADER;

CREATE TEMPORARY TABLESPACE temp
     TEMPFILE '/oradata/mytemp_01.tmp' SIZE 20M
     EXTENT MANAGEMENT LOCAL UNIFORM SIZE 16M;

 

相关表

V$TEMPFILE     

DBA_TEMP_FILES    

V$SORT_SEGMENT

V$SORT_USAGE
V$TEMP_SPACE_HEADER



数据中台:大数据平台,数据仓库(DM),数据中台之间的联系以及异同分析 大数据平台是一个技术平台。这个技术平台提供了对于大数据的分布式采集,存储,流处理和计算,实时分析等能力。在没有大数据平台前也有数据集成和管理的平台,这种平台可以实现对结构化数据本身的采集,集成和管理。 管理平台,是在原生的大数据生态的基础之上,为了更好的管理集群服务,管理集群的资源,提供灵活SRE能力和资源核算审计能力的一系列工具和合称整体架构数据中台包括数据仓库的全部内容,数据仓库为数据中台提供了数据对外提供服务的基础资源,数据中台将数据仓库建设的投入价值进行最大化,以加快数据赋能业务的速度大家都知道数据 阅读详情

相关推荐

Oracle 12c CDB 和 PDB 表空间管理和配置 说明

注:本文谢绝转载。 1  管理CDB中的表空间    CDB表空间的管理和non-CDB 表空间的管理一样,CDB 也有一个实例,在安装的时候指定。  --查看表空间:SQL> select instance_name fromv$instance;INSTANCE_NAME----------------Cndba SQL> col file_name for a50SQL> selecttab

David Dai -- Focus on Oracle 1万+

SAR型ADC的电荷重分配技术解析

本文深入解析了SAR型ADC的核心技术——电荷重分配。通过类比“猜数字”游戏,阐述了其逐次逼近的工作原理,并重点剖析了电容阵列如何实现高速、低功耗的模数转换。文章还探讨了该技术在速度、能效及集成度方面的优势,并指出了电容匹配精度等实际挑战,为嵌入式与物联网设备中的ADC选型与应用提供了实用指南。

nnn11的博客 907

临时表空间(Temporary Tablespace)相关

Temporary Tablespace Temporary Tablespace 用于存放瞬时数据,只有在session连接期间才能够看到数据。Permanentobject无法创建在temporarytablespace中。 空间利用原理: 它不会由smon来监控、回收空间。而是使用SEP(Sort Extent Pool)来记录空闲的extent。 在OracleDatabase创

renfengjun 6746

保姆级教程:在mmdetection中手动计算并可视化P、R、F1值(附完整代码)

本文提供了一份详细的mmdetection教程,指导开发者如何手动计算并可视化精确率(P)、召回率(R)和F1值。通过完整的代码示例和清晰的步骤说明,帮助用户深入理解目标检测模型的性能评估方法,特别适合需要精细分析模型表现的计算机视觉研究人员和工程师。

weixin_29038303的博客 401

GhidrAssist:AI驱动的逆向工程助手实战指南

逆向工程是分析软件内部工作原理、理解二进制代码逻辑的关键技术,广泛应用于软件安全、恶意代码分析和漏洞挖掘等领域。其核心原理在于通过反编译、控制流与数据流分析等手段,将机器码还原为可理解的高级语言表示。传统逆向分析高度依赖人工经验,面对海量代码时效率低下且易出错。随着大语言模型(LLM)技术的发展,其强大的代码理解与推理能力为自动化逆向分析提供了新的可能。通过将LLM与成熟的逆向工程框架(如Ghidra)相结合,可以构建智能辅助系统,实现代码意图的自动解释、变量/函数的智能重命名以及潜在漏洞模式的辅助识别,从

weixin_42547335的博客 596

MySQL 8.0 InnoDB Tablespaces之Temporary Tablespaces(临时表空间)

【免责声明】文章仅供学习交流,观点代表个人,与任何公司无关。编辑|SQL和数据库技术(ID:SQLplusDB)

SQLplusDB的小院 2070

STM32CubeMX配置FSMC驱动外部SRAM全流程详解

FSMC(灵活静态存储控制器)是STM32实现高速并行外部存储扩展的核心外设,其本质是将片外SRAM地址空间映射为CPU可直接读写的内存区域。原理上依赖于精确的时序寄存器配置(如BTRx)、GPIO复用功能启用及AHB3总线时钟同步机制,技术价值在于免DMA搬运的零拷贝访问能力与确定性低延迟。典型应用场景包括工业HMI缓存、医疗设备实时数据采集、嵌入式图形加速等对带宽和确定性要求严苛的系统。本文围绕STM32F407ZG平台,结合STM32CubeMX工程化配置、硬件信号完整性设计与HAL库底层映射逻辑,系

weixin_34718952的博客 232

mysql的临时表空间_临时表空间(Temporary Tablespace)相关

Temporary Tablespace 用于存放瞬时数据,只有在session连接期间才能够看到数据。Permanentobject无法创建在temporarytablespaceTemporary TablespaceTemporary Tablespace 用于存放瞬时数据,只有在session连接期间才能够看到数据。Permanentobject无法创建在temporarytablespa...

weixin_39670849的博客 686

Claude Code 错误解决方案: Request Timed Out 超时 原因、配置与解决方案

Claude Code 抛出 Request Timed Out 不仅可 能是网络问题,更大概率是 API 高负载或超大响应导致。本文从 默认超时机制出发,拆解三种根因场景,给出 API_TIMEOUT_MS 环境变量调优与任务拆分策略,帮助开发者在保证稳定性的同时 避免误判网络故障。

多媒体编程、网络编程、系统编程、网络安全编程、驱动编程 899

面向业务角色的 SAP Fiori Space 与 Page 创建全流程实战指南

业务角色导航设计:从Space与Page规划到实施 摘要:本文探讨了SAP S/4HANA Cloud和BTP ABAP环境中基于业务角色的导航设计方法。传统Fiori Launchpad的Group+Tile模式存在应用堆积问题,而新的Space与Page模型将导航按工作领域(如应付会计、销售代表)组织,每个Space包含多个任务导向的Page。文章详细介绍了从业务角色建模到Space/Page创建、分配的完整流程,包括核心概念解析、规划思路和具体操作步骤。重点阐述了如何根据业务需求选择创建方式(基于预交

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 183

Temporary tablespaces

SummarySymptom1. Why is a temporary tablespace required?2. What is the default name of the temporary tablespace in the SAP environment?3. Which types of temporary tablespaces are available?4

lvzhqi的专栏 1348

heygem本地部署报错:SQLite3 can only bind numbers, strings, bigints, buffers, and null...如何解决?

🏆本文收录于 《全栈Bug调优(实战版)》 专栏,该专栏专注于分享我在真实项目开发中遇到的各类疑难Bug及其深层成因,并系统提供高效、可复现的解决思路和实操方案。无论你是刚入行的新手开发者,还是拥有多年项目经验的资深工程师,本专栏都将为你提供一条系统化、高质量的问题排查与优化路径,助力你加速成长,攻克技术壁垒,迈向技术价值最大化与职业发展的更高峰🚀!    📌 特别说明: 文中部分技术问题来源于真实生产环境及网络公开案例,均经过精挑细选与系统化整理,并结合多位大厂资深架构师和一线开发多年实战经验沉淀,

**My Coding Family** 3246

TEMPORARY Tablespaces and TEMPFILES 详细解释

What are Temporary Tablespaces:Temporary tablespaces are used to manage space for database sort operations and for...

clep17285的博客 214

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

重建控制文件

找到最近的trace文件从中获得重建控制文件的脚本 Set #2. RESETLOGS case -- -- The following commands will create a new control file a...

cslz25498的博客 143

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

Temporary Tablespaces

In this Document   Purpose   Scope and Application   DB 11.1: Temporary Tablespaces [Video] Applies to: Oracle Server - Enterprise Edition - Version: 11.1.0.6 to 11.2.0.3 - Release: 11.1 to 11.2

weiwang的专栏 1521

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

OracleDB入门3:临时表空间(组)

本文转载于ORACLE临时表空间总结 概念 临时表空间 临时表空间用来管理数据库排序操作以及用于存储临时表、中间排序结果等临时对象,当ORACLE里需要用到SORT的时候,并且当PGA中sort_area_size大小不够时,将会把数据放入临时表空间里进行排序。像数据库中一些操作: CREATE INDEX、 ANALYZE、SELECT DISTINCT、ORDER BY、GROUP BY...

本博客纯属个人学习记载,不对外负责,若有错误,请批评指正 457

Master Note: Overview of Oracle Temporary Tablespaces (Doc ID 1498442.1)

In this Document Purpose   Details   Temporary Tablespaces   Creating a Temporary Tablespace   Altering a Temporary Tablespace

mybluetiankong的专栏 1769

052-191(新增70题2018)

Your Oracle 11g database has 6 tablespaces (view Exhibit) in which:- TEMP is the default temporary tablespace- UNDOTBS1 is the default undo tablespace- USERS is the default permanent tablespaceIn...

dieqiao8331的博客 163

Temporary Tablespace Group

A temporary tablespace group can be thought of as a shortcut for a list of temporary tablespaces.A temporary table...

145

temporary tablespace

--1、查看临时表空间 SQL> Select tablespace_name,Contents From dba_tablespaces Where Contents='TEMPORARY'; TABLESPACE_NAME                CONTENTS ------------------------------ --------- TEMP

csdn1284934570的专栏 490

mysql temporary_Mysql:Temporary Tablespaces

Global Temporary TablespaceThe global temporary tablespace (ibtmp1) stores rollback segments for changes made to user-created temporary tables.The innodb_temp_data_file_path variable defines the relat...

weixin_42619448的博客 333

Default Temporary Tablespace Using Multiple Tablespaces【每日一译】--20121101

When the SYSTEM tablespace is locally managed, you must define at least one default temporary tablespace when creating a database. A locally managed SYSTEM tablespace cannot be used for default temp

N 701

Oracle静默安装,含仅软件安装和数据库安装及常见报错处理方法DBT-10317 DBT-05509 [FATAL] ORA-03114

本文详解Oracle 19c单机版静默安装与数据库创建全流程,涵盖目录配置、响应文件编写、安装及建库命令,附常见报错(如DBT-10317、ORA-03114)解析与解决方案,包含删库指令与日志分析,适合内网环境自学实战,免费干货,实用性强。

qq_41474349的博客 177

Spring 事务详解:@Transactional 如何生效、何时回滚、传播行为怎么选

从订单与库存写入出发,拆解 @Transactional 的代理调用链、默认回滚规则与自调用问题;通过 Spring Boot + H2 的五个验证用例比较 REQUIRED、REQUIRES_NEW、NESTED,并说明数据库事务与 Redis、消息和远程接口的边界。

qq_74421990的博客 310
上一篇: perl中FTP的使用
下一篇: 局域网内sqlplus 访问主机数据库 TNS: 无监听程序
wqq_721
博客等级 码龄18年 10粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值