Logo

UNIX Shell Script

Database Size

Tested on Oracle 8.0 Tested on Oracle 7

Updated : 08-January-2002
Version : 1.0

Description

Displays physical size off all databases on a UNIX Machine.

Parameters

None

Shell Source

#!/bin/ksh
export PATH=/usr/local/bin:$PATH
# Locate oratab file, exit if we can't find it
if [ -f /etc/oratab ]; then
  ORATAB="/etc/oratab" ;
elif [ -f /var/opt/oracle/oratab ]; then
  ORATAB="/var/opt/oracle/oratab" ;
else
  echo
  echo "ERROR: Unable to locate oratab file"
  exit 1 ;
fi
for i in `egrep '^[a-zA-Z].*:.*:.*$' $ORATAB | awk -F: '{ print $1}' | sort -u `
do
  
   export ORACLE_SID=$i
   export ORAENV_ASK=NO
   . oraenv 2>/dev/null

   sqlplus -s internal << EOF 2>/dev/null
col Mb form 999,999
select name, sum(bytes)/1024/1024 Mb from dba_data_files, v\$database
group by name;
exit
EOF

done

Return to Index of SQL Scripts


Home | Company Profile | Services | Contact Us | SQL scripts and tips | Quiz
Legal

Logo