1. Modify the/etc/oratab File
Change the number of databases that need to be started with the operating system from N to Y.
Lis:/u01/app/Oracle/product/11.2.0/db_1: N
To:
Lis:/u01/app/oracle/product/11.2.0/db_1: Y
2. Edit the dbstart and dbshut scripts and change the listening variables to the oracle Home Directory.
$ Cd $ ORACLE_HOME/bin
$ Vi dbstart
Set
ORACLE_HOME_LISTNER = $1
Change
ORACLE_HOME_LISTNER = $ ORACLE_HOME
Modify the dbshut script in the same way
3. Write/etc/init. d/oracle script
Vi/etc/init. d/oracle
The ORACLE_HOME variable and Log File starting with the script must be set according to the actual situation.
The content is as follows:
#! /Bin/bash
# Chkconfig: 345 99 01
ORACLE_LOG_FILE =/var/log/oracle
ORACLE_HOME =/oracle/product/11.2.0/db_1
Case $1 in
Start)
Date + "% F % X"> $ ORACLE_LOG_FILE
Echo "Starting Oracle Databases and Listener:" >>$ ORACLE_LOG_FILE
Touch/var/lock/subsys/oracle
Su-oracle-c $ ORACLE_HOME/bin/dbstart $ ORACLE_HOME> $ ORACLE_LOG_FILE
Echo "Oracle Databases and Listener Started Successfully! ">>$ ORACLE_LOG_FILE
Echo ""
Echo "---------------------------------------------------------------------"> $ ORACLE_LOG_FILE
;;
Stop)
Date + "% F % X"> $ ORACLE_LOG_FILE
Echo "Shutting Down Oracle Databases and Listener:" >>$ ORACLE_LOG_FILE
Rm-rf/var/lock/subsys/oracle
Su-oracle-c $ ORACLE_HOME/bin/dbshut $ ORACLE_HOME> $ ORACLE_LOG_FILE
Echo "Oracle Databases and Listener Stopped Successfully! ">>$ ORACLE_LOG_FILE
Echo ""
Echo "---------------------------------------------------------------------"> $ ORACLE_LOG_FILE
;;
Restart)
Date + "% F % X"> $ ORACLE_LOG_FILE
Echo "Shutting Down Oracle Databases and Listener:" >>$ ORACLE_LOG_FILE
Rm-rf/var/lock/subsys/oracle
Su-oracle-c $ ORACLE_HOME/bin/dbshut $ ORACLE_HOME> $ ORACLE_LOG_FILE
Echo "Oracle Databases and Listener Stopped Successfully! ">>$ ORACLE_LOG_FILE
Echo ""
Echo "Starting Oracle Databases and Listener:" >>$ ORACLE_LOG_FILE
Touch/var/lock/subsys/oracle
Su-oracle-c $ ORACLE_HOME/bin/dbstart $ ORACLE_HOME> $ ORACLE_LOG_FILE
Echo "Oracle Databases and Listener Started Successfully! ">>$ ORACLE_LOG_FILE
Echo ""
Echo "---------------------------------------------------------------------"> $ ORACLE_LOG_FILE
;;
*)
Echo "Usage: Oracle {start | stop | restart }"
Exit 1
;;
Esac
Exit
4. Modify the script permission:
Chmod 750/etc/init. d/oracle
5. test whether the startup and shutdown scripts can run normally.
Test listener and database startup:
$ Service oracle start
Disable listeners and databases:
$ Service oracle stop
Test and restart the oracle listener and database:
$ Service oracle restart
Use lsnrctl status to check the listener status
Check the instance status by using ps-ef | grep ora _.
6. Add oracle as a service and set it to 345-level startup:
# Chkconfig -- add oracle
# Chkconfig -- list | grep oracle
7. If the database has been started and cannot be stopped, it is best to create the following lock file as the root user.
In this way, oracle will be automatically disabled at the next shutdown.
Touch/var/lock/subsys/oracle
Detailed illustration of the entire process of VMware + Linux + Oracle 10G RAC
Install Oracle 11gR2 (x64) in CentOS 6.4)
Steps for installing Oracle 11gR2 in vmwarevm
Install Oracle 11g XE R2 In Debian
Steps for installing Oracle 11gR2 in vmwarevm