1)
在/etc/oratab 中加,這個檔案檔案應是在裝資料庫時候,最後執行的root.sh產生的。
pwdb:/Oracle/procduct/10.2/db_1/:Y
$ORACLE_SID:$ORACLE_HOME:<Y|N>
2)
在/etc/rc.local中加入
su -oracle -c 'dbstart'
su -oracle -c 'lsnrctl start'
這個應該是在啟動時用指定使用者執行一些命令,
同理,一些其他的命令應該也可以寫在這裡,在啟動時候一同執行。
3)
在 $ORACLE_HOME/bin/dbstart 檔案中加
ORACLE_HOME_LISTNER='/ade/....'
改成
ORACLE_HOME_LISTNER=$ORACLE_HOME
第三步在網路上的資料上寫了,但沒看出有什麼作用,
也許是針對舊版本寫的。
完成這幾部以後,重啟linux,等啟動完成,直接連資料庫探索資料和tns都已經啟動完成。
還有一種方法:
在/etc/rc.d/init.d中加一個檔案,我這裡叫oradb
內容如下,從網上拷來的,做了一點修改。
####################################
#!/bin/bash
# chkconfig: 35 95 1
# description: init script. to start/stop oracle database 10g, TNS listener, EMS
#
#
# 根據自己需要把變數值進行設定:
export ORACLE_BASE=/u01
export ORACLE_HOME=$ORACLE_BASE/oracle
export ORACLE_SID=huang
export PATH=/home/oracle/bin:$ORACLE_HOME/bin:$PATH
export ORACLE_USER=oracle
# 根據$1參數的不同做兩種操作,啟動和關閉:
case $1 in
start)
su - "$ORACLE_USER"<<EOO
lsnrctl start
dbstart
EOS
#啟動oem
#emctl start dbconsole
EOO
;;
stop)
su - "$ORACLE_USER"<<EOO
lsnrctl stop
dbshut
EOS
#關閉ocm
#emctl stop dbconsole
EOO
;;
*)
#其他輸入,給出文法格式
echo "Usage: $0 {start|stop}"
;;
esac
###################################
儲存,後修改所屬組和許可權。
chown oracle:oinstall oradb
chmod 755 oradb
chkconfig oradb on
chkconfig --list oradb
可以使用啟動服務、停止服務
service oradb start
service oradb stop