一、安裝過程參考Oracle網站上的文章 《在 Linux x86 上安裝 Oracle 資料庫 10g》:
http://www.oracle.com/technology/global/cn/pub/articles/smiley_10gdb_install.html
二、安裝結束後,設定自動啟動Oracle服務: 建立或修改 /etc/oratab 檔案:
| orcl:/u01/app/oracle/product/10.2.0/db_1:Y |
其中,orcl 是Oracle資料庫的sid,/u01/app/oracle/oracle/product/10.2.0/db_1是Oracle資料庫的Oracle_home,Y表示要求在系統啟動的時候啟動Oracle資料庫。 在 /etc/rc.d/init.d 下建立自動啟動指令碼 oracle:
| #!/bin/bash## chkconfig: 35 50 50# description: Oracle database server# # source function library. /etc/init.d/functions ## Change the value of ORACLE to the login name of the# oracle owner at your site.#ORACLE=oracle ## Change the value of ORACLE_HOME to specify the correct Oracle home# directory for your installation.#ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 export ORACLEexport ORACLE_HOME RETVAL=0prog="Oracle" start() { echo -n $"Starting $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else su - $ORACLE -c "lsnrctl start" RETVAL=$? if [ $RETVAL -eq 0 ]; then su - $ORACLE -c "dbstart" RETVAL=$? fi; [ $RETVAL -eq 0 ] && touch /var/lock/subsys/oracle fi; echo return $RETVAL} stop() { echo -n $"Stopping $prog: " if [ $UID -ne 0 ]; then RETVAL=1 failure else su - $ORACLE -c "dbshut" RETVAL=$? if [ $RETVAL -eq 0 ]; then su - $ORACLE -c "lsnrctl stop" RETVAL=$? fi; [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/oracle fi; echo return $RETVAL} restart(){ stop start} case "$1" in start) start ;; stop) stop ;; restart) restart ;; status) status oracle RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart}" RETVAL=1esac exit $RETVAL |
安裝 service:
| chmod 755 /etc/rc.d/init.d/oraclechkconfig --add oracle |