Setting Oracle Enviroment Variables
Edit the /home/oracle/.bash_profile
you can see an example as follows
Main Topics
Browse All TopicsDear Sir/Madam
I have installed oracle 11g onto linux (centOS) and it works fine. But everytimes I reboot linux (centOS), I need to start the database (test) manually.
Why is this happens?
I would like to know how to startup database (test) automatically everytimes I reboot the centOS 5 server?
I need to run following everytimes after centOS has been rebooted.
[oracle@localhost ~]$ export ORACLE_SID=test
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Thu May 29 21:10:10 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup
any method(s) that make the database startup automatically after linux(centOS) rebooted?
Thanks
Francis SZE
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
For Auto Startup and Shutdown of Database and Listener
1)
Login as root and modify /etc/oratab file and change last character to Y for apropriate database.
ORCL:/opt/oracle/111:Y
-------->> before changing it should look like ORCL:/opt/oracle/111:N
2)
As root user create new file "oracle" (init script for startup and shutdown the database) in /etc/init.d/ directory with following content:
#!/bin/bash
#
# oracle Init file for starting and stopping
# Oracle Database. Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Oracle Database startup script
# Source function library.
. /etc/rc.d/init.d/functions
ORACLE_OWNER="oracle"
ORACLE_HOME="/opt/oracle/1
case "$1" in
start)
echo -n $"Starting Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac
3)
Execute (as root) following commands (First script change the permissions, second script is configuring execution for specific runlevels):
chmod 750 /etc/init.d/oracle
chkconfig --add oracle --level 0356
To start automatically you database you should set the entry in /etc/oratab to Y.
like
TSH1:/u01/app/oracle/produ
After that you should put the file dbora (see the sniplet) in
"/etc/init.d/dbora" as the root user.
Use the chmod command to set the privileges to 750.
chmod 750 /etc/init.d/dbora
Associate the dbora service with the appropriate run levels and set it to auto-start using the following command.
chkconfig --level 345 dbora on
The relevant instances should now startup/shutdown automatically at system startup/shutdown.
To get rid of setting environment variables (for instance ORACLE_SID=test) each time after rebooting your test server and to get complete understanding about Automating Database Startup and Shutdown, check the following links
http://download-uk.oracle.
http://www.oracle-base.com
Dear sdstuber
I have followed your instrauction to add /opt/app/oracle/product/11
But the server (centOS) said the variable of ORACLE_HOME_LISTENER has not been set.
Am I need to set the value of ORACLE_HOME_LISTENER before run dbstart ?
What is the value of ORACLE_HOME_LISTENER to be set?
The value of ORACLE_HOME_LISTENER to be set in which file?
Thanks
Francis SZE
check the following to see the use of chkconfig
man chkconfig
or
http://www.centos.org/docs
Dear sonicefu
After I re-execute the dbstart and have a look of /opt/app/oracle/product/11
The content as is following, and the database (test) still not startup
/opt/app/oracle/product/11
Fri May 30 14:10:58 CST 2008
SQL*Plus: Release 11.1.0.6.0 - Production on Fri May 30 14:10:59 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL> ERROR:
ORA-01031: insufficient privileges
SQL> ORA-01031: insufficient privileges
SQL>
/opt/app/oracle/product/11
Please help
warm regards
Francis SZE
Dear sonicefu
Yes I edited the file SQLNET.ORA and add a line SQLNET.AUTHENTICATION_SERV
After that run ./dbstart by the user oracle
I give some error as following.
[oracle@localhost bin]$ pwd
/opt/app/oracle/product/11
[oracle@localhost bin]$ ./dbstart
./dbstart: line 90: /opt/app/oracle/product/11
./dbstart: line 91: /opt/app/oracle/product/11
touch: cannot touch `/opt/app/oracle/product/1
chmod: changing permissions of `/opt/app/oracle/product/1
Processing Database instance "test": log file /opt/app/oracle/product/11
./dbstart: line 343: /opt/app/oracle/product/11
The content of the file /opt/app/oracle/product/11
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.AUTHENTICATION_SERV
Many thanks
Francis SZE
Business Accounts
Answer for Membership
by: sonicefuPosted on 2008-05-29 at 06:24:09ID: 21668845
set these environment variables in the oracle software installation owner, for instance oracle