Batch file is not getting executed [message #592749] |
Mon, 12 August 2013 01:45  |
ishika_20
Messages: 339 Registered: December 2006 Location: delhi
|
Senior Member |
|
|
Dear All,
In my script, i have mentioned oracle_home, oracle_sid etc. Below are the commands -
echo .
echo +-----------------------------------------+
echo Database Refresh Utility
echo +-----------------------------------------+
echo .
echo .
echo .
echo .
echo .
export ORACLE_HOME=usr/oracle/app/oracle/product/11.2.0/dbhome_1;
export ORACLE_SID=TAGITEST;
export PATH=/usr/sbin:$PATH;
echo "Enter the database name :"
read dbnm
While running the batch file, getting the below error.
oracle:/usr/backup>sh impdp_TAGIC_general_39.152.sh
.
+-----------------------------------------+
Database Refresh Utility
+-----------------------------------------+
.
.
.
.
.
: command not found_39.152.sh: line 10:
: command not found_39.152.sh: line 11:
: command not found_39.152.sh: line 12:
Enter the database name :
same thing when i check it separately, it's doesn't show any problem.
oracle:/usr/backup>
oracle:/usr/backup>export ORACLE_HOME = usr/oracle/app/oracle/product/11.2.0/dbhome_1;
-bash: export: `=': not a valid identifier
-bash: export: `usr/oracle/app/oracle/product/11.2.0/dbhome_1': not a valid identifier
oracle:/usr/backup>export ORACLE_HOME=usr/oracle/app/oracle/product/11.2.0/dbhome_1;
oracle:/usr/backup>export ORACLE_SID=TAGITEST;
oracle:/usr/backup>export PATH=/usr/sbin:$PATH;
oracle:/usr/backup>
As i don't know much about the shell scripting. So, unable to rectify the problem. Kindly assist me to solve the problem.
Regards,
Ishika
|
|
|
|
|
Re: Batch file is not getting executed [message #592753 is a reply to message #592751] |
Mon, 12 August 2013 02:25   |
ishika_20
Messages: 339 Registered: December 2006 Location: delhi
|
Senior Member |
|
|
Dear Lalit Kumar B,
No. I have not user #!/bin/bash.
Here i got one clue. When I created new sh file in linux, with export of ORACLE_HOME & ORACLE_SID, it's worked.
But, when i extract it to windows server and done changes and placed again to linux, it's give same error.
let me work on it and share my observation.
Your suggestion is also welcome.
Thanks for sharing your valuable opinion to me
Regards,
Ishika
|
|
|
|
Re: Batch file is not getting executed [message #592765 is a reply to message #592753] |
Mon, 12 August 2013 03:30   |
 |
Michel Cadot
Messages: 68757 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:But, when i extract it to windows server and done changes and placed again to linux, it's give same error.
Did you transfer in TEXT mode and not BIN one?
Also
Michel Cadot wrote on Mon, 12 August 2013 09:13PATH must contain $ORACLE/bin
In addition, if you use the old shell (sh), you must first set the variable then export it you can't do it on the same command:
ORACLE_HOME=usr/oracle/app/oracle/product/11.2.0/dbhome_1;export ORACLE_HOME
Regards
Michel
[Updated on: Mon, 12 August 2013 03:31] Report message to a moderator
|
|
|
Re: Batch file is not getting executed [message #592782 is a reply to message #592753] |
Mon, 12 August 2013 06:16   |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
ishika_20 wrote on Mon, 12 August 2013 12:55But, when i extract it to windows server and done changes and placed again to unix, it's give same error.
Hey, a lot of things could change when you edit in windows and place it back to unix. I have often seen CTRL-M (carriage return) characters when editing in windows.
1. Try dos2unix script.sh, to convert from windows to unix format.
2. Another way is set -x or bash -x scriptname.sh
3. Or, od -xcb testscript.sh for blank lines etc.
[EDIT : Provided link for dos2unix reference]
[Updated on: Mon, 12 August 2013 06:18] Report message to a moderator
|
|
|
Re: Batch file is not getting executed [message #592796 is a reply to message #592782] |
Mon, 12 August 2013 07:19   |
ishika_20
Messages: 339 Registered: December 2006 Location: delhi
|
Senior Member |
|
|
Dear Michel,
I have transfer it in binary mode only.
Dear Lalit Kumar B,
You are correct. When did the same thing in linux, without error its ran.
Steps- What i have done
1) created vi file
2) copied the command
3) ran it through sh shell
4) it ran without error.
Thanks to you all.
Regards,
Ishika
|
|
|
|
|