--摘自pinner的书,谢谢pinner.
update my_test set ftype=1 where ftype is null;
如果表my_test有上百万条记录,可以分批更新,比如每1000条语句commit一次。
declare
row_num number :=0;
begin
for c_test in(select id from my_test t where ftype is null)loop
update my_test t set t.ftype=1 where y.id=c_test.id;
row_num :=row_num +1;
--100条提交一次,可根据需要修改
if mod(row_num,1000) =0 then
commit;
end if;
end loop;
commit;
end;
/
需要关注undo和temp的使用情况:
监控undo的剩余空间:
select tablespace_name,round(sum(bytes)/(1024*1024),2) free_space
from dba_free_space
where tablespace_name='TBS_UNDO'
group by tablespace_name;
监控临时段的使用空间:
select sum(nvl(blocks,0))*8/1024 MSIZE from v$sort_usage;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/543979/viewspace-714381/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/543979/viewspace-714381/