• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Switch to a New Undo Tablespace in Oracle Database

by admin

This post explains the steps to switch to a new Undo tablespace.

1. Check your current default Undo tablespace:

SQL> show parameter undo_tablespace

2. Determine the size of the datafile(s) for your current undo tablespace:

sql> select tablespace_name, file_id, file_name,round (bytes / (1024 * 1024), 0) total_space from dba_data_files where tablespace_name=[tablespace_name from the above output];

For example:

sql> select tablespace_name, file_id, file_name,round (bytes / (1024 * 1024), 0) total_space from dba_data_files where tablespace_name='UNDOTBS1;

3.Create a new undo tablespace of the same size (larger or smaller) depending on your database requirements.

sql> create undo tablespace UNDOTBS2 datafile 'D:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\UNDOTBS02.DBF' size 5000M;

4. Switch to the new Undo tablespace

sql> alter system set undo_tablespace = undotbs2 scope=both;

5. Check the status of the undo segments and determine if all the segments in the old undo tablespace are offline.

sql> select tablespace_name, status, count(*) from dba_rollback_segs group by tablespace_name, status;

If there are Undo segments with a status other than OFFLINE in the tablespace to be dropped, we need to wait till they become OFFLINE. You may have to wait for the duration of the tuned_undoretention (from v$undostat) to ensure all Undo segments have become OFFLINE.

sql> select status,segment_name from dba_rollback_segs where status not in ("OFFLINE') and tablespace_name=[undo tablespace to be dropped];

For example:

sql> select status,segment_name from dba_rollback_segs where status not in ("OFFLINE') and tablespace_name='UNDOTBS1';

6. If all the Undo segments in the old Undo tablespace to the dropped is of status OFFLINE, then drop the tablespace.

sql> select tablespace_name, status, count(*) from dba_rollback_segs group by tablespace_name, status;

7. Verify and then drop:

sql> Drop tablespace [tablespace_name] including contents and datafiles;

For example:

sql> Drop tablespace UNDOTBS1 including contents and datafiles;

Filed Under: oracle

Some more articles you might also be interested in …

  1. How to Disable AUTOEXTEND Mode on a datafile in Oracle Database
  2. How To Calculate The Required Network Bandwidth Transfer Of Redo In Data Guard Environments
  3. Oracle OS watcher (OSWatcher) – Understanding oswmpstat
  4. Common Init.ora Parameters and Unix, Linux Kernel Parameters and Relationship Between Them
  5. How to add and drop online redo log members and groups in Oracle
  6. How To Change SYS user password for oracle database instance
  7. How to Restore a Dropped Pluggable Database (PDB) in Multitenant Environment
  8. SQL: Difference between delete and truncate
  9. How to Trace Dynamic Registration from PMON or LREG (Oracle 12c)
  10. Roles and Privileges Administration and Restrictions in Oracle Database

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright