Operating System - Linux
1748018 Members
3250 Online
108757 Solutions
New Discussion юеВ

Re: Problem with haoracle_sql.sh

 
SOLVED
Go to solution
Eric Bellavance
Occasional Advisor

Problem with haoracle_sql.sh

Hi,

We have 2 SLES 9 SP2 server running HP SG/LX A.11.16. We also have installed Oracle Toolkit A.02.10

We try to test the set up to ensure Oracle can be properly brought up following instruction in teh README but we have problem running haoracle_sql.sh

./haoracle_sql.sh: line 133: return: can only `return' from a function or sourced script

Also according to the README we need to log on as oracle but if we run the script when logged on as oracle the script ask for password...

Any idea what go wrong with the script?

Regars,

Eric Bellavance
Ministere des Finances
10 REPLIES 10
Ivan Ferreira
Honored Contributor

Re: Problem with haoracle_sql.sh

It seems that you have a missplaced "return" in the script, like this:

echo "Good morning"
return 1

Should be something like:

function(){
echo "Good morning"
return 1
}

Test these scripts and you will see the same error on the first.

I think that if you post the script, more help will be available.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Eric Bellavance
Occasional Advisor

Re: Problem with haoracle_sql.sh

it's the script that come with the Oracle Toolkit from HP...

Eric Bellavance
Ministere des Finances

Ivan Ferreira
Honored Contributor
Solution

Re: Problem with haoracle_sql.sh

In this case, you can change all returns by exits, like this:

start)
start_oracle
check_status=$?
exit $check_status

;;

abort)
shutdown_oracl
e abort
check_status=$?
exit $check_status
;;

immediate)
shutdown_oracl
e immediate
check_status=$?
exit $check_status


PD: Don't forget to assign points to people that help you in every topic that you made.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Eric Bellavance
Occasional Advisor

Re: Problem with haoracle_sql.sh

Ok, I have no more errors about the 'return' but is still not working...

Have you been able to run haoracle_sql.sh?

Eric Bellavance
Ministere des Finances
Ivan Ferreira
Honored Contributor

Re: Problem with haoracle_sql.sh

I never configured service guard, I just helped you with the script because is a general issue. But, what is the problem that you have when run the script? Did you pass the arguments required to the script? The script should be run as this:

haoracle_sql.sh start

Other thing, I think that the script should be run as root, because in the script there is a su - oracle, that's why you are prompted for a password.

If you run as root, as service guard should do, the script will then su to oracle and run the commands.

There are a lot of environment variables in this script, I think that you will need to modify further the script.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Eric Bellavance
Occasional Advisor

Re: Problem with haoracle_sql.sh

We start the script using this command:

./haoracle_sql.sh start ${ORACLE_HOME} ${ORACLE_SID}

Effectively the script won't start if we are not the root. The doc say we have to log on as oracle before running the script but we see we cannot do that...

If have move this two lines

command="pfile=$PFILE";
exit_status=1;

just before the line

su - ${ORACLE_ADMIN} <
...and now our oracle db start...

Do you know the meaning of <
Why just moving the 2 lines correct the script?

Regards,

Eric Bellavance
Ministere des Finances
Ivan Ferreira
Honored Contributor

Re: Problem with haoracle_sql.sh

The << EOF means that all commands until the next EOF will be executed:

<< EOF

run this
and this
and this
and this
stop here

EOF
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Eric Bellavance
Occasional Advisor

Re: Problem with haoracle_sql.sh

Thank's

We understand a little more what the script do...

Eric Bellavance
Ministere des Finances
melvyn burnard
Honored Contributor

Re: Problem with haoracle_sql.sh

When you say "you start the script using this command"

I assume this is from the command line, and not from the control script.

I have installed this toolkit at a number of sites, and have had no problems with it.
There is a good README with the toolkit that explains the useage, as well as the manuals at docs.hp.com
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!