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

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...