问题描述
嗨,
我有一个撤消表空间,在我的生产数据库Oracle 11g和备用数据库中有4个撤消数据文件。每个数据文件大小为30gb,但仅使用1gb。所以我可以在没有停机的情况下调整 (缩小) 所有数据文件的大小。请用描述和命令回复我。
我有一个撤消表空间,在我的生产数据库Oracle 11g和备用数据库中有4个撤消数据文件。每个数据文件大小为30gb,但仅使用1gb。所以我可以在没有停机的情况下调整 (缩小) 所有数据文件的大小。请用描述和命令回复我。
专家解答
检查MOS注释268870.1,其中一些在下面
How to Shrink the datafile of Undo Tablespace (Doc ID 268870.1) To BottomTo Bottom GOAL Your production database has semiannual or annual purging programs which generate huge redo. Due to this requirement, your undo tablespace grows rapidly and occupies most of the space on file system. The purging process is run only few times a year. So would not like to keep the huge undo datafile in your database throughout the year. You don't want to buy additional disks unnecessarily. You have created an undo tablespace with datafiles as AUTOEXTEND ON MAXSIZE UNLIMITED to avoid the error: ORA 1651 : unable to extend save undo segment byin tablespace You have tried "alter database datafile .. resize" which always fails with error: ORA 3297 : file contains blocks of data beyond requested RESIZE value. You want to shrink the datafile to utilize the disk space for other tablespaces or other purposes. SOLUTION The steps to accomplish the goal are: Create a new undo tablespace with a smaller size: SQL> create undo tablespace UNDO_RBS1 datafile 'undorbs1.dbf' size ; Set the new tablespace as the undo tablespace to be used: (Note: If Data Guard Managed configuration is used, the below parameter modification needs to executed on any physical standbys serviced by this production database) SQL> alter system set undo_tablespace=undo_rbs1; Drop the old undo tablespace: SQL> drop tablespace undo_rbs0 including contents; 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. Points to Consider: The value for UNDO_RETENTION also has a role in growth of undo tablespace. If there is no way to get the undo space for a new transaction, then the undo space (retention) will be reused. But, if the datafiles for undo tablespace are set to auto extensible, it will not reuse the space. In such scenarios new transaction will allocate a space and your undo tablespace will start growing. Is big really bad? Overhead on larger file/tablespaces can theoretically impact the database and the OS. With a small file, the OS would have to do minimal I/O. Oracle would be able to cache the whole file and there would be less segments to manage. With AUM you get bitmapped files and all its (space management) performance benefits -- (number of) undo segments are automatically managed and are not related to the size of the tablespace. With the bigger file/tablespace you will have other overhead -- e.g. backup will take longer -- but as far as the undo management there should be no performance impact just because the file/tablespace is bigger. That said, it is important to monitor systems (e.g. with StatsPack) and watch for environment-specific issues. 复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
596次阅读
2025-04-15 17:24:06
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
564次阅读
2025-04-18 14:18:38
XTTS跨版本迁移升级方案(11g to 19c RAC for Linux)
zwtian
483次阅读
2025-04-08 09:12:48
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
473次阅读
2025-04-20 10:07:02
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
457次阅读
2025-04-22 00:20:37
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
431次阅读
2025-04-22 00:13:51
Oracle 19c RAC更换IP实战,运维必看!
szrsu
430次阅读
2025-04-08 23:57:08
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
417次阅读
2025-04-17 17:02:24
火焰图--分析复杂SQL执行计划的利器
听见风的声音
359次阅读
2025-04-17 09:30:30
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
357次阅读
2025-04-15 14:48:05