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

How to recovery PDB when PDB database is dropped in Oracle

  How to recovery PDB when PDB database is dropped :) [oracle@rac01 ~]$ sqlplus '/as sysdba' SQL*Plus: Release 21.0.0.0.0 - Product...