改变数据库undo表空间

Oracle Server - Enterprise Edition - Version 10.2.0.1 to 11.2.0.3 [Release 10.2 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 26-Feb-2009***


GOAL

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.

FIX

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;

OWNER         SEGMENT_NAME         TABLESPACE_NAME         STATUS
------              --------------------------- ------------------------------ -----------
PUBLIC         _SYSSMU3$                      UNDOTBS1                         OFFLINE
PUBLIC         _SYSSMU2$                      UNDOTBS1                         OFFLINE
PUBLIC         _SYSSMU19$                    UNDOTBS2                         OFFLINE

....etc.

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:

undo_management='AUTO'
undo_tablespace='UNDOTBS2'
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博客 ” ,链接:http://blog.itpub.net/15747463/viewspace-768311/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15747463/viewspace-768311/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值