Expert Tips on Drop Temporary Tablespace Hangs!!
Sometimes it happens that we issue the command for dropping temporary tablespace and the operation just hangs and we keep on waiting for a long time. In this article we will discuss how to resolve the frustrating situation when drop temporary tablespace hangs.
Oracle V$SORT_USAGE view tells you the space utilized within one temporary segment on a session and statement level. An entry is made in the V$SORT_USAGE table whenever an operation uses sort space. Once the operation is complete then that entry is automatically removed. However if any operation is aborted abnormally and dead connections are left then a number of entries are left in the V$SESSION and V$SORT_USAGE. Although one instance has only one sort segment per temporary tablespace but the space within the segment can be used by multiple statements running in different sessions.
Solution – I:
• Find Session Number from V$SORT_USAGE:
First of all you will have to run below command
SELECT USERNAME, SESSION_NUM, SESSION_ADDR FROM V$SORT_USAGE;
• Find Session ID from V$SESSION:
If the resultset contains any tows then your next step will be to find the SID from the V$SESSION view. You can find session id by using SESSION_NUM or SESSION_ADDR from previous resultset.
SELECT SID, SERIAL#, STATUS FROM V$SESSION WHERE SERIAL#=SESSION_NUM;
OR
SELECT SID, SERIAL#, STATUS FROM V$SESSION WHERE SADDR=SESSION_ADDR;• Kill Session:
Now kill the session with IMMEDIATE.
ALTER SYSTEM KILL 'SID,SERIAL#' IMMEDIATE;
• Check Each Instance on RAC:
If you are working on RAC then the final step will be to check each Instance on RAC.
Solution – II:
• Create New Temporary Tablespace:
First of all you will have to create a new temporary tablespace.
CREATE TEMPORARY TABLESPACE MYTEMP2 TEMPFILE '/ORADATA2/ MYTEMP02.DBF' SIZE 100M;
• Assign all users to new Tablespace:
Now you will assign all users to this new tablespace.
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE MYTEMP2;
• Find Inactive Sessions:
Now you will find inactive sessions in V$SORT_USAGE table by running below command.
SELECT A2.TABLESPACE, A2.SEGFILE#, A2.SEGBLK#, A2.BLOCKS, A1.SID, A1.SERIAL#, A1.USERNAME, A1.OSUSER, A1.STATUS FROM V$SESSION A1,V$SORT_USAGE A2 WHERE A1.SADDR = A2.SESSION_ADDR;
• Kill Inactive Sessions:
Now you will kill the inactive sessions by using SID and SERIAL# from previous resultset.
ALTER SYSTEM KILL SESSION 'SID_NUMBER, SERIAL#';
• Drop Previous Tablespace:
Finally you will have to drop the previous tablespace.
DROP TABLESPACE PREVIOUS_TEMP_TBS;
相關文章
- 【MW】Drop Materialized View Hangs with 'Enq: JI - Contention'ZedViewENQ
- alter database drop datafile 與 drop tablespace file 的區別Database
- oracle的臨時表空間temporary tablespaceOracle
- 【案例分析】ORA-25153: Temporary Tablespace is Empty
- Oracle佇列鎖enq:TS,Temporary Segment (also TableSpace)Oracle佇列ENQ
- 臨時表空間temporary tablespace相關操作
- ORA-25153: Temporary Tablespace is Empty 解決方法
- alter database datafile offline drop 與 alter tablespace drop datafile 區別Database
- Oracle10g New Feature -- 5.Temporary Tablespace GroupOracle
- 20160822Oracle 11g Temporary TablespaceOracle
- 資料庫審計(create/alter/drop table、user、tablespace)資料庫
- Oracle10新特性:臨時表空間組(temporary tablespace group)Oracle
- 10G新特性: 臨時表空間組(temporary tablespace group)
- Oracle10g新特性:臨時表空間組(temporary tablespace group)Oracle
- drop tablespace xx INCLUDING CONTENTS AND DATAFILES; 檔案不立刻消失
- ORA-25153: Temporary Tablespace is Empty 重建控制檔案導致丟失tempfile
- 重建控制檔案後,對臨時表空間(temporary tablespace)進行重建
- Allocation of Temporary Segments for Temporary Tables and Indexes (28)Index
- impdp hangs,慎用impdp parallel引數Parallel
- oracle temporary tableOracle
- Eclipse Hangs in DDMS post-create initEclipse
- PDF Expert使用教程:如何在Mac上使用PDF Expert編輯PDFMac
- 【招聘】HDS Senior Oracle ExpertOracle
- Remote Rendering portlet hangs on socketRead0()REM
- tablespace 大檔案,undo,temp tablespace
- pdf編輯PDF Expert for macMac
- Expert 101 Oracle——表Oracle
- Expert 101 Oracle——索引Oracle索引
- oracle expert one on one (chm ebook)Oracle
- [Oracle Script] Temporary Sort UsageOracle
- Restrictions on Altering Temporary TablesREST
- Operations that Require Temporary Segments (26)UI
- drop asm disk、撤銷drop asm diskASM
- Tips
- Drop DatabaseDatabase
- db2 sms tablespace 不支援large tablespaceDB2
- Open Resetlogs After Restore Hangs (Doc ID 1455666.1)REST
- Mac pdf編輯工具:PDF ExpertMac