shell script in Solaris [message #526154] |
Sun, 09 October 2011 08:06 |
dirish
Messages: 232 Registered: November 2006
|
Senior Member |
|
|
Hi,
I am using Oracle Database 10g.
I have 1 OS user who is the owner of 2 Oracle Instances.
Each time i have to say export ORACLE_SID=test, ORACLE_SID=prod
I am writing a shell script (in a menu) for example to export test and prod databases.
In the shell script i have
exp system/testpassword full=y file=/test/export.dmp log=/test/export.log
&
exp system/testpassword full=y file=/prod/export.dmp log=/prod/export.log but i have to export the ORACLE_SID before.
How can i include this in the shell script?
Thanks
Dirish
|
|
|
|
|
Re: shell script in Solaris [message #526173 is a reply to message #526167] |
Sun, 09 October 2011 23:51 |
dirish
Messages: 232 Registered: November 2006
|
Senior Member |
|
|
Hi Michel,
Thanks for the advice. Actually the client wants to go with exp/imp.
Blackswan,
The first line in red is not working
vi exp_test.sh
export ORACLE_SID=test
echo "exp system/manager full=y file=/d02/exp_tst.dmp log=/d02exp_tst.log statistics=none" | su - ora10g
Please advise
|
|
|
|
Re: shell script in Solaris [message #526188 is a reply to message #526154] |
Mon, 10 October 2011 01:37 |
dirish
Messages: 232 Registered: November 2006
|
Senior Member |
|
|
neither this one is working
vi exp_test.sh
echo "export ORACLE_SID=test" | su - ora10gecho "exp system/manager full=y file=/d02/exp_tst.dmp log=/d02exp_tst.log statistics=none" | su - ora10g
|
|
|
Re: shell script in Solaris [message #526195 is a reply to message #526187] |
Mon, 10 October 2011 01:57 |
dirish
Messages: 232 Registered: November 2006
|
Senior Member |
|
|
Hi Michel,
Thanks for the update.
Actually I have put a menu for the export, as shown below
# su - sysadmin
7. Full Database Export - Prod Database
8. Full Database Export - Test Database
0. EXIT
Choice :
So, in
exp_test1.sh must be like this?
echo "export ORACLE_SID=test" | su - ora10g
echo "exp system/manager full=y file=/d02/exp_tst.dmp log=/d02exp_tst.log statistics=none" | su - ora10g
exp_test.sh
su - ora10g -c exp_test1.sh
|
|
|
|
Re: shell script in Solaris [message #526321 is a reply to message #526173] |
Mon, 10 October 2011 09:59 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
dirish wrote on Sun, 09 October 2011 21:51Hi Michel,
Thanks for the advice. Actually the client wants to go with exp/imp.
Blackswan,
The first line in red is not working
vi exp_test.sh
export ORACLE_SID=test
echo "exp system/manager full=y file=/d02/exp_tst.dmp log=/d02exp_tst.log statistics=none" | su - ora10g
Please advise
export ORACLE_SID=test
"export" is bash command & will fail when invoked by Korn shell (sh)
ORACLE_SID=test
export ORACLE_SID
above will always succeed as as not using C-Shell
|
|
|