Re: UNIX question: switching instances

From: David Crowson <zdxc0d_at_amoco.com>
Date: Wed, 3 Nov 1993 14:05:53 GMT
Message-ID: <CFx5tv.2Bq_at_trc.amoco.com>


In article 1_at_corp02.d51.lilly.com, jl34778_at_corp02.d51.lilly.com writes:
-->I'm a VAX bigot trying to learn UNIX and am having fits.
-->
-->The UNIX environment that I have set up has more that one instance, and I want
-->to make it easy for people to switch from one to another. Since we are running
-->under the C-shell, I know that they could do this:
-->
-->% source /opt/bin/coraenv
-->ORACLE_SID [dev]:
-->
-->What I want to be able to do is to set up a command that accepts the SID name
-->as a parameter and switches it for them.
-->
-->% inst dev
-->
-->However, if I create a script file to do this, any changes made to ORACLE_SID
-->seem to only be in effect while I'm in the script. When I exit back out,
-->ORACLE_SID is unchanged.
-->
-->The contents of inst look something like this:
-->
-->setenv ORACLE_SID $1
-->senenv ORAENV_ASK no
-->source /opt/bin/coraenv
-->
-->Any suggestions? How do the rest of you unix people have people switch from
-->one instance to another?

Use an alias for each instance e.g % alias instance_one 'source ~oracle/dba/set_instance_1'

                                    % alias instance_two 'source ~oracle/dba/set_instance_2 '
where ~oracle/dba/set_instance_1 contains

#!/bin/csh -f
# set ORACLE environment
setenv ORACLE_SID 1ST_DB
echo $ORACLE_SID

and ~oracle/dba/set_instance_2 contains

#!/bin/csh -f
# set ORACLE environment
setenv ORACLE_SID 2ND_DB
echo $ORACLE_SID

where 1st_DB and 2ND_DB are the SID's

then just get the user to type % instance_one or % instance_two and it will set the correct SID and echo what it has set.

=%^)

---
------------------------------------------------------------------------------
David Crowson   =%^)   |"For my part, I travel not to go anywhere, but to go. 
Oracle DBA(Ver.4,5,6,7)| I travel for travel's sake. The great affair is to
Amoco Exploration      | move, to get down off this featherbed of civilisation
Ealing, London         | and to find the globe granite underneath and strewn
"My views not Amoex's" | with cutting flints" : Robert Louis Stevenson
Received on Wed Nov 03 1993 - 15:05:53 CET

Original text of this message