Check if database is open via ksh script
"ORA-01219: database not open: queries allowed on fixed tables/views only".
ps -ef|grep -v grep| grep $ORACLE_SID | grep ora_pmon > /dev/null
if (( $? == 0 )) # is the pmon process running zero is yes
then
#check if sqlplus is installed
if [ -f $ORACLE_HOME/bin/sqlplus ]
then
sqlplus -s "/ as sysdba" <<! >> $FILE1
set lines 132
set wrap off
select * from dba_data_files;
exit;
!
fi
fi
If I just run select name from v$database;, it returns the result without an issue but does not work on dba_data_files and other similar tables and views.