To modify the/etc/oratab file under the root account:
# Vi/etc/oratab
Find Orcl=/db/app/oracle/product/11.1.0/db_1:n this line
Switch
Orcl=/db/app/oracle/product/11.1.0/db_1:y
That is, change the last n to Y, meaning that automatic start will not be allowed to start automatically.
Then, you modify the Oracle's own startup and shutdown scripts, respectively, Dbstart and Dbshut. Executing both scripts enables the startup and shutdown of Oracle scripts.
To modify the $oracle_home/bin/dbstart file under ORACLE account:
# su-oracle
$ cd $ORACLE _home/bin
$ VI Dbstart
or the VI $ORACLE _home/bin/dbstart.
Find Oracle_home_listner=$1 this line
Switch
oracle_home_listner= $ORACLE _home
In the same way, we also want to modify this parameter of Dbshut
Write the automatic start-stop script called "Oracle", which needs to be saved in the/ETC/RC.D/INIT.D directory. Edit with Root permission
Similar to Settings in. bash_profile files
#!/bin/bash
# chkconfig:2345 99 10
# Description:startup Script for
Oracle Databases
#/etc/rc.d/init.d/oradbstart
Export
oracle_base=/oracle/app/oracle/
Export Oracle_home=/oracle/app/oracle/product/11.2.0/dbhome_1
Export ORACLE_SID=ORCL #启动实例名称
Export path= $PATH: $ORACLE _home/bin
Case "$" in
Start
Echo
"-----Startup Oracle-----" >>/var/log/oracle11log
Su oracle-c
$ORACLE _home/bin/dbstart
Touch/var/lock/subsys/oracle11
Echo
"-----Startup Oracle Successful-----" >>/var/log/oracle11log
Echo
"OK"
Stop
echo "-----shutdwn Oracle-----" >>
/var/log/oracle11log
Su oracle-c $ORACLE _home/bin/dbshut
Rm-f
/var/lock/subsys/oracle11
echo "-----Shutdown Oracle Successful-----" >>/var/log/oracle11log
echo "OK"
*)
echo "Usage:
' BaseName ' start|stop '
Exit 1
Esac
Exit 0
Assigns the script permissions that can be executed. Execute the following command:
The code is as follows: #su-root chown oracle/etc/init.d/oracle11 chmod 775/etc/init.d/oracle11 to create a symbolic link file, command: Chkconfig--ADD/ETC/INIT.D /oracle11 The above setup process is complete, test startup may error ora-01078:failure in processing system parameters
Lrm-00109:could not open parameter file '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora ' solution will $ oracle_base/admin/your database name/pfile/init.ora.628201264542 (This string is not necessarily the same)
Copy to the $oracle_home/dbs directory and rename it to your DB instance name. After the CD enters CP init.ora.628201264542 $ORACLE _home/dbscd $ORACLE _home/dbs mv init.ora.628201264542 Initorcl.ora test again
Linux Oracle Setup automatically launches DB instance and listener with system