Chinaunix首页 | 论坛 | 博客
  • 博客访问: 455906
  • 博文数量: 97
  • 博客积分: 3396
  • 博客等级: 中校
  • 技术积分: 996
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-25 13:14
文章分类

全部博文(97)

文章存档

2014年(1)

2013年(2)

2012年(7)

2011年(13)

2010年(18)

2009年(7)

2007年(10)

2006年(39)

分类: Oracle

2010-04-16 09:42:29

1.
tj_nohup.sql
sqlplus "/as sysdba" <@tj_index_rebuild.sql
exit;
eof
 
2.tj_index_rebuild.sql
spool index_first_total.txt
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
select sum(bytes)/1024/1024/1024 INDEX_TOTAL_SUM_G from dba_segments where segment_type='INDEX';
spool off
set head off
set feedback off
spool index_rebuild.sql
SELECT 'ALTER INDEX ' ||OWNER||'.'||SEGMENT_NAME ||' REBUILD ONLINE;' FROM DBA_SEGMENTS  WHERE  segment_type='INDEX' ORDER BY BYTES ;
spool off
set head off
set feedback off

spool p_index_rebuild.sql
SELECT 'ALTER INDEX ' ||OWNER||'.'||SEGMENT_NAME ||' REBUILD PARTITION '||PARTITION_NAME ||'  tablespace ultranms_index;' FROM DBA_SEGMENTS  WHERE  segment_type='INDEX PARTITION' and owner='ULTRANMS'  ORDER BY BYTES ;
spool off
spool index_rebuild.log
set header on
set feedback on
set timing on
@index_rebuild.sql
@p_index_rebuild.txt
spool off
spool index_second_total.txt
select sum(bytes)/1024/1024/1024 INDEX_TOTAL_SUM_G from dba_segments where segment_type='INDEX';
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
spool off
 
3.nohup  sh tj_nohup.sql &
 
阅读(1993) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~