如何缩小undo表空间的大小

一. 查出数据库当前的undo表空间和数据文件

SELECT a.name, b.name
  FROM v$tablespace a, v$datafile b
 WHERE a.name = (SELECT VALUE
                   FROM v$parameter
                  WHERE name = 'undo_tablespace')
       AND a.ts# = b.ts#;


二.用查询结果替代下面的<>部分,然后执行脚本

Create UNDO TABLESPACE UNDOTBS2 DATAFILE <'/opt/oracle/oradata/orcl/undotbs02.dbf'> SIZE 100M REUSE AUTOEXTEND ON;
Alter SYSTEM SET UNDO_TABLESPACE=UNDOTBS2;
Drop TABLESPACE <UNDOTBS1> INCLUDING CONTENTS AND DATAFILES;
Select * FROM DBA_TABLESPACES;
Create UNDO TABLESPACE <UNDOTBS1> DATAFILE <'/opt/oracle/oradata/orcl/undotbs01.dbf'> SIZE <100M> REUSE AUTOEXTEND ON;
Alter SYSTEM SET UNDO_TABLESPACE=UNDOTBS1;
Drop TABLESPACE UNDOTBS2 INCLUDING CONTENTS AND DATAFILES;
Select * FROM DBA_TABLESPACES;


你可能感兴趣的:(数据库,脚本,System)