ORA-30036錯誤
IMP-00058: ORACLE error 30036 encountered
ORA-30036: unable to extend segment by 8192 in undo tablespace 'UNDOTBS1'
[oracle@dbatest ~]$ oerr ORA 30036
30036, 00000, "unable to extend segment by %s in undo tablespace '%s'"
// *Cause: the specified undo tablespace has no more space available.
// *Action: Add more space to the undo tablespace before retrying
// the operation. An alternative is to wait until active
// transactions to commit.
oracle中经常遇到undo表空间不释放,如果设置了unod表空间自动扩展AUTOEXTEND ON则还有可能把磁盘撑爆。当undo被撑满了,经常会选择重建undo表空间,进行切换。虽然切换undo比较容易,但如果要在生产切换undo还是考虑的周到一些比较好。
注意事项:
1. 检查系统使用的参数文件是pfile还是spfile。
如果用pfile记得修改pfile中的undo_tablespace参数。否则容易导致下次重启数据库时找不到历史的undo表空间而启动失败。
select name , value from v$parameter where name='spfile';
2. 切换undo时检查是否还有事务存在。如果有事务,在删除旧undo时可能会遇到ORA-30013的错误。
select count(*) from v$transaction;
3. 检查undo对应的数据文件是否被真正删除。
摘自:How to Shrink the datafile of Undo Tablespace [ID 268870.1]
NOTE: Dropping the old tablespace may give ORA-30013 : undo tablespace '%s' is currently in use. This error indicates you must wait for the undo tablespace to become unavailable. In other words, you must wait for existing transaction to commit or rollback. Also be aware that on some platforms, disk space is not freed to the OS until the database is restarted. The disk space will remain "allocated" from the OS perspective until the database restart.
4. 虽然可以在线切换undo,但切换后如果能重启一下最好。以免留下后患。或者选择在可以重启的时候去切换undo。
切换undo的步骤:
一、检查undo设置
SQL> show parameter undo
二、查看undo表空间的大小
SELECT D.TABLESPACE_NAME,D.FILE_NAME, SUM(D.BYTES) / 1024 / 1024 MB
FROM DBA_DATA_FILES D
WHERE D.TABLESPACE_NAME LIKE 'UNDO%'
GROUP BY D.TABLESPACE_NAME,D.FILE_NAME;
三、检查参数文件类型
select name , value from v$parameter where name='spfile';
四、创建undo表空间
SQL> create undo tablespace UNDOTBS2 datafile '/Data/oradata/dsp3/undotbs02.dbf' size 8000M;
五、等待原undo表空间UNDO SEGMENT OFFLINE后可以切换undo
SQL> SELECT USN,XACTS,STATUS,RSSIZE / 1024 / 1024 / 1024 RSSIZE,HWMSIZE / 1024 / 1024 / 1024 HWMSIZE,SHRINKS
FROM V$ROLLSTAT ORDER BY RSSIZE;
六、切换UNDO表空间
SQL>alter system set undo_tablespace=undotbs2 scope=both;
七、删除UNDO表空间及数据文件
SQL>drop tablespace UNDOTBS1 including contents and datafiles;
Metalink中记录了一种切换undo比较稳妥的方法,可以参考一下:
How to Change the Existing Undo Tablespace to a New Undo Tablespace [ID 431652.1]
阅读(7141) | 评论(0) | 转发(0) |