Just in case someone may ask, "test.out" does get opened and written to, this code executes as root, "oraenv" is an executable with sufficient privileges.
Here's the code:
#!/usr/bin/perl -w use strict; my ( $ScriptName, $TAG ); my $file = "/export/home/scratch/test.out"; my $oratabFile = "/var/opt/oracle/oratab"; my $date = `/bin/date`; open ORATAB, "<$oratabFile" or die "$!\n"; open FILE, ">>$file" or die "$!\n"; my ( $host, $sid, $type ) = split ( '\_', $ENV{NB_ORA_PC_SCHED} ); while ( my $oraLine = <ORATAB> ) { chomp $oraLine; my ( $oraSID, $oraHome, $oraType ) = split ( '\:', $oraLine ); if ( $oraSID = $sid ) { $ENV{ORACLE_HOME} = $oraHome; $ScriptName = "$oraSID" . '_' . "$type.sh"; $TAG = $ENV{NB_ORA_PC_SCHED}; } } $ENV{ORAENV_ASK} = "NO"; $ENV{ORACLE_SID} = $sid; `export ORAENV_ASK ORACLE_SID ORACLE_HOME`; system(". /apps/oracle/bin/oraenv"); #################################### # # # Begin loop which will determine # # what type of backup to run # # # #################################### print FILE "\n\n\n"; print FILE "$ENV{NB_ORA_PC_SCHED} is a COLD backup"; print FILE "\n\n\n"; print FILE "====================================================\n"; print FILE "Printing environmental vars for troubleshooting\n"; print FILE "====================================================\n"; print FILE "\n\n\n"; print FILE `/usr/ucb/printenv`; print FILE "\n\n\n"; print FILE "====================================================\n"; print FILE "End Troubleshooting Section\n"; print FILE "====================================================\n"; print FILE "\n\n\n"; close ORATAB; close FILE;
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |