1748150 Members
3654 Online
108758 Solutions
New Discussion юеВ

Re: WHAT DID I DO WRONG

 
SOLVED
Go to solution
Deanna Tran
Frequent Advisor

WHAT DID I DO WRONG

Here is the script that I used to start up the database.
#!/bin/sh
#Match ORACLE_HOME with whatever is in oracle/.profile
ORACLE_HOME=/u01/product/9.0.1
PATH=${PATH}:$ORACLE_HOME/bin
export ORACLE_HOME PATH
ORACLE_OWNER=oracle
case $1 in
start)
/usr/bin/su - oracle -c $ORACLE_HOME/bin/dbstart &
/usr/bin/su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"
exit 0
;;
stop)
/usr/bin/su - oracle -c "$ORACLE_HOME/bin/lsnrctl stop"
/usr/bin/su - oracle -c $ORACLE_HOME/bin/dbshut
;;
esac

- I ran the script to make sure it was corrected written...
/sbin/init.d/oracle start
--- however when i check if there is any instance of oracle running
ps -ef | grep ora
nothing return except for this:
oracle 4219 1 0 10:00:24 ? 0:00 /u01/product/9.0.1/bin/tnslsnr L
ISTENER -inherit
However, when I try to create an instance of the database here is what i get as an error try to login system/manager as dba


ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
HP-UX Error: 2: No such file or directory
16 REPLIES 16
Jeff Schussele
Honored Contributor

Re: WHAT DID I DO WRONG

Deanna,

Looks like you forgot the quotes around the command for the su -c param in the start script.

Also you don't need the brackets around the PATH - you just need $PATH.

Also do you want the ORACLE_OWNER exported?
Maybe you should declare it ahead of the export & export it also.

HTH,
Jeff

PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
pap
Respected Contributor
Solution

Re: WHAT DID I DO WRONG

Hi ,
Do this thing.
try to run your script in debug mode so that you can test it and find out where the things were wrong. I suppose you forgot to put " sign after su -c option.

run the script again as below

# /sbin/sh -xv /sbin/init.d/oracle start

This will give you if there are any errors.
You can easily figure out what went wrong with the script. check the exit code after the execution of script in debug mode if it is 0 then your script is OK.

Let me know if you still have any problems.
Thanks,
-Piyush

"Winners don't do different things , they do things differently"
A. Clay Stephenson
Acclaimed Contributor

Re: WHAT DID I DO WRONG

Hi:

The first thing to change is the su - -c xxx to simply su -c xxx. You do not want to source .profile because it almost certainly has stuff like tset and tabs which assume you are connected to a terminal. The preferred method for doing something like this os to create a file like /usr/local/bin/oraenv.sh which contains something like:
ORACLE_BASE=aaa
ORACLE_HOME=${ORACLE_BASE}/bbb
PATH=${PATH}:${ORACLE_HOME}/bin
TNS_ADMIN=ccc
...
...
export ORACLE_BASE ORACLE_HOME PATH TNS_ADMIN

and anything else you need. Make sure that there is no exit statement.

Then both your startup script in init.d AND your oracle .profile should source this file
thusly:
. /usr/local/bin/oraenv.sh

This will set and export the needed variables while not requiring an interactive environment.

Plan B:

Surround any statements in .profile that might be interactive with:
if [ -t 0 ]
then
tset ....
fi

This will check to see if you are connected to a terminal before running the commands.

Regards, Clay

If it ain't broke, I can fix that.
Deanna Tran
Frequent Advisor

Re: WHAT DID I DO WRONG

I fixed the script as you all recommended,
but it gives me back lot of problem
here is the script, and please help me
. /usr/local/bin/oraenv
ORACLE_HOME=/u01/product/9.0.1
ORACLE_SID=dia2
PATH=${PATH}:{$ORACLE_HOME}/bin
export ORACLE_HOME PATH TNS_ADMIN

export ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart]
then
echo " ORACLE startup : cannot start"
exit
fi
case $1 in
start)
/usr/bin/su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"
/usr/bin/su - oracle -c $ORACLE_HOME/bin/dbstart &
#/usr/bin/su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"
exit 0
;;
stop)
/usr/bin/su - oracle -c "$ORACLE_HOME/bin/lsnrctl stop"
/usr/bin/su - oracle -c $ORACLE_HOME/bin/dbshut
;;
SHABU KHAN
Trusted Contributor

Re: WHAT DID I DO WRONG

Hi Deanna,

I am running 8.1.7 and see below my startup script, I do not start listener at startup but do it manually at the command prompt only if needed

# Set ORA_HOME to be equivalent to the ORACLE_HOME
# from which you wish to execute dbstart and
# dbshut
# set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME
ORA_HOME=/apps/oracle/product/8.1.7
ORA_OWNER=oracle
if [! -f $ORA_HOME/bin/dbstart]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')

# Start the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values

su - $ORA_OWNER -c $ORA_HOME/bin/dbstart &
;;
'stop')

# Stop the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values

su - $ORA_OWNER -c $ORA_HOME/bin/dbshut &
;;
esac

I assume you are able to start oracle as the oracle user and works okay...?

Thanks,
Shabu
SHABU KHAN
Trusted Contributor

Re: WHAT DID I DO WRONG

Deanna,

I don't think you have to set your oracle SID in your startup script, the dbstart script that you execute actually gets the SID from your oratab file...

Let us know if you still have problems ...

Thanks,
Shabu
Deanna Tran
Frequent Advisor

Re: WHAT DID I DO WRONG

I have oracle 9i instead of 8
this message is for shabu..
Would you please clarify your question a little bit for me " able to start oracle as oracle user"...??

To answer your question , I wasn't able to use
sqlplus to log in at all?
this is what i did
sqlplus /nolog
sql> connect system/manager as SYSDBA;
it gave this error message :
ORA-12705: invalid or unknown NLS parameter value specified
SHABU KHAN
Trusted Contributor

Re: WHAT DID I DO WRONG


Deanna,

What happens when you login as oracle and try to start the oracle database using dbstart ?

What is the output of:
ps -ef|grep oracle

I would first try to startup the database manually and then when everything works I would setup the startup scripts (/sbin/init.d/db.ora)

Also I am not sure if oracle 9i has the srvrmgrl utility, if it has then I would try starting the database using srvrmgrl.

As oracle:
srvrmgrl
SRVRMGRL>connect internal
SRVRMGRL>startup
SRVRMGRL>exit

-Shabu
Deanna Tran
Frequent Advisor

Re: WHAT DID I DO WRONG

hi,
How would you start up the database manually?
ps -ef | grep ora
> give me back nothing
sqlplus internal
ask me for the password???
I really need to have this thing running??
Please help