Errors when trying to run korn shell script [message #157553] |
Fri, 03 February 2006 04:21 |
oraclechick
Messages: 33 Registered: February 2006
|
Member |
|
|
Hi,
I have a korn shell script to create an oracle database. I am trying to execute this script as the oracle user. First of all, I'm not sure which is the correct way of doing this - I have tried the following ways...
1)oracle@servername ~> /bin/ksh createdb.sh
2)oracle@servername ~> . createdb.sh
3)oracle@servername ~> ./createdb.sh
If i am not mistaken, they are all acceptable ways of executing a script...or not?
Secondly, I get the following errors for each of the different ways. I'm not sure what kind of errors I'm looking at here. What is ^M? What are the things in my script that i need to look out for or might need to ammend to get rid of these errors?
I would appreciate all the help i can get! Thanks in advance!
oracle@servername ~> /bin/ksh createdb.sh
createdb.sh[14]: ^M: not found
createdb.sh[21]: ^M: not found
createdb.sh[24]: ^M: not found
createdb.sh[26]: syntax error at line 27 : `<<' unmatched
oracle@servername ~> . createdb.sh
: command not found
: command not found
: command not found
-bash: createdb.sh: line 235: syntax error: unexpected end of file
oracle@servername ~> ./createdb.sh
/bin/ksh: ^M: not found
|
|
|
Re: Errors when trying to run korn shell script [message #157556 is a reply to message #157553] |
Fri, 03 February 2006 05:11 |
orausern
Messages: 826 Registered: December 2005
|
Senior Member |
|
|
Correct way is: ./createdb.sh
In this script, you can include the following as first line:
#!/usr/bin/ksh
About the errors you get, this is due to certain special characters that need to be removed from file.Try the command:
#dos2unix <oldfilename> <newfilename>
here <oldfilename> is createdb.sh and new file name you can give some other name like createdb1.sh and then try using the new createdb1.sh like
./createdb1.sh
|
|
|
|
|
Re: Errors when trying to run korn shell script [message #157605 is a reply to message #157595] |
Fri, 03 February 2006 09:19 |
oraclechick
Messages: 33 Registered: February 2006
|
Member |
|
|
I am getting all these errors when executing my script...
SP2-0158: unknown SET option "#"
SP2-0158: unknown SET option "#"
SP2-0158: unknown SET option "#"
SP2-0158: unknown SET option "#"
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[/<password>][@<connect_identifier>] | /
ORA-01012: not logged on
In my script, all the # refer to comments, so i dont know what these errors mean? Is there something special i need to look out for?
|
|
|
Re: Errors when trying to run korn shell script [message #157715 is a reply to message #157605] |
Sat, 04 February 2006 10:07 |
oraclechick
Messages: 33 Registered: February 2006
|
Member |
|
|
I have managed to solve those sql*plus errors, but now i am getting the following errors when i run my script....
ORA-24324: service handle not initialized
ORA-24323: value not allowed
ORA-01089: immediate shutdown in progress - no operations are permitted
I think these errors are refering to these 2 lines in my script...
echo "`export ORACLE_SID=${srcsid}`"
run_sql "shutdown immediate;"
The ${srcsid} parameter was given in the command line, so why am i getting the ORA-24323 error, which means that the value is null where the value for the parameter mandatory is, right?
And what do the other errors mean and how do I solve them?
Thanks.
|
|
|
Re: Errors when trying to run korn shell script [message #157825 is a reply to message #157715] |
Mon, 06 February 2006 07:34 |
orausern
Messages: 826 Registered: December 2005
|
Senior Member |
|
|
Hi,
I think that, one way could be, at least for the time being, you can try not to pass the parameter from the command line, rather define that variable inside the script itself and then see if you get the same error.
Also for debugging a shell script, you can put several echo messages inside the script to find out EXACTLY WHERE, you are running into problems.
|
|
|
Re: Errors when trying to run korn shell script [message #157835 is a reply to message #157825] |
Mon, 06 February 2006 09:19 |
oraclechick
Messages: 33 Registered: February 2006
|
Member |
|
|
This problem has nothing to do with my script actually. I get the same errors when i log into sql*plus as the oracle user and try to do a shutdown.
Also, I got this error message when i tried to startup the enterprise manager....
oracle@server ~> emctl start dbconsole
OC4J Configuration issue. /u01/app/oracle/product/10.2.0/oc4j/j2ee/OC4J_DBConsole_server_database not found.
I assume they might be related but i have no idea actually what this error means and how to solve it.
|
|
|
Re: Errors when trying to run korn shell script [message #157836 is a reply to message #157835] |
Mon, 06 February 2006 09:24 |
orausern
Messages: 826 Registered: December 2005
|
Senior Member |
|
|
ensure that you set the oracle_sid properly is the only thing that comes to me now..can you post all the commands and errors that you get as you try to shutdown from sqlplus? (being connected as sys user, and having set the oracle_sid , pl. upload the command for shutdown and the error.)
|
|
|