Skip to Content
0
Former Member
May 04, 2007 at 02:06 PM

Index rebuild script help

227 Views

Hi All,

I am trying to build a simple oracle index rebuild script, which basically runs and rebuilds specified indexes.

We are running Oracle database on HPUX enviroment.

No so far i have only manged to this

I created 2 scripts

file 1 : rebuild

#!/bin/csh

sqlplus system/manager @ indexrebuild.sql

file 2 :indexrebuild.sql

sqlplus '/as sysdba'

spool /tmp/rebuildlog

alter index SAPR3."IHPA~A" rebuild online;

spool off

exit

I ran the script, which seems to work perfectly. I only get one error message. Any idea what is causingthis error. thanks

bhlukd01:orad01 28> ./rebuild

SQL*Plus: Release 9.2.0.7.0 - Production on Fri May 4 14:57:46 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production

With the Partitioning option

JServer Release 9.2.0.7.0 - Production

SP2-0734: unknown command beginning "sqlplus '/..." - rest of line ignored.

Index altered.

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production

With the Partitioning option

JServer Release 9.2.0.7.0 - Production

bhlukd01:orad01 29>

I need help with commands and syntax.

I want cron this script to run every morning ONLINE, which rebuilds specified indexes and then produces log /tmp/rebuildlog.

Can anyone help me or point me right direction to prepare this simple script. my scripting knowledge is very basic.

thanks