Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Scripts for Rebuilding Indexes Nightly on Solaris
David -
Use cron. Nightly might be excessive. Kick off a shell script (remember that cron executes as root, so you need to set your environment) and create your own script dynamically (following code is use for backups also) in a manner like:
rebuild_index.sh
#!/bin/ksh
export PATH=$PATH:/u001/app/oracle/product/8.1.7/bin
export ORACLE_SID=ifas
export PATH=$PATH:/$ORACLE_HOME/bin
export ORACLE_HOME=/u001/app/oracle/product/8.1.7
export ORACLE_BASE=/u001/app/oracle
sqlplus <<either use a password protection scheme or hardcode your access here> <<username>/<password>>> @/usr/local/bin/rebuild_index
exit
rebuild_index.sql
spool rebuild_index.sql
Select 'Alter index ' || index_name || ' rebuild;' from dba_indexes; #
add selection caveats if desired
spool off
!chmod 777 /u014/oradata/ifastrn/rebuild_index.sql
@/u014/oradata/ifastrn/rebuild_index
exit
Lots of variations possible.
David A. Barbour
Oracle DBA, OCP
AISD
512-414-1002
Kimberly Smith <kimberly.smith_at_gmd.fu To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> jitsu.com> cc: Sent by: Subject: RE: Scripts for Rebuilding Indexes Nightly on Solaris root_at_fatcity.com 09/06/2001 11:57 AM Please respond to ORACLE-L
Nightly? That is a lot. Are you really entering that much data on a daily basis?
-----Original Message----- From: David Wagoner [mailto:dwagoner_at_arsenaldigital.com] Sent: Thursday, September 06, 2001 8:57 AM To: Multiple recipients of list ORACLE-L Subject: Scripts for Rebuilding Indexes Nightly on Solaris Does anyone have any good scripts for rebuilding indexes nightly on Solaris UNIX that they'd be willing to share? Also, in your experience is it better to run this through UNIX cron jobs than using the Oracle OEM job scheduler? I suspect the cron job will be the favorable answer. Thanks in advance, David Wagoner Oracle DBA
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: DBarbour_at_austin.isd.tenet.edu
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Sep 06 2001 - 12:26:27 CDT
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
![]() |
![]() |