首页 > Linux操作系统 > Linux操作系统 > 改变数据库undo表空间


原创 Linux操作系统 作者:renjixinchina 时间:2013-08-12 16:35:38 0 删除 编辑
Oracle Server - Enterprise Edition - Version to [Release 10.2 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 26-Feb-2009***


This goal walks you through changing the default undo tablespace from UNDOTBS1 to another undo tablespace. At the end of the exercise, you will drop the existing undo tablespace and datafiles and be left with a new undo tablespace in place. This procedure requires shutting down the database.

This note was written because of a reoccurring problem with a fractured block (reported in v$backup_corruption) during RMAN backups.


Before doing any action, please perform. a Backup of the database, just in case something doesn't works we will have a point to go back.

1. Determine the size of the datafile(s) for your current undo tablespace "UNDOTBS1":

SQL> select bytes, name from v$datafile where name like '%UNDO%';

BYTES                   NAME
--------------          ----------------------------------------------------
314572800             D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL2\UNDOTBS01.DBF

2. 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\10.2.0\ORADATA\ORCL2\UNDOTBS02.DBF' size 500M;

Tablespace created.

3. Edit your init.ora file and change the parameter "undo_tablespace=" so it points to the newly created tablespace. You may need to create a pfile first:

SQL> create pfile='d:\oracle\product\10.2.0\db_1\dbs\pfileorcl2.ora' from spfile='D:\ORACLE\PRODUCT\10.2.0\DB_1\DBS\SPFILEORCL2.ORA';

File created.

Change undo_tablespace=UNDOTBS2
Change undo_management=MANUAL 

Setting undo_management now ensures the old rollback segments can be taken offline and avoids editing the pfile and restarting the instance again in Step 7.

4. Arrange a time when the database can be shutdown cleanly and perform. a shutdown immediate.

5. Startup the database (specify the pfile if you created one in step 3.)

SQL> startup pfile='d:\oracle\product\10.2.0\db_1\dbs\pfileorcl2.ora'

6. Confirm the new tablespace is in use:

SQL> show parameter undo_tablespace

NAME                 TYPE              VALUE
-------------         --------------  -----------------
undo_tablespace   string               UNDOTBS2

7. Check the status of the undo segments and determine if all the segments in the old undo tablespace are offline. The segments in the new tablespace may also show offline.

SQL>select owner, segment_name, tablespace_name, status from dba_rollback_segs order by 3;

------              --------------------------- ------------------------------ -----------
PUBLIC         _SYSSMU3$                      UNDOTBS1                         OFFLINE
PUBLIC         _SYSSMU2$                      UNDOTBS1                         OFFLINE
PUBLIC         _SYSSMU19$                    UNDOTBS2                         OFFLINE


If the old segments are online, then they must be taken offline:

SQL>alter rollback segment "_SYSSMU3$" offline;
SQL>alter rollback segment "_SYSSMU2$" offline;

This should be executed for all online rollback segments in the old tablespace.

8. Provided all the segments in the old undo tablespace are offline, you can now drop the old undo tablespace:

SQL>drop tablespace UNDOTBS1 including contents and datafiles;

Tablespace dropped.

9. Recreate your spfile with the new undo_tablespace value and change undo_management to AUTO:

SQL> create spfile='d:\oracle\product\10.2.0\db_1\dbs\spfileorcl2.ora' from pfile='D:\ORACLE\PRODUCT\10.2.0\DB_1\DBS\PFILEORCL2.ORA';
File created.

10. Shutdown the database (shutdown immediate) and restart it with the spfile.

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量