Oracle切换Undo表空间

参考文档:How to Switch to a New Undo Tablespace (Doc ID 1951695.1)

1. 查看当前默认undo表空间

SQL> show parameter undo

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS2

2. 创建新的Undo表空间,根据需求制定数据文件大小

SQL> create undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/orcl/undotbs1_01.dbf' size 100m autoextend off;

Tablespace created.

3. 切换到新的Undo表空间

SQL> alter system set undo_tablespace=undotbs1 scope=both;

System altered.

4. 检查旧的Undo表空间中回滚段的状态,确认所有回滚段都处于offline

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

TABLESPACE_NAME                STATUS             COUNT(*)
------------------------------ ---------------- ----------
UNDOTBS1                       ONLINE                   37
SYSTEM                         ONLINE                    1
UNDOTBS2                       OFFLINE                  37
如果有回滚段的处于非offline状态,必须等待其offline
SQL> select status,segment_name from dba_rollback_segs where status not in ('OFFLINE') and tablespace_name='UNDOTBS2';

no rows selected

5. 确认旧的Undo表空间所有回滚段offline后,删除undo表空间

SQL> Drop tablespace UNDOTBS2 including contents and datafiles;

Tablespace dropped.


猜你喜欢

转载自blog.csdn.net/gumengkai/article/details/79267201