在oracle 11g中收缩数据库 [英] shrink a database in oracle 11g

查看:299
本文介绍了在oracle 11g中收缩数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何我都不是数据库管理员,所以在这里说明某些内容可能是错误的.

I am not a database administrator by any means so I might be wrong in stating some of the things here.

在SQL Server中,当我们在数据库中添加大量数据然后将其删除时,数据文件(.mdf文件)或数据库(或任何称为它)的大小不会减小为原始大小.我们需要缩小它.

In SQL Server, when we add a large amount of data in the database and then when we delete it, the size of the data files (.mdf file) or database (or whatever it is called) does not get reduced to the original size. We need to shrink it.

在Oracle中是否可以使用相同的基础?如果是,那我应该如何缩小Oracle 11g数据库?

Do the same fundamentals work in Oracle? If yes then how should I go about shrinking an Oracle 11g database?

推荐答案

Oracle文档的完整解释:

Full explanation from the Oracle Documentation: Reclaiming Wasted Space. For the short version:

您可以缩小表,按索引组织的表,索引, 分区,子分区,实例化视图或实例化视图日志. 您可以使用ALTER TABLE,ALTER INDEX,ALTER MATERIALIZED VIEW, 或带有SHRINK SPACE的ALTER MATERIALIZED VIEW LOG语句 条款."

"You can shrink space in a table, index-organized table, index, partition, subpartition, materialized view, or materialized view log. You do this using ALTER TABLE, ALTER INDEX, ALTER MATERIALIZED VIEW, or ALTER MATERIALIZED VIEW LOG statement with the SHRINK SPACE clause."

因此,在运行Oracle Segment Advisor以建议要缩小的区域后,类似以下的内容将缩小名为mytable的表中的空间.

So, after running the Oracle Segment Advisor to recommend areas to shrink, something like the following will shrink space in a table named mytable.

SQL> alter table mytable enable row movement;
Table altered

SQL> alter table mytable shrink space;
Table altered

这篇关于在oracle 11g中收缩数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆