DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Saturday, October 3, 2015

How to create histogram using shell script

#usage create_histogram.ksh <INSTANCE> <DBPASSWD> <ORACLE_HOME>
if [ "$#" -eq "3" ] ; then
export ORACLE_SID=$1
export DBPASSWD=$2
export ORACLE_HOME=$3
export MAILEE=""xyz@doyensys.com"
. /home/oracle/ora_PROD.env

echo "Creating Histogram ...."  > /home/oracle/siebel_stats_gathering/sbltesthist.log
$ORACLE_HOME/bin/sqlplus -s <<EOF>> /home/oracle/siebel_stats_gathering/sbltesthist.log
cai_dba/${DBPASSWD}
set pagesize 0
set linesize 100
select 'Started At : '||to_char(sysdate,'DD/MON/YYYY HH:MI:SS') from dual;

analyze table SIEBEL.S_SRV_REQ COMPUTE STATISTICS FOR COLUMNS template_flg SIZE 10;
select 'Ended At   : '||to_char(sysdate,'DD/MON/YYYY HH:MI:SS') from dual;
select 'Started At : '||to_char(sysdate,'DD/MON/YYYY HH:MI:SS') from dual;
ANALYZE TABLE siebel.S_SRV_REQ ESTIMATE STATISTICS FOR COLUMNS PRDINT_ID;

select 'Ended At   : '||to_char(sysdate,'DD/MON/YYYY HH:MI:SS') from dual;
EOF
mailx -s "Histogram creation in ${ORACLE_SID}/`hostname` Completed" $MAILEE < /home/oracle/siebel_stats_gathering/sbltesthist.log
else
echo "usage create_histogram.ksh <INSTANCE> <DBPASSWD> <ORACLE_HOME>"
fi

No comments: