in reply to How to change a script's environment after the script is already run, based on shell sourcing ?

On my Oracle systems there is a file /var/opt/oracle/oratab. This associates ORACLE_SID to a home directory and has the general form
SID:ORACLE_HOME:<Y|N>
The last bit is where the database gets started at boot time.

Now I only have one database but I do run scripts via cron whereby the environment isn't always correct. I then set ORACLE_HOME and ORACLE_SID in a <BEGIN> block or just in the script. Both seem to work.

With Sybase I seem to need a conditional bit of code that checks for the environment variable SYBASE and if not existing then sets it and execs the script over itself. This may be needed to point to different libraries but with Oracle you should only need one set of libraries to use as the client even if connecting to a different database.

I guess I could write a wrapper shell script but that then means two files to maintain.

  • Comment on Re: How to change a script's environment after the script is already run, based on shell sourcing ?
  • Select or Download Code