Disclaimer

Monday, 12 July 2021

DB Size - Shell script

 $ cat database_size.sh


TIMESTAMP=`date +%Y%m%d`
for i in `ps -ef|grep pmon|grep -v grep|grep -vi asm|awk '{print $9}'|awk 'BEGIN{FS="_"}{print($3)}'`
do
export ORAENV_ASK=NO
export ORACLE_SID=$i
. oraenv
sqlplus -s "/ as sysdba"  << EOF
set pages 300
set lines 300
col INSTANCE_NAME for a25
select name from v\$database;
select sum(bytes)/1024/1024/1024 size_in_gb from dba_data_files;
spool off
EOF
done



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...