shell script

usercnt.sh

Purpose
Create a script that can be run via cron to periodically gather info about user counts. This can be useful for helping diagnose connection pools that are not releasing their connections.

Set the following variables according to your environment:
ORACLE_SID, ORACLE_HOME, PROJDIR

Note: The Backslash contained in the v$session reference is so the $ character is escaped properly. If you repurpose this script keep in mind any $ symbols in the text passed to SQLPLUS from the shell script must be escaped in the manner.

usercnt.sh

Shell Script to Run a SQLPLUS against all databases running on a server...

#!/usr/bin/bash
#---------------------------------------------------------------------------
# Written by : David Mann @ http://ba6.us
# Script Name : alldatafiles.sh
# Description : Provides list of all datafiles for each running database on
# on a machine
#---------------------------------------------------------------------------

ORATAB=/etc/oratab
echo "INSTANCE_NAME, FILE_NAME"

# Step through running instances
ps -ef | grep ora_smon_ | grep -v grep | cut -b61-70 | while read LINE
do
# Assign the ORACLE_SID
ORACLE_SID=$LINE

Subscribe to shell script