Disclaimer

Saturday, 15 February 2025

Index rebuild online in Oracle - shell script

 


[oracle@rac10p reorg]$ cat index_rebuild_EMP.sh

#!/bin/ksh
export ORACLE_HOME=/oracle/K12/19
export ORACLE_SID=K12
export PATH=$PATH:/$ORACLE_HOME/bin
export TS=`date +%d%m%y`
sqlplus -S / as sysdba << EOF
set heading off;
spool  /home/oracle/index_rebuild_EMP_output.log
set echo on feedback on
@/home/oracle/reorg/index_rebuild_EMP.sql
spool off;
exit;
EOF



[oracle@rac10p reorg]$ cat index_rebuild_EMP.sql
set time on timing on;
ALTER INDEX SAPDAT."EMP~0" REBUILD online parallel 6;
alter index sapdat."EMP~0" noparallel;
ALTER INDEX SAPDAT."EMP~001" REBUILD online parallel 6;
alter index sapdat."EMP~001" noparallel;
ALTER INDEX SAPDAT."EMP~002" REBUILD online parallel 6;
alter index sapdat."EMP~002" noparallel;
ALTER INDEX SAPDAT."EMP~003" REBUILD online parallel 6;
alter index sapdat."EMP~003" noparallel;
ALTER INDEX SAPDAT."EMP~004" REBUILD online parallel 6;
alter index sapdat."EMP~004" nonparallel;




No comments:

Post a Comment

Understanding SQL Plan Baselines in Oracle Database

  Understanding SQL Plan Baselines in Oracle Database SQL Plan Baseline is the feature in Oracle started from Database 11g that helps to pre...