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

OCI - Interview Questions and Answers - 2

  OCI Foundations – Mock Test 2 (40 Questions)--- Section 1: Getting Started with OCI (6 Questions) Q1. What happens when you create a new O...