help on understanding this script ( linux)

ORACLE_HOME=/opt/ora10g/oracle/product/10.2.0/db_1;export ORACLE_HOME
PATH=.:$ORACLE_HOME/bin:/usr/bin;export PATH
ORACLE_SID=USUP
PASS=Figomom#0;export PASS

rm /orabkup/USUP/*.Z
if [[ ! -f /tmp/system_reboot.flg ]]
then
   echo $PASS | sqlplus system@USUP @/home/ora10g/crons/scripts/hot.sql
   echo $PASS | sqlplus system@USUP @/home/ora10g/crons/scripts/hotback.sql
fi
#compress /orabkup/USUP/*.dbf
#compress /orabkup/USUP/*.DBF

I am not too sure what is PASS=Figomom#0;export PASS and

if [[ ! -f /tmp/system_reboot.flg ]]

the above script suppose to do a hot backup . is a user- managed hot backup.

That is setting up a variable for the oracle password.
if there does not exist that reboot file, you will run sqlplus with those hot.sql and hotback.sql scripts..

1 Like
PASS=Figomom#0;export PASS

is password that is getting used to connect to database. Once you set the password you need to export it as environment variable. So whenever you need you can use it.

if [[ ! -f /tmp/system_reboot.flg ]]

is checking for system_reboot.flg is not an ordinary file, if conditions satisfies then it will do the remaining stuffs inside if condition.

1 Like

you mean there are some sort of a script inside system_reboot.flg?

---------- Post updated at 01:58 AM ---------- Previous update was at 01:55 AM ----------

you mean if there is no password stated it will reboot the system_reboot.flg? and execute the .sql ?:confused:

The system_reboot.flg should be a flag file and not a script..

this is what your script is doing:
first it sets up some variables, including the PASS, which is holding the password to log into oracle.

after setting up the variables, it removes/deletes all the files that has a file extension of Z in directory /orabkup/USUP/

Then it checks for the non-existence of the /tmp/system_reboot.flg file.
if this is indeed not present, it will run the commands found in the oracle sql files.(hotback up as you mentioned)

I hope this is clear..

1 Like

YEs is clearer now.

Check the existence of the flat file system_reboot.flg. From the name , i think is to check whether the last reboot indeed have remove / change the flag? Or is it to check for system reboot. To make sure it is not going to reboot while doing the backing?