Oracle隨Linux自動啟動的方法

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.