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 CSSD Heartbeat Mechanisms in Oracle RAC

  Understanding CSSD Heartbeat Mechanisms in Oracle RAC The Cluster Services Synchronization Daemon (CSSD) is a critical process in Oracle...