RE: How to clear UNDOTBS

  • From: "Dunbar, Norman" <norman.dunbar@xxxxxxxxxxxxxxxxxxxxxxxxx>
  • To: <ecandrietta@xxxxxxxxx>, "ORACLE-L" <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 18 Jan 2010 13:47:34 -0000

Hi Eriovaldo,

>> I have an UNDOTBS that is growin up.
>> How can I do to clear it ?
You don't have to. Try this:

select tablespace_name,status,count(*)
from dba_undo_extents
group by tablespace_name,status;

That will give you something like the following:

TABLESPACE_NAME   STATUS      COUNT(*)
--------------------------------------
UNDOTBS1          EXPIRED       310
UNDOTBS1          UNEXPIRED      81

As you can see, I have no ACTIVE undo extents, so the existing 391 extents, 
plus any free space in the tablespace are available for later use.

It's a bit like TEMP usage, when an extent is created, it lives on until you 
restart the database. The time saved by leaving it there against creating and 
deleting it when needed/finished with is obviously worth it.


>> I don´t need data that is there saved.
>> I can restart writting the UNDOTBS again.
If you *really* must, simply restart the database. Get all your users to log 
out etc, shut down any application still connected and restart the database.

However, Oracle will use existing EXPIRED extents when required, and if there 
are none, and no free space, it will start using UNEXPIRED ones. If there is 
free space then it will create new extents as it needs them.

Every time you restart the database, the UNDO tablespace will be cleared out, 
but as soon as your users start running transactions (that make changes) you 
will see extents being created and used and left behind.

You only need to worry about your UNDO tablespace if you don't have enough 
space and a transaction tries to create a new extent and there is no room. You 
don't worry about space used in the tablespace in any other situation and you 
don't need to reclaim it.


HTH

Cheers,
Norman.





Information in this message may be confidential and may be legally privileged. 
If you have received this message by mistake, please notify the sender 
immediately, delete it and do not copy it to anyone else.   We have checked 
this email and its attachments for viruses. But you should still check any 
attachment before opening it. We may have to make this message and any reply to 
it public if asked to under the Freedom of Information Act, Data Protection Act 
or for litigation.  Email messages and attachments sent to or from any 
Environment Agency address may also be accessed by someone other than the 
sender or recipient, for business purposes.  If we have sent you information 
and you wish to use it please read our terms and conditions which you can get 
by calling us on 08708 506 506.  Find out more about the Environment Agency at 
www.environment-agency.gov.uk

Information in this message may be confidential and may be legally privileged. 
If you have received this message by mistake, please notify the sender 
immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should 
still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under 
the Freedom of Information Act, Data Protection Act or for litigation.  Email 
messages and attachments sent to or from any Environment Agency address may 
also be accessed by someone other than the sender or recipient, for business 
purposes.

If we have sent you information and you wish to use it please read our terms 
and conditions which you can get by calling us on 08708 506 506.  Find out more 
about the Environment Agency at www.environment-agency.gov.uk
--
//www.freelists.org/webpage/oracle-l


Other related posts: