当前位置:网站首页>Oracle has a weird temporary table space shortage problem
Oracle has a weird temporary table space shortage problem
2022-07-31 00:33:00 【bisal (Chen Liu)】
A friend said their stress testing application,It was normal for the past few days,When executed yesterday,报了如下错误,But it didn't show up today,DBASay something about themSQLTakes up too much temporary table space,It was expanded yesterday10个GTemporary tablespace capacity,
ORA-01652: 无法通过 128 (在表空间 TEMP 中)扩展 temp 段
Because some internal data is involved,So some of the content is written in words,不截图了.
猜测1:SQL导致临时表空间不足?
Check out this oneSQL,500多行,大量使用了dblink,But look at the execution plan,Although the temporary segment space is used,The cost consumption is not large,And the phenomenon is that this problem only occurred yesterday,很难下定论,就是这条SQL导致的.
Oracle的alert.log中会对ORA-01652Wrong content recordtrace日志,看了一些,Found out that there is a lot involvedSQL,不仅是上述DBAthis feedback.Description in this time period,很多SQL都受影响.
猜测2:The user used another temporary tablespace?
Because the user can specify a different temporary table space,Is it possible that the user is not using the default one,The expansion is the default temporary tablespace?
通过检索dba_users,The user is using the default temporary tablespaceTEMP,And the database has only one temporary tablespace.
猜测3:Even if the temporary table space is expanded,确实不够?
Look at the cost of the current table space,发现TEMPTemporary tablespaces only300多MB,按上面说的,扩容过10G,现在的容量,应该至少10G以上.
我们还是从alert.logLook for some clues in the log.
See Actions to perform scaling,有以下几种,
(1) 第1条"扩容"操作
alter tablespace TEMP add datafile '/oradata/xxx/temp01.dbf' size 5G autoextend on maxsize unlimited
ORA-3217 signalled during: alter tablespace TEMP add datafile '/oradata/xxx/temp01.dbf' size 5G autoextend on maxsize unlimited
ORA-3217解释如下,很明显,There is a syntax error in the operation to increase the temporary tablespace,Therefore, the expansion failed,
03217, 00000, "invalid option for alter of TEMPORARY TABLESPACE"
// *Cause: invalid option for alter of temporary tablespace was specified
// *Action: Specify one of the valid options: ADD TEMPFILE,
// TEMPFILE ONLINE, TEMPFILE OFFLINE
(2) 第2条"扩容"操作
alter tablespace tempfile add datafile '/oradata/xxx/temp01.dbf' size 5G autoextend on maxsize unlimited
ORA-959 signalled during: alter tablespace tempfile add datafile '/oradata/xxx/temp01.dbf' size 5G autoextend on maxsize unlimited
ORA-959解释如下,不存在tempfileA temporary tablespace of this name,
00959, 00000, "tablespace '%s' does not exist"
// *Cause:
// *Action:
(3) 第3条"扩容"操作
alter database datafile '/oradata/xxx/temp01.dbf' autoextend on
ORA-1516 signalled during: alter database datafile '/oradata/xxx/temp01.dbf' autoextend on
alter database datafile '/oradata/xxx/temp02.dbf' autoextend on
ORA-1516 signalled during: alter database datafile '/oradata/xxx/temp02.dbf' autoextend on
ORA-1516解释如下,The syntax in the first half is wrong,
01516, 00000, "nonexistent log file, data file, or temporary file \"%s\" in the current container"
// *Cause: An attempt was made to use ALTER DATABASE to rename
// a log file, data file, or temporary file; or to change attributes
// of a data file or temporary file (for example, resize, autoextend,
// online or offline); or to re-create or move a data file.
// The attempt failed because the specified file
// is not known to the database's control file
// or the current container or is not of a type
// supported by the request.
// *Action: Specify the name or number of an existing file
// of the correct type, as appropriate.
// Check the relevant V$ table for a list of possible files.
(4) 第4条"扩容"操作
alter tablespace temp add tempfile '/oradata/xxx/temp01.dbf' size 5G
ORA-1537 signalled during: alter tablespace temp add tempfile '/oradata/xxx/temp01.dbf' size 5G
ORA-1537解释如下,temp01.dbfThe data file is the current temporary tablespaceTEMP所对应的文件,So add this file,会提示重复,
01537, 00000, "cannot add file '%s' - file already part of database"
// *Cause: During CREATE or ALTER TABLESPACE, a file being added is already
// part of the database.
// *Action: Use a different file name.
Several operations to increase the temporary tablespace,It was not added due to various reasons,until this is executed,
alter tablespace temp add tempfile '/oradata/xxx/temp02.dbf' size 10G
Completed: alter tablespace temp add tempfile '/oradata/xxx/temp02.dbf' size 10G
So before adding success,Guess indeed the temporary tablespace is insufficient,Because many applications share this temporary table space,So affectedSQL应该有很多,And this application feedback statement,只是其中之一,When the addition is successful,才会恢复正常,从alert.log看,It is true that this exception is no longer thrown.
但是,既然增加了10G的空间了,Why start searching,Temporary tablespace capacity only300MB?还是从alert.log找线索,He implemented this,for temporary tablespaces
alter tablespace temp shrink space
Completed: alter tablespace temp shrink space
之前理解,Generally, it can only be done on the tableshrink space,Play the role of shrinking space,But this is performed on the tablespace,Actually official documentation,This operation is mentioned,特意指出"Shrink the amount of space a temporary tablespace or a temp file is taking",Only works on temporary tablespaces,
SHRINK SPACE Clause
This clause is valid only for temporary tablespaces. It lets you reduce the amount of space the tablespace is taking. In the optional KEEP clause, the size_clause defines the lower bound that a tablespace can be shrunk to. It is the opposite of MAXSIZE for an autoextensible tablespace. If you omit the KEEP clause, then the database will attempt to shrink the tablespace as much as possible as long as other tablespace storage attributes are satisfied
Managing Space in a Temporary Tablespace: Example
The following statement manages the space in the temporary tablespace created in "Creating a Temporary Tablespace: Example" using the SHRINK SPACE clause. The KEEP clause is omitted, so the database will attempt to shrink the tablespace as much as possible as long as other tablespace storage attributes are satisfied.ALTER TABLESPACE temp_demo SHRINK SPACE;
P.S.https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_3002.htm#SQLRF01002
因此,The capacity of the temporary tablespace is actually shrunk.
针对这个案例,There is still a lot to learn from,当出现问题时,Except for some conventional judgment paths,You can also take a guess,one by one.
如果您认为这篇文章有些帮助,还请不吝点下文章末尾的"点赞"和"在看",或者直接转发pyq,
近期更新的文章:
《You know there are several types of rain?》
近期的热文:
文章分类和索引:
边栏推荐
- .NET Cross-Platform Application Development Hands-on Tutorial | Build a Kanban-style Todo App with Uno Platform
- Consistency and Consensus of Distributed Systems (1) - Overview
- redis学习
- How to ensure the consistency of database and cache data?
- The difference between h264 and h265 decoding
- 【Yugong Series】July 2022 Go Teaching Course 013-Constants, Pointers
- MySQL数据库(基础)
- MySQL数据库约束,表的设计
- Oracle一个诡异的临时表空间不足的问题
- 【深入浅出玩转FPGA学习14----------测试用例设计2】
猜你喜欢
binglog日志追踪:数据备份并备份追踪
Steven Giesel 最近发布了一个由5部分内容组成的系列,记录了他首次使用 Uno Platform 构建应用程序的经验。
Understand from the 11 common examples of judging equality of packaging types in the written test: packaging types, the principle of automatic boxing and unboxing, the timing of boxing and unboxing, a
MySQL的触发器
什么是Promise?Promise的原理是什么?Promise怎么用?
从笔试包装类型的11个常见判断是否相等的例子理解:包装类型、自动装箱与拆箱的原理、装箱拆箱的发生时机、包装类型的常量池技术
binglog log tracking: data backup and backup tracking
Kotlin协程:协程上下文与上下文元素
Neural Network (ANN)
Error occurred while trying to proxy request The project suddenly can't get up
随机推荐
Shell programming of conditional statements
Add text watermark to PHP image
【愚公系列】2022年07月 Go教学课程 015-运算符之赋值运算符和关系运算符
WEB安全基础 - - -漏洞扫描器
DNS resolution process [visit website]
ES6中 async 函数、await表达式 的基本用法
How to import game archives in joiplay emulator
【Multithreading】
Kotlin协程:协程上下文与上下文元素
Regular expression password policy and regular backtracking mechanism bypass
MySQL笔记下
What are the efficient open source artifacts of VSCode
joiplay模拟器如何导入游戏存档
MySQL triggers
Jmeter参数传递方式(token传递,接口关联等)
VSCode高效开源神器有哪些
How to Repair Word File Corruption
xss绕过:prompt(1)
【c语言课程设计】C语言校园卡管理系统
background对float的子元素无效