`
xiechangming
  • 浏览: 26659 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Run out of Temporary tablspace

阅读更多

      Once I encounter a problem that the used space of temporary tablespace always increases till out of space on production environment, an “ORA-1652: unable to extend temp segment” error rises at last which causes the application crashed. Later restart application server, the used space releases immediately, but the used space increases once application is online.


The application restarted at 8:00PM 2010/02/01, the application crashed after the usage reached 100%.
    Learn from various forums and documents, almost all of them say that this error might caused by sort operations(creating index, processing queries including ORDER BY or GROUP BY clause)  which is too large to fit in memory.
To indentify the sql statements caused the problem, I did the following queries:
--Temporary Segments
SELECT   A.tablespace_name tablespace, D.mb_total,
         SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
         D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
FROM     v$sort_segment A,
         (
         SELECT   B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total
         FROM     v$tablespace B, v$tempfile C
         WHERE    B.ts#= C.ts#
         GROUP BY B.name, C.block_size
         ) D
WHERE    A.tablespace_name = D.name
GROUP by A.tablespace_name, D.mb_total;

TABLESPACE                     MB_TOTAL                               MB_USED                                MB_FREE                               
TEMP                            4000                                   1945                                   2055                                  

--Sort Space Usage by Session
SELECT   S.sid || ',' || S.serial# sid_serial, S.username, S.osuser, P.spid, S.module,
         S.program, SUM (T.blocks) * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,
         COUNT(*) sort_ops
FROM     v$sort_usage T, v$session S, dba_tablespaces TBS, v$process P
WHERE    T.session_addr = S.saddr
AND      S.paddr = P.addr
AND      T.tablespace = TBS.tablespace_name
GROUP BY S.sid, S.serial#, S.username, S.osuser, P.spid, S.module,
         S.program, TBS.block_size, T.tablespace
ORDER BY sid_serial;

SID_SERIAL                                                                       USERNAME                       OSUSER                         SPID         MODULE                                           PROGRAM                                          MB_USED                                TABLESPACE                      SORT_OPS                              
134,51358                                                                         RS_USER                                                       7965                                                                                                           856                                    TEMP                            1                                     
137,50660                                                                         RS_USER                                                       7968                                                                                                           59                                     TEMP                            1                                     
167,1310                                                                          RS_USER                                                       8004                                                                                                           36                                     TEMP                            1                                     
289,21173                                                                         RS_USER                                                       8002                                                                                                           991                                    TEMP                            1                                     

--Sort Space Usage by Statement
SELECT   S.sid || ',' || S.serial# sid_serial, S.username,
         T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,
         T.sqladdr address, Q.hash_value, Q.sql_text
FROM     v$sort_usage T, v$session S, v$sqlarea Q, dba_tablespaces TBS
WHERE    T.session_addr = S.saddr
AND      T.sqladdr = Q.address (+)
AND      T.tablespace = TBS.tablespace_name
ORDER BY S.sid;


SID_SERIAL                                                                       USERNAME                       MB_USED                                TABLESPACE                      ADDRESS                          HASH_VALUE                             SQL_TEXT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
134,51358                                                                         RS_USER                        857                                    TEMP                            000000007C04D8F8                 2445178264                             Select distinct t.* From rtd_to_do_list_item t Where t.is_valid = 1 And t.status = 'OPEN' And Exists ( Select 1 From rtd_viewable_user v Where v.TO_DO_LIST_OID = t.oid  And v.USER_ID = 'LUORY2') And t.item_type In ('524','529','526','532','530','533','520','525','523','531') And t.create_time >= to_date('02/05/2010 14:32:13','MM/DD/YYYY HH24:MI:SS') And (t.REFERANCE_DATE_TO >= '20100106063714.000' Or t.REFERANCE_DATE_TO is null) And ( t.REFERENCE_DATE_FROM <= '20100307063714.000' Or t.REFERENCE_DATE_FROM is null)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
137,50660                                                                         RS_USER                        59                                     TEMP                            000000008C7C7CB0                 303609952                              SELECT oid,ttl_no FROM ( SELECT t.oid as oid,count(*) over() as ttl_no,row_number() over(order by t.CREATE_TIME desc) as rownumber FROM  ror_interface_message_header t Where (t.type = 'ServiceRequest-DCS' Or t.type = 'ServiceRequest-IRIS') And ( upper(t.SR_NO) Like'%3040238070%' Or 0=1 ) ) WHERE rownumber between 1 and 50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
167,1310                                                                          RS_USER                        36                                     TEMP                            000000007FBF0B58                 2033372161                             SELECT OID, SEAL_NO, DO_CONTAINER_OID_2, UPDATE_TIME, IS_TWIN_HAULAGE, VERSION_ID, IS_VALID, CREATE_TIME, CONTAINER_NO, DO_NO, CUSTOM_SEAL_NO, CARGO_DESCRIPTION, SUBSTITUTE_CONT_SIZE_TYPE_OID, CREATOR, CONTAINER_OID, WEIGHT_VALUE, WEIGHT_UNIT_OID, JO_OID, VOLUME_VALUE, VOLUME_UNIT_OID, UPDATOR, CONT_SIZE_TYPE_OID, ACTUAL_CONTAINER_SIZE_TYPE FROM ROR_JO_CONTAINER_REL WHERE (JO_OID = :1)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
289,21173                                                                         RS_USER                        993                                    TEMP                            00000000889BFC08                 584013674                              SELECT t0.OID, t0.UPDATE_TIME, t0.NEED_ALERT, t0.VERSION_ID, t0.DATE_NUMBER, t0.CREATE_TIME, t0.IS_VALID, t0.CREATOR, t0.USER_ID, t0.UPDATOR FROM RTD_CUSTOMIZED_TDL t0, CM_USER t1 WHERE (((t0.IS_VALID = :1) AND (UPPER(t1.USER_ID) = :2)) AND (t1.USER_ID = t0.USER_ID))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
   Unfortunately, I analyzed all the related sql statements but I didn’t find any sql statements that might cause sort operations.
   Then I analyzed the Metric Value diagram, and found that the increment is very high during about 11:45AM to 12:AM. So I analyzed the ART data during this period, a amazing discovery was found that a functionality was called frequently, then I check the functionality related code and found that a plsql function with return type is CLOB is called. After test this function in test environment, I found the root cause:
   Any plsql functions with CLOB return type used in sql statement requires temp spaces and retains the spaces during the whole database session.
In production environment, as the connection is managed in OC4J as connection pool at application server, the database sessions will not release until the application server stops (which cause the connection pool disconnected),so the temp spaces is not released all the time until restarted application server.


Conclusion: If you found that the used temp spaces increases incessantly till out of space, check  your code whether there are functions with lob return type used during a database session which doesn’t release in timely.

 

分享到:
评论

相关推荐

    Temporary ASP.NET Files

    ### Temporary ASP.NET Files知识点解析 #### 一、Temporary ASP.NET Files简介 在了解Temporary ASP.NET Files之前,我们首先需要理解ASP.NET是什么。ASP.NET是由微软开发的一种用于构建动态Web应用程序的技术...

    Temporary Experience

    【Temporary Experience】是一种常见的情况,尤其在IT行业中,它涵盖了临时工作、项目参与或短期学习经验等。在个人发展和职业规划中,这些短暂的经历往往能带来宝贵的技能积累和视野拓宽。下面我们将深入探讨...

    SpringBoot导入上传文件异常The temporary upload location is not valid

    错误spring boot上传文件错误The temporary upload location [/tmp/tomcat.******/work/Tomcat/localhost/ROOT] is not valid

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    12c 新特性-Temporary Undo

    ### 12c 新特性:Temporary Undo #### 一、Temporary Undo 概念与优势 在Oracle 12c版本中引入了一项重要的新特性——Temporary Undo,这项技术旨在优化临时表的操作性能,并减少对Redo日志的空间占用。传统的临时...

    Disturbance governs dominance of an invasive forb in a temporary wetland

    本文《Disturbance governs dominance of an invasive forb in a temporary wetland》探讨了在临时湿地中,一种来自南美的入侵植物——Phyla canescens(以下简称lippia)如何在特定条件下占据主导地位,以及这一...

    lingo 错误列表

    1. **HE MODEL GENERATOR RAN OUT OF MEMORY**:模型生成器内存不足。这意味着你在模型中定义的数据或公式超出了系统内存的承载能力,尝试减少模型的规模或者增加计算机的内存。 2. **TOO MANY LINES OF TEXT IN ...

    利用 Oracle 和 PHP 管理分布式跟踪文件

    eg utl_file_dir=myDB/oratrace/back utl_file_dir=myDB/oratrace/user Run all of the below mentioned scripts in any database whose trace files you want to view As SYS create a user account (TFMADMIN) ...

    SAP Temporary Keys 9月12日到期

    从给定的文件内容中,我们可以提炼出与SAP临时许可证密钥相关的几个知识点。 首先,我们了解到SAP BusinessObjects临时许可证密钥即将于9月12日到期。这表明对于SAP BusinessObjects产品的用户来说,有一个时间限制...

    BURNINTEST--硬件检测工具

    - Corrected a problem where the loopback sound test could run out of memory if run for several days. Release 5.3 build 1013 WIN32 release 31 December 2007 - Improved the reporting of ...

    HX8369-B_DS_temporary_v01.03_120202.pdf

    标题:"HX8369-B_DS_temporary_v01.03_120202.pdf" 描述:"HX8369-B_DS_temporary_v01.03_120202.pdf" 标签:"tftp" 文件中所涉及的知识点主要围绕着一块具有特定型号的显示驱动芯片——HX8369-B。该芯片为一款480...

    Axis Development Guidelines.pdf

    Axis Communications AB provides no guarantee that any of the examples shown in ...000. So writing a lot of temporary files to the flash memory should be avoided.Use the ram disk mounted on /tmp instead

    PMP考前培训笔记汇总

    concepts of temporary and unique. • means developing in steps, and continuing by increments. • should not be confused with scope creep. • needs to be carefully coordinated with proper project Scope...

    HX8357-C_DS_Temporary_v01.10_110726_PD.rar

    这份资料“HX8357-C_DS_Temporary_v01.10_110726_PD.rar”包含了该芯片的数据手册,为我们提供了详尽的技术参数和操作指南。 首先,HX8357-C是一款专为彩色TFT LCD设计的驱动控制器,具有集成触控功能,适用于手机...

    Temporary inhibition of station-keeping response to light in migratory rice planthoppers

    本研究旨在探讨迁飞性害虫稻飞虱在迁徙过程中是否存在对趋光性的暂时性抑制,即在迁飞时是否会对光捕获装置表现出暂时的不响应,并阐明这些昆虫是否会对位于它们原生栖息地的光捕获装置做出反应。...

    SYD8821 EVB Temporary release2018-3-27.zip

    SYD8821 EVB Temporary release 2018-3-27.zip SYD8821 EVB Temporary release 2018-3-27.zip SYD8821 EVB Temporary release 2018-3-27.zip SYD8821 EVB Temporary release 2018-3-27.zip

    Python库 | websub_temporary-0.0.2-py3-none-any.whl

    本篇将详细介绍`websub_temporary-0.0.2-py3-none-any.whl`这个Python库,以及它在开发过程中的作用。 `websub_temporary`库是一个专门针对WebSub协议的临时解决方案。WebSub,又称为HubSub,是一种基于Atom Pub...

    Big+Data,+Crime+and+Social+Control-Routledge(2018).pdf

    The law seems to run against the grain of social change and massive political pressures. This book, however, is an attempt to do just that. It is an impressive piece of work and exemplary in its ...

    前端开源库-temporary-directory

    为了保持工作区的整洁并避免这些临时文件对项目造成污染,"前端开源库-temporary-directory" 提供了一种解决方案。这个开源库专门用于创建和管理临时目录,它会在测试完成后自动清理,确保开发环境的干净和有序。 ...

Global site tag (gtag.js) - Google Analytics