shell script to Run manual statspack


/uis/u01/app/oracle/scripts/statsp.sh


#!/bin/ksh
#############################################################################
# TITLE......: statspack
# VERSION....: 1.0
#
# PARAMETERS.: N/A
#
#
# USAGE......:
#
# DESCRIPTION: This script collects the statspack
#############################################################################
set -x
export SCRIPTDIR=/uis/u01/app/oracle/scripts
export OUTPUTDIR=/home/oracle/scripts/logs/shell_jobs
export ORACLE_HOME=/uis/u01/app/oracle/product/11.1.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export MAILTO="xyz@acs-inc.com"
export ORACLE_SID=$i
echo "##################################Start#########################" >> ${OUTPUTDIR}/statspack_exec.log
$ORACLE_HOME/bin/sqlplus -s perfstat/perfstat@<xyz> <<EOF >> ${OUTPUTDIR}/statspack_exec.log
set lines 300
set feedback off
set echo off
set pagesize 0
col name for a13
set lines 200
select  substr(INSTANCE_NAME,1,7)"Inst Name",substr(HOST_NAME,1,13)"Hostname",to_char(Sysdate,'dd-mon-yyyy hh24:mi:ss')"SYSDATE" ,STATUS from v\$instance;
EXEC STATSPACK.SNAP;
exit
exit

at Thursday, March 29, 2012  

0 comments:

Post a Comment

Powered by Blogger.