In $oracle_home/bin, there are two scripts, Dbstart and Dbshut, that enable Oracle to boot from the two Oracle-brought scripts. This script contains Oraclelistener, instance, ASM instances start-up, and the same dbshut is the role of the shutdown service.
Method One: Start the Oracle using the/etc/rc.local system boot script
The configuration system makes the Dbstart and Dbshut scripts work:
1), with root edit/etc/oratab,
Orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:n This format,
ORCL is your oracle_sid,
/home/oracle/app/oracle/product/11.2.0/dbhome_1 is Oracle_home,
We need to change N to Y, that is, orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:y.
2), with ORACLE editor $oracle_home/bin/dbstart, find the 78th line: oracle_home_listner= change to your own path, or can be changed to oracle_home_listner= $ORACLE _ HOME
Save the script to see if the database can be shut down and started with the Oracle user running Dbshut and Dbstart. If not, the general parameter settings, according to the error to find the corresponding location change.
After the previous configuration, you can start the data listener, instance, ASM instances directly with the Dbstart command, but have not started oracle10g em,oracle the use of Web page management database is quite convenient, It is also a feature of the 10g, so it should be started with the service.
$ORACLE _home/bin/emctl Start Dbconsole
So we can use the rc.local or Redhat service can achieve the required boot boot. Here are a few separate words:
1), using rc.local. The Dbstart is added directly to the rc.local, enabling the boot to start automatically. It is important to note that the script must be started with Oracle.
To edit/etc/rc.local with root, add the following three lines:
Su oracle–lc "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
Su-oracle-c "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"
Su-oracle-c "/u01/product/10.2.0/db_1/bin/emctl start Dbconsole"
Here "/home/oracle/app/oracle/product/11.2.0/dbhome_1 need to replace the actual oracle_home
After saving and exiting, reboot server test, you can see, when the system started after the Oracle monitoring, instance and EM have been up
Method Two: Start the shutdown database using the/etc/rc.d/init.d/oracle self-creation script
If we don't use rc.local, we can add it to the Redhat service. In/etc/rc.d/init.d, add the following script file named Oracle:
#!/bin/sh
#chkconfig: 2345 99 01
#description: ORACLE 10g Server
Oracle_home=/u01/product/10.2.0/db_1
if [!-F $ORACLE _home/bin/dbstart]
Then
echo "ORACLE cannot Start"
Exit
Fi
Case "$" in
' Start ')
echo "Starting Oracle Database ..."
Su-oracle-c "$ORACLE _home/bin/dbstart"
Su-oracle-c "$ORACLE _home/bin/emctl start Dbconsole"
;;
' Stop ')
echo "stoping Oracle Database"
Su-oracle-c "$ORACLE _home/bin/emctl stop Dbconsole"
Su-oracle-c "$ORACLE _home/bin/dbshut"
;;
Esac
Note that there are two lines of comments, many scripts on the web because fewer of these two lines do not make the service self-booting:
#chkconfig: 2345 99 01
#description: ORACLE 10g Server
where chkconfig:2345 99 01 means that the script will start the Oracle 10g service for Run Level 2, 3, 4, 5, with a boot priority of 99 and a shutdown priority of 01.
Then with root permission:
# MV ORACLE/ETC/INIT.D
# chkconfig--add Oracle
# chkconfig--list Oracle view, so that Oracle can be switched on and off before shutdown immediate
Rebooting the system, you can see starting Oracle in the boot process because we set the priority to 99, which is typically the last boot. [OK] will be ready later. Because to start emctl, it may be a bit slow and wait a little longer.
You can start or stop the service by executing Oracle start or Oracle stop at root after startup
Summary: I was implemented by way one, method two was not tested
Reprint Please specify: http://blog.163.com/nocturnal_ken/blog/static/17802332720111945726777/
Oracle 11G for Redhat self-boot script