Hi,

On Thu, Nov 12, 2009 at 05:17:50PM +0100, Zimmermann, Pierre wrote:
> Dear Dejan Muhamedagic
> We have used your oracle resource script to build an Oracle Cluster on SLES11 
> HAE. Many TNX for that.

Welcome.

>  Coz we use more than one Oracle instance we were forced with a small problem:
>  
> Oracle was not able to start due to a missing SID. (we have not set the 
> ORACLE_SID variable in the profile, because we have more than one)
> But the SID was given as a parameter for the oracle resource instead.
> The problem was, that the variable $ORACLE_SID was not forwarded to the 
> sqlplus statement in the execsql function. It get lost after the “su - 
> $ORACLE_USER”

That shouldn't have happened, but obviously it does. I could
swear that I tested it with multiple Oracle instances, but that
was ages ago.

> So our solution was to set the ORACLE_SID explicit in this statement within 
> the “su –“ in Line 256. This works fine:
> su - $ORACLE_OWNER -c "export ORACLE_SID=$ORACLE_SID; $sqlplus -S /nolog"

That certainly wouldn't hurt, but I can see that there are more
variables exported. I guess the best would be to create a
temporary file and then to source it. Any chance that you test
oracle/oralsnr with the patch from these changesets:

changeset:   1535:c9662d9664cf
tag:         tip
user:        Dejan Muhamedagic <[email protected]>
date:        Fri Nov 13 17:05:21 2009 +0100
summary:     Dev: oracle/oralsnr: add dumporaenv function

changeset:   1534:bbb8076083ab
user:        Dejan Muhamedagic <[email protected]>
date:        Fri Nov 13 17:03:49 2009 +0100
summary:     Medium: oracle/oralsnr: export variables properly

Also attached.

Cheers,

Dejan


>  
> cu
> Taras Grytsulyak and Pierre Zimmermann
>  
> Mit freundlichen Grüßen / Kind regards
>  
> Pierre Zimmermann
> Professional Systems
>  
> SMP Management AG
> Heidenkampsweg 101
> D-20253 Hamburg
>  
> M:   +49 162 2 4444 - 29
> F:   +49 162 50 2 4444 - 29
>  
> T:   +49 40 3289 1980 - 0
> F:   +49 40 3289 1980 - 99
>  
> E-Mail:  [email protected]
> Internet: http://www.smp-it.com
>  
> Rechtsform: AG - Vorstand: Marcus Heese – Olaf Gnosa – Stefan van der Weck
> Aufsichtsratsvorsitzende: Doris Dierbach 
> Registergericht: Amtsgericht Hamburg - Registernummer: HRB 104985
> P Bitte denken Sie an die Umwelt, bevor Sie diese E-Mail ausdrucken - Please 
> think about the environment before printing this email.
>  


> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems

diff -r 5d65380aaa23 heartbeat/oracle
--- a/heartbeat/oracle  Fri Nov 13 13:19:03 2009 +0100
+++ b/heartbeat/oracle  Fri Nov 13 17:07:21 2009 +0100
@@ -246,6 +246,19 @@
        export ORACLE_SID ORACLE_HOME ORACLE_OWNER TNS_ADMIN
        export LD_LIBRARY_PATH LIBPATH
 }
+dumporaenv() {
+cat<<EOF
+PATH=$ORACLE_HOME/bin:$ORACLE_HOME/dbs:$PATH
+ORACLE_SID=$ORACLE_SID
+ORACLE_HOME=$ORACLE_HOME
+ORACLE_OWNER=$ORACLE_OWNER
+LD_LIBRARY_PATH=$ORACLE_HOME/lib
+LIBPATH=$ORACLE_HOME/lib
+TNS_ADMIN=$ORACLE_HOME/network/admin
+export ORACLE_SID ORACLE_HOME ORACLE_OWNER TNS_ADMIN
+export LD_LIBRARY_PATH LIBPATH
+EOF
+}
 
 #
 #      Run commands as the Oracle owner...
@@ -254,7 +267,7 @@
        if [ "$US" = "$ORACLE_OWNER" ]; then
                $sqlplus -S /nolog
        else
-               su - $ORACLE_OWNER -c "$sqlplus -S /nolog"
+               su - $ORACLE_OWNER -c ". $envtmpf; $sqlplus -S /nolog"
        fi
 }
 
@@ -630,6 +643,10 @@
 fi
 
 setoraenv # important: set the environment for the SID
+envtmpf=`mktemp`
+dumporaenv > $envtmpf
+chmod 644 $envtmpf
+trap "rm -f $envtmpf" EXIT
 procs="ps -e -o pid,args | grep -i \"[o]ra.*$ORACLE_SID\""
 
 US=`id -u -n`
diff -r 5d65380aaa23 heartbeat/oralsnr
--- a/heartbeat/oralsnr Fri Nov 13 13:19:03 2009 +0100
+++ b/heartbeat/oralsnr Fri Nov 13 17:07:21 2009 +0100
@@ -173,6 +173,19 @@
        export ORACLE_SID ORACLE_HOME ORACLE_OWNER TNS_ADMIN
        export LD_LIBRARY_PATH LIBPATH
 }
+dumporaenv() {
+cat<<EOF
+PATH=$ORACLE_HOME/bin:$ORACLE_HOME/dbs:$PATH
+ORACLE_SID=$ORACLE_SID
+ORACLE_HOME=$ORACLE_HOME
+ORACLE_OWNER=$ORACLE_OWNER
+LD_LIBRARY_PATH=$ORACLE_HOME/lib
+LIBPATH=$ORACLE_HOME/lib
+TNS_ADMIN=$ORACLE_HOME/network/admin
+export ORACLE_SID ORACLE_HOME ORACLE_OWNER TNS_ADMIN
+export LD_LIBRARY_PATH LIBPATH
+EOF
+}
 
 #
 #      Run commands as the Oracle owner...
@@ -181,7 +194,10 @@
        if [ "$US" = "$ORACLE_OWNER" ]; then
                $SH
        else
-               su - $ORACLE_OWNER
+               (
+               echo ". $envtmpf"
+               cat
+               ) | su - $ORACLE_OWNER
        fi
 }
 
@@ -321,6 +337,10 @@
 fi
 
 setoraenv # important: set the environment for the SID
+envtmpf=`mktemp`
+dumporaenv > $envtmpf
+chmod 644 $envtmpf
+trap "rm -f $envtmpf" EXIT
 
 #
 # default listener is "LISTENER"
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to