Can any body advice me how can i create simple indexes rebuild scripts on NT or 2000 so I can make it as a batch file to run weekly ???
Currently i am doing this manually at CMD prompt.
alter index sapr3."ARFCSSTATE0" rebuild;
alter index sapr3."ARFCSSTATE~01" rebuild;
I have found this under Oracle Scripts,
This script will rebuild a list of indexes.
select 'alter index '|| index_name || ' rebuild nologging;' from dba_indexes where owner = ' ' --insert database name here
Would this script apply in my case and how can i use it.
Yes this script will produce a line of sql for each index owned by the user identified in the 'owner = ' clause.
If you send this output to a file eg rebuild.sql - place 'spool rebuild.sql' before this sql then run the rebuild.sql script eg
set heading off
set pages 0
set feed off
set echo off
select 'alter index '|| index_name || ' rebuild nologging;' from dba_indexes where owner = ' your owners name';
This will set the environment for the sql (the set cmds) open the file rebuild.sql and insert the select cmds to the file. Close the file and then run the file (@rebuild)
Hope this helps
Click Here to Expand Forum to Full Width