0% found this document useful (0 votes)
129 views8 pages

Managing Undo Table Spces

1. The document discusses managing undo tablespaces in an Oracle database. It provides steps to switch the database undo tablespace to a new one and drop the old undo tablespace. 2. It shows that pending transactions still using the old undo tablespace prevent it from being dropped immediately. The document finds the user and session of the pending transaction and provides options to commit, rollback, or kill the session to release the undo segments in the old tablespace. 3. It also discusses the undo retention period that must pass before the old undo tablespace can be dropped if undo data is still being retained.

Uploaded by

Vinu3012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views8 pages

Managing Undo Table Spces

1. The document discusses managing undo tablespaces in an Oracle database. It provides steps to switch the database undo tablespace to a new one and drop the old undo tablespace. 2. It shows that pending transactions still using the old undo tablespace prevent it from being dropped immediately. The document finds the user and session of the pending transaction and provides options to commit, rollback, or kill the session to release the undo segments in the old tablespace. 3. It also discusses the undo retention period that must pass before the old undo tablespace can be dropped if undo data is still being retained.

Uploaded by

Vinu3012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1.

Managing Undo Table Spces

Create undo table space:-

Altering UNDO Tablespace

The following example adds a new datafile to undo tablespace

How to switch the database to a new UNDO tablespace and drop the old one

The current undo tablespace as suggested by the initialization parameter


undo_tablespace is UNDOTBS02. Leave this sysdba as is, open another console,
log in as user kusuma/kusuma and initiate a transaction.

Undo Table Space Management Page 1


With an update on emp table we have initiated a transaction. The undo data is
written to a segment in the UNDOTBS02 tablespace. Now leave this kusuma's
session intact and go back to the sysdba console without issuing any COMMIT or
ROLLBACK.

-- Switch the database to the new UNDO tablespace.

-- Try to drop the tablespace but failed.

With the alter system set undo_tablespace=UNDOTBS3, the database UNDO


tablespace is changed and any new transaction's undo data will go to the new
tablespace i.e. UNDOTBS3. But the undo data for already pending transaction
Undo Table Space Management Page 2
(e.g. the one initiated by kusuma before the database UNDO tablespace switch)
is still in the old tablespace with a status of PENDING OFFLINE. As far as it is
there you cannot drop the old tablespace.

set lines 10000


column name format a10

SELECT a.name,b.status
FROM v$rollname a,v$rollstat b
WHERE a.usn = b.usn
AND a.name IN (
SELECT segment_name
FROM dba_segments
WHERE tablespace_name = 'UNDOTBS02'
);

NAME STATUS
---------- ---------------
_SYSSMU8$ PENDING OFFLINE

The above query shows the name of the UNDO segment in the UNDOTBS02
tablespace and its status. Now lets see which users/sessions are running this
pending transaction.

column username format a6

SELECT a.name,b.status , d.username , d.sid , d.serial#

Undo Table Space Management Page 3


FROM v$rollname a,v$rollstat b, v$transaction c , v$session d
WHERE a.usn = b.usn
AND a.usn = c.xidusn
AND c.ses_addr = d.saddr
AND a.name IN (
SELECT segment_name
FROM dba_segments
WHERE tablespace_name = 'UNDOTBS02'
);

NAME STATUS USERNA SID SERIAL#


---------- --------------- ------ ---------- ----------
_SYSSMU8$ PENDING OFFLINE KUSUMA 31 27

So this is KUSUMA with SID=31 and SERIAL#=27 Since we know now the user,
we can go to him/her and request to end the transaction gracefully i.e. issue a
ROLLBACK or COMMIT. However, if this is not possible (say the user initiated
the transaction and left for annual leave :) and trust me this happens) you may
go ahead and kill the session to release the undo segments in the UNDOTBS02
tablespace.

Undo Table Space Management Page 4


Please see the below alert log messages.

Undo Table Space Management Page 5


If you are retaining undo data then you still won't be able to drop the
tablespace because it is still in use by undo_retention. Let the
UNDO_RETENTION time pass and then try to drop the tablespace. In my case it
is 900 seconds i.e. 15 minutes.

Please see the below alert.log file.

Undo Table Space Management Page 6


Undo is not used by users directly but by statements which modify many
database blocks. Try to search for session which generates a lot of redo.

This query lists information about undo segments in the SIUE DBORCL database.
Note the two segments in the SYSTEM tablespace and the remaining segments in
the UNDO tablespace.

Undo Table Space Management Page 7


This query checks the use of an undo segment by any currently active transaction
by joining the V$TRANSACTION and V$SESSION views.

Undo Table Space Management Page 8

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy