Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I have this problem in Oracle Enterprise Linux 6.4 where whenever I switch to root from my main account, I lose the env variables I set in ORACLE_SID ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2013
    Posts
    16

    Exclamation Running the export command using shell script, done but not working


    Hi all,

    I have this problem in Oracle Enterprise Linux 6.4 where whenever I switch to root from my main account, I lose the env variables I set in ORACLE_SID and LD_LIBRARY_PATH, and many other variables I need to work on. This is important as the program I work with, specifically Oracle Database and Oracle Goldengate rely on this variables. So I created a script with the following configuration to reduce the admin effort:
    #!/bin/bash
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/home/dba/app/dba/product/gg/ogg11 &
    export ORACLE_SID=base11r2 &

    (See attachment)

    then
    bash> chmod a+x script
    bash> source ./script

    It says it is done but upon typing env, it doesn't show the variables I need. If the environment variables are set correctly, the command ./ggsci (program of Oracle Goldengate) should work properly. Any suggestions?
    Attached Images Attached Images

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,529
    Place the settings in a globally accessible file (leave out the #!/bin/bash directive), and in the .bash_profile for each user that needs these settings, add the command:
    Code:
    source path-to-oracle-settings
    Also, don't add the & (background execution) character to the end of the lines. IE, the file path-to-oracle-settings should look like this:
    Code:
    export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:/home/dba/app/dba/product/gg/ogg11
    export ORACLE_SID=base11r2
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2013
    Posts
    16
    Hi, thanks for your reply. Let me try this out. By the way, is there a way to add these commands in the startup script so I do not have to run the script I created everytime I boot the system?

    Quote Originally Posted by Rubberman View Post
    Place the settings in a globally accessible file (leave out the #!/bin/bash directive), and in the .bash_profile for each user that needs these settings, add the command:
    Code:
    source path-to-oracle-settings
    Also, don't add the & (background execution) character to the end of the lines. IE, the file path-to-oracle-settings should look like this:
    Code:
    export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:/home/dba/app/dba/product/gg/ogg11
    export ORACLE_SID=base11r2

  4. #4
    Just Joined!
    Join Date
    Jun 2013
    Posts
    16
    Finally solved my problem, as you suggested, I should remove the ampersand(&) from the script but the rest should be fine. I just needed to place the script in the directory that is globally accessible such as the home directory, ~. Afterwards, change to that directory and run source ./oraclescript

    Quote Originally Posted by Rubberman View Post
    Place the settings in a globally accessible file (leave out the #!/bin/bash directive), and in the .bash_profile for each user that needs these settings, add the command:
    Code:
    source path-to-oracle-settings
    Also, don't add the & (background execution) character to the end of the lines. IE, the file path-to-oracle-settings should look like this:
    Code:
    export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:/home/dba/app/dba/product/gg/ogg11
    export ORACLE_SID=base11r2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •