LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-05-2005, 10:49 AM   #1
deweirdt
Member
 
Registered: Sep 2003
Location: Belgium
Distribution: SUSE10.1
Posts: 40

Rep: Reputation: 15
Oracle Startup Script problem


Hi,

I'm trying to create a startup script for my database server but I don't seem to manage it.

When I exectute every command manual then it looks like it's working. But when I put it into the script then I'm not getting it to work.

Could it be because some commands are taking long to process?


This is my script

#!/bin/bash
#
# match these values to your environment:
export ORACLE_BASE=/home/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/PJS2_DB1
export ORACLE_TERM=xterm
export PATH=/home/oracle/bin:$ORACLE_HOME/bin:$ORACLE_HOME:$PATH
#export NLS_LANG='croatian_croatia.ee8iso8859p2'
export ORACLE_SID=orcl
export DISPLAY=localhost:0
export ORACLE_USER=oracle

echo "starting program"
su - "$ORACLE_USER"<<EOO
echo "switched user"
lsnrctl start
echo "started lsnrctl"
sqlplus /nolog<<EOS
connect / as sysdba
startup

EOS
echo "arrived at EOS"
emctl start dbconsole
EOO
echo "leaving program"



This is what I receive as response from the shell.
starting program
switched user
-bash: line 2: lsnrctl: command not found
started lsnrctl
-bash: line 4: sqlplus: command not found
arrived at EOS
-bash: line 10: emctl: command not found
leaving program


But when I exectue it all in the shell then this is the response
[oracle@PJS bin]$ pwd
/home/oracle/product/10.1.0/PJS2_DB1/bin
[oracle@PJS bin]$ ./lsnrctl start

LSNRCTL for Linux: Version 10.1.0.3.0 - Production on 05-JUL-2005 17:46:24

Copyright (c) 1991, 2004, Oracle. All rights reserved.

Starting /home/oracle/product/10.1.0/PJS2_DB1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.1.0.3.0 - Production
System parameter file is /home/oracle/product/10.1.0/PJS2_DB1/network/admin/listener.ora
Log messages written to /home/oracle/product/10.1.0/PJS2_DB1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.1.0.3.0 - Production
Start Date 05-JUL-2005 17:46:24
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP ON
Listener Parameter File /home/oracle/product/10.1.0/PJS2_DB1/network/admin/listener.ora
Listener Log File /home/oracle/product/10.1.0/PJS2_DB1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@PJS bin]$ ./sqlplus /nolog

SQL*Plus: Release 10.1.0.3.0 - Production on Tue Jul 5 17:46:44 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 327155712 bytes
Fixed Size 778976 bytes
Variable Size 112205088 bytes
Database Buffers 213909504 bytes
Redo Buffers 262144 bytes
Database mounted.
Database opened.
SQL>


As you can see the database is started.

Can somebody help me with that?
 
Old 07-05-2005, 11:24 AM   #2
madluther
Member
 
Registered: Aug 2004
Distribution: LFS
Posts: 350

Rep: Reputation: 30
try modifying the command

su - "$ORACLE_USER"<<EOO

to

su "$ORACLE_USER"<<EOO

from the su manpage ....

"The optional argument - may be used to provide an environment similiar to what the user would expect had the user logged in directly."

using "-" in the su command is likely overwriting some of the environment variables your script is setting.

HTH

Mad.
 
Old 07-05-2005, 12:55 PM   #3
deweirdt
Member
 
Registered: Sep 2003
Location: Belgium
Distribution: SUSE10.1
Posts: 40

Original Poster
Rep: Reputation: 15
Hi,

Just tried without the "-" and I still have the problem.
However I get a other error now.

Looks like the parameters it should enter in the sqlplus are not correct.

The response I get now from the script is this:

[root@PJS init.d]# ./ora10 start
starting program
switched user

LSNRCTL for Linux: Version 10.1.0.3.0 - Production on 05-JUL-2005 19:53:42

Copyright (c) 1991, 2004, Oracle. All rights reserved.

Starting /home/oracle/product/10.1.0/PJS2_DB1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.1.0.3.0 - Production
System parameter file is /home/oracle/product/10.1.0/PJS2_DB1/network/admin/listener.ora
Log messages written to /home/oracle/product/10.1.0/PJS2_DB1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.1.0.3.0 - Production
Start Date 05-JUL-2005 19:53:42
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP ON
Listener Parameter File /home/oracle/product/10.1.0/PJS2_DB1/network/admin/listener.ora
Listener Log File /home/oracle/product/10.1.0/PJS2_DB1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
started lsnrctl

SQL*Plus: Release 10.1.0.3.0 - Production on Tue Jul 5 19:53:42 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

SQL> Connected to an idle instance.
SQL> ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/home/oracle/product/10.1.0/PJS2_DB1/dbs/initorcl.ora'
SQL> SQL> Disconnected
arrived at EOS
TZ set to Europe/Brussels
OC4J Configuration issue. /home/oracle/product/10.1.0/PJS2_DB1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain_orcl not found.
leaving program
[root@PJS init.d]#


Look to the line were it's starting to say SQL>
I think something is going wrong there
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem loading iptables script on startup manicajk Linux - General 8 04-12-2009 11:37 AM
Startup script problem tanveer Linux - Newbie 2 12-13-2004 09:45 PM
startup script problem dani81 *BSD 1 08-05-2004 06:39 AM
problem with mysql startup script on server BeetleBailey Programming 2 07-22-2004 04:37 PM
Oracle Startup Script linux_pioneer Linux - Software 0 09-15-2003 07:55 PM


All times are GMT -5. The time now is 11:56 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration