oracle 删除多行数据库,oracle数据库中旧数据的删除技术

我们有同样的问题,使用同样的策略。

如果情况变得非常糟糕(索引、表的分配非常零碎,…),我们将尝试应用空间回收操作。

表必须允许行移动(类似于闪回):

alter table ttt启用行移动;

改变表ttt缩小空间;

然后重建所有索引。

我不知道你对维护窗口是怎么看的,如果应用程序必须一直可用,那就更难了,如果不是,你可以在离线时做一些“重新打包”。alter table ttt move tablespace sss“在重写表时,会做很多工作来清理混乱。您还可以指定新的存储参数,如数据块管理、大小…看一下文件。

我使用这样的脚本为整个数据库创建脚本:

SET SQLPROMPT "-- "

SET ECHO OFF

SET NEWPAGE 0

SET SPACE 0

SET PAGESIZE 0

SET FEEDBACK OFF

SET HEADING OFF

SET TRIMSPOOL ON

SET TERMOUT OFF

SET VERIFY OFF

SET TAB OFF

spool doit.sql

select 'prompt Enabling row movement in '||table_name||'...'||CHR (10)||'alter table '||table_name||' enable row movement;' from user_tables where table_name not like '%$%' and table_name not like '%QTAB' and table_name not like 'SYS_%';

select 'prompt Setting initial ext for '||table_name||'...'||CHR (10)||'alter table '||table_name||' move storage (initial 1m);' from user_tables where table_name not like '%$%' and table_name not like '%QTAB' and table_name not like 'SYS_%';

select 'prompt Shrinking space for '||table_name||'...'||CHR (10)||'alter table '||table_name||' shrink space;' from user_tables where table_name not like '%$%' and table_name not like '%QTAB' and table_name not like 'SYS_%';

select 'prompt Rebuilding index '||index_name||'...'||CHR (10)||'alter index '||index_name||' rebuild;' from user_indexes where status = 'UNUSABLE';

spool off

prompt now check and then run @doit.sql

exit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值