Home » Article » Script untuk rebuild index (kasus ora-01502)

Script untuk rebuild index (kasus ora-01502)

Pages

October 2011
M T W T F S S
« Sep   Nov »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

RSS Link

  • An error has occurred; the feed is probably down. Try again later.

Twitter Updates

Blog Stats

  • 345,611 hits

Archives

Pengunjung


Seperti postingan gw sebelumnya (), berikut adalah script untuk melakukan rebuild index-index yang berada dalam state “UNUSABLE“. Script kecil  sql sebagai berikut :

select 'alter index '||owner||'.'||index_name||' rebuild;' from
dba_indexes where STATUS = 'UNUSABLE';

Berikut adalah hasilnya :

‘ALTERINDEX’||OWNER||’.’||INDEX_NAME||’REBUILD;’
——————————————————————————–
alter index SAPWPR.ACCTIT~Z01 rebuild;
alter index SAPWPR.S514~VAB rebuild;
alter index SAPWPR.TCJ_POSITIONS~0 rebuild;
alter index SAPWPR.S055~VAB rebuild;
alter index SAPWPR.S055~0 rebuild;
alter index SAPWPR.GLPCA~7 rebuild;
alter index SAPWPR.GLPCA~3 rebuild;
alter index SAPWPR.GLPCA~2 rebuild;
alter index SAPWPR.FMEP~W rebuild;
alter index SAPWPR.FMEP~V rebuild;
alter index SAPWPR.FMEP~R rebuild;

‘ALTERINDEX’||OWNER||’.’||INDEX_NAME||’REBUILD;’
——————————————————————————–
alter index SAPWPR.FMEP~M rebuild;
alter index SAPWPR.FMEP~K rebuild;
alter index SAPWPR.ACCTIT~1 rebuild;
alter index SAPWPR.ACCTIT~0 rebuild;

15 rows selected.

Tinggal modifikasi sedikit menjadi seperti berikut :

alter index SAPWPR.”ACCTIT~Z01″ rebuild online compress;
alter index SAPWPR.”S514~VAB” rebuild online compress;
alter index SAPWPR.”TCJ_POSITIONS~0″ rebuild online compress;
alter index SAPWPR.”S055~VAB” rebuild online compress;
alter index SAPWPR.”S055~0″ rebuild online compress;
alter index SAPWPR.”GLPCA~7″ rebuild online compress;
alter index SAPWPR.”GLPCA~3″ rebuild online compress;
alter index SAPWPR.”GLPCA~2″ rebuild online compress;
alter index SAPWPR.”FMEP~W” rebuild online compress;
alter index SAPWPR.”FMEP~V” rebuild online compress;
alter index SAPWPR.”FMEP~R” rebuild online compress;
alter index SAPWPR.”FMEP~M” rebuild online compress;
alter index SAPWPR.”FMEP~K” rebuild online compress;
alter index SAPWPR.”ACCTIT~1″ rebuild online compress;
alter index SAPWPR.”ACCTIT~0″ rebuild online compress;

Bisa juga dijadikan script sql (misal buat file rebuild_index.sql) dan berisi seperti berikut :

sqlplus ‘/as sysdba’
spool /oracle/WPR/index_rebuild_log.txt
alter index SAPWPR.”ACCTIT~Z01″ rebuild online compress;
alter index SAPWPR.”S514~VAB” rebuild online compress;
alter index SAPWPR.”TCJ_POSITIONS~0″ rebuild online compress;
alter index SAPWPR.”S055~VAB” rebuild online compress;
alter index SAPWPR.”S055~0″ rebuild online compress;
alter index SAPWPR.”GLPCA~7″ rebuild online compress;
alter index SAPWPR.”GLPCA~3″ rebuild online compress;
alter index SAPWPR.”GLPCA~2″ rebuild online compress;
alter index SAPWPR.”FMEP~W” rebuild online compress;
alter index SAPWPR.”FMEP~V” rebuild online compress;
alter index SAPWPR.”FMEP~R” rebuild online compress;
alter index SAPWPR.”FMEP~M” rebuild online compress;
alter index SAPWPR.”FMEP~K” rebuild online compress;
alter index SAPWPR.”ACCTIT~1″ rebuild online compress;
alter index SAPWPR.”ACCTIT~0″ rebuild online compress;
spool off
exit

Selamat mencoba !!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: