1. Modify the Oracle system configuration file / etc / oracle_home: SID: Oracle_home: Auto Set the Auto domain to y (uppercase), only the Oracle comes with DBSTART and DBSHUT to play a role. Such as: ora9i: /Home/Oracle/ora/products/9.2.0: Y2, write service script: below #! / Bin / bash ########################################################################################################################################################################################################################### ############## Autostart Oracle and listener # autostop oracle and listener ########################################################################################################################################################################################################################################################### ############# Created by ZHOUYS 2003-11-26 # URL: http://blog.9cbs.net/flyhope2005/Archive/2004/22/146860.aspx#
Case "$ 1" instart) echo "Starting Oracle Databases ..." echo "--------------------------------- ---------------- ">> / var / log / oracledate "% T% a% D: Starting Oracle Databasee As Part of System Up. ">> / var / log / oracleecho "----------------------------------------------- - ">> / var / log / oraclesu - Oracle-C" DBStart ">> / var / log / oracleecho" DONE. "echo" starting oracle listener ... "echo" --------- ---------------------------------------- ">> / var / log / oracleDate "% T% a% D: Starting Oracle Listeners As Part of System Up." >> / var / log / oracleecho "--------------------- -------------------------- ">> / var / log / oraclesu - Oracle-C" Lsnrctl Start ">> / var / log / Oracleecho "DONE." echo "" echo "---------------------------------------- --------- ">> / var / log / oracledate "% T% a% D: finished. ">> / var / log / oracleecho" ----------- -------------------------------------- ">> / var / log / oracletouch / var / Lock / Subsys / Oracle
; Stop) Echo "stoping Oracle Listener ..." echo "----------------------------------- -------------- ">> / var / log / oracledate "% T% a% D: stoping Oracle Listener As Part of System Down. ">> / var / log / oracleecho ------------------------------------- ">> / var / log / oraclesu - Oracle -c" lsnrctl stop ">> / var / log / oracleecho" DONE. "RM -F / VAR / LOCK / SUBSYS / ORACLEECHO" Stoping Oracle Databases ... "echo" ------------------------------------- " >> / var / log / oracledate "% T% a% D: stoping Oracle Databases as part of system down." >> / var / log / oracleecho "-------------- ----------------------------------- ">> / var / log / oraclesu - oracle -c" DBSHUT ">> / var / log / oracleecho" done. "echo" "echo" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------- ">> / var / log / oracledate "% T% a% D: finished. ">> / var / log / oracleecho" --- ---------------------------------------------- ">> / Var / log / oracle ;; restart $ 0 STOP $ 0 Start
;; * Echo "USAGE: Oracle {start | stop | restart}" EXIT 1ESAC
Name the script Oracle, save the file attribute under /etc/rc.d/init.d: chmod 755 Oracle
Note: DOS format characters have caused the DOS format characters in Windows, which is not possible to run properly under Linux. It is recommended to use gedit or edit with VI.
3. Establish a service connection: Start the database when the system starts, we need the following links: --------------------------------- --------------------------------------------- $ PWD / ETC / RC.D / INIT.D / ORACLE $ ln -s ../init.d/oracle /etc/rc.d/rc2.d/s99racle (2.d/s ../init.d/oracle / etc / Rc.d / rc3.d / s99racle $ ln -s ../init.d/oracle /etc/rc.d/rc5.d/s99racle # rc4.d unused ------------ -------------------------------------------------- ------------------
To stop the database while restarting, we need the following links: ------------------------------------- ----------------------------------------- $ ln -s ../ InIT.D / Oracle /etc/rc.d/rc0.d/k01racle # Stop $ ln -s ../init.d/racle /etc/rc.d/rc6.d/k01racle # Restart
== LOO, 2005-03-06, actual combat ==
Restart the server, check the / var / log / oracle log file, find: ... can't find init file for database "gdetgzw" .... Error, where GDETGZW is the instance name to be automatically launched. I have found it online, modify it below: Some Bus in dbstart when Using SPFILE IN ORACLE9IYOU CAN DO The FOLLOWING Step To Solve IT:
CODE:
- Edit The DBStart Script
- Add The Following Line:
SPFILE = $ {Oracle_Home} / dbs / spfile $ {oracle_sid}. O
After this line:
Pfile = $ {oracle_home} / dbs / init $ {oracle_sid}. ORA
- CHANGE:
IF [-f $ pfile]; then
TO:
IF [-f $ PFILE -O -F $ SPFILE];
Description, in the Oracle9i I installed, there is no database's init file (pfile = $ {oracle_Home} / dbs / init $ {oracle_sid}. ORA), all prompts now add spfile = $ {oracle_home} / dbs / spfile $ {Oracle_sid}. ORA instead of init file.
After restart, OK! The set database instance is automatically started. (Finish)