Solaris 10中Oracle 10gR2開機自啟動
1.修改/var/opt/oracle/oratab檔案,後面的dbstart和dbshut依據這個檔案啟動資料庫:
orcl:/opt/oracle/product/10.2:Y
2.修改$ORACLE_HOME/bin/dbstart和$ORACLE_HOME/bin/dbshut檔案:
vi dbstart
#ORACLE_HOME_LISTNER=$1
ORACLE_HOME_LISTNER=/opt/oracle/product/10.2
export ORACLE_HOME_LISTNER
vi dbshut
#ORACLE_HOME_LISTNER=$1
ORACLE_HOME_LISTNER=/opt/oracle/product/10.2
export ORACLE_HOME_LISTNER
3.修改完畢後用看看oracle使用者能否執行這兩個檔案,我的dbshut沒問題,但是執行dbstart不行:
查看/opt/oracle/product/10.2/listener.log的許可權:
原來是oracle使用者沒有寫入listener的許可權,賦予相應許可權即可:
chown oracle:dba /opt/oracle/product/10.2/listener.log
執行後成功。
4.接下來在/etc/init.d下建立系統自動啟動和關機前自動關閉Oracle的指令檔,分別如下:
vi start_oracle.sh(開機後啟動oracle資料庫指令碼):
#!/usr/bin/bash
#this script is used to start the oracle
su - oracle -c " /opt/oracle/product/10.2/bin/dbstart"
chmod a+x /etc/init.d/start_oracle.sh
vi stop_oracle.sh(關機前停止oracle資料庫指令碼):
#!/usr/bin/bash
#this script is used to stop the oracle
su - oracle -c " /opt/oracle/product/10.2/bin/dbshut"
chmod a+x /etc/init.d/stop_oracle.sh