Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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

Deanna Tran
Frequent Advisor

Re: WHAT DID I DO WRONG

hi shabu

I did try your suggestion but still I wasn't able to log in to the oracle database

su - oracle
$ORACLE_HOME/bin/lsnrctl start
this is what I get when i run that command
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for HPUX: Version 9.0.1.0.0 - Production
Start Date 12-MAR-2002 15:19:30
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File /u01/product/9.0.1/network/admin/listener.ora
Listener Log File /u01/product/9.0.1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=princess.tucson.ibm.com)(PORT=1521))
)
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "sales" has 1 instance(s).
Instance "dia2", status UNKNOWN,

ps -ef | grep ora
give me this
oracle 8433 8350 0 15:18:16 pts/ta 0:00 -su
oracle 8458 1 0 15:19:30 ? 0:00 /u01/product/9.0.1/bin/tnslsnr L
ISTENER -inherit
oracle 8462 8433 0 15:20:19 pts/ta 0:00 grep ora
oracle 8461 8433 1 15:20:19 pts/ta 0:00 ps -ef


SHABU KHAN
Trusted Contributor

Re: WHAT DID I DO WRONG

Hi Deanna,

I am sorry I had a production issue here at work and couldn't get back to you...

Anyway, what happens when you execute

./dbstart

from the command line..

-Shabu
SHABU KHAN
Trusted Contributor
Andreas D. Skjervold
Honored Contributor

Re: WHAT DID I DO WRONG

Hi

This is what you'll have to do:
as the Oracle software owner (os user oracle),
set the env variable ORACLE_SID=.
-sqlplus sys/passwd as sysdba
-SQL>startup

The database should now mount and open.

Check with ps -ef |grep ora that you have the ora_ background processes.

If this fails, you have done something wrong in setting up and creating your database.
Check:
-Did you create a database?
Check the alert.log in $ORACLE_BASE/admin/bdump for create info and error messages related to the startup.

-Have you linked init.ora to $ORACLE_HOME/dbs/init>SID>.ora ?
If not link or use the "startup pfile= " syntax while starting the database.

If you get your database up and running manually, its time to start looking at the /sbin/init.d/oracle script.
What this does is simply calling the dbora script in your oracle installation.
First try running dbstart and dbstop and get them running. Remember to update the /etc/oratab file with your database:
:/oracle/product/9.0.1:Y

If you got these running (ie stops and start the database) then start work on the /sbin/init.d/oracle script.


Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
SHABU KHAN
Trusted Contributor

Re: WHAT DID I DO WRONG


Deanna,

Can you assign points to folks who have responded to your posting please ?

-Shabu
Deanna Tran
Frequent Advisor

Re: WHAT DID I DO WRONG

I did create a database called
initdia2.ora in the $ORACLE_HOME/dbs directory.
HOw do i link this file as you suggested?
Victor Geere
Frequent Advisor

Re: WHAT DID I DO WRONG

I got the same message when I tried to connect in SQLPLUS.
The oracle .profile includes the following lines:

NLS_LANG=AMERICAN-AMERICA.WE8ISO8859P1; export NLS_LANG
NLS_LANGUAGE=$NLS_LANG; export NLS_LANGUAGE
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data; export ORA_NLS33

ORA-12705: invalid or unknown NLS parameter value specified

Has anybody found a solution to this yet?
I thought that I was because I had thought.