Friday, November 8, 2013

Oracle: Move undo tablespace to a different path

1) Login as sysadmin to the database (Remember that you need to be logged into the server, you cannot do this remotly)


   1: #sqlplus '/ as sysdba'

sql1

2) Check your currents undo tablespaces

select to_char(begin_time, 'DD-MON-RR HH24:MI') begin_time, 

to_char(end_time, 'DD-MON-RR HH24:MI') end_time, 

tuned_undoretention from v$undostat order by end_time;


3) Create the new undo tablespace



CREATE UNDO TABLESPACE undotbs_01 DATAFILE 

'/[your_path]/undo01.dbf' SIZE 2M REUSE AUTOEXTEND ON;

sql3

4) Set your system to use the new tablespace



ALTER SYSTEM SET UNDO_TABLESPACE = 

undotbs_01; 
sql4

5) Restart your database (There are some other ways but I prefer this one)

SHUTDOWN IMMEDIATE

sql5
STARTUP
sql6

6)  Drop your old undo tablespace to free some space

DROP TABLESPACE undotbs_02 INCLUDING CONTENTS AND DATAFILES;
sql7
Notes:
I had to do this movement in order to create some space in the file system, the partition was completely full and the database crashing. One of those things that you find in your development servers sometimes :)

No comments:

Post a Comment