配置solaris 10_oracle10g_dbstart_dbshut自動啟停庫

wisdomone1發表於2009-11-30

1,更改配置如下內容:
bash-3.00# more /var/opt/oracle/oratab  --linux 在/etc/oratab
#



# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form.:
#   $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
target:/orainstall/oracle/product/10.2.0/db_1:Y

2,以oracle使用者vi 下列檔案相關內容
  分兩部分:

  $ORACLE_HOME/bin/dbstart
ORATAB變數為/var/opt/oracle/oratab
ORACLE_HOME_LISTNER變數為$ORACLE_HOME
  $ORACLE_HOME/bin/dbshut
同上相關變數(同dbstart)
3,以root使用者編輯如下內容
  vi /etc/init.d/dbstart  和dbshut
bash-3.00# more /etc/init.d/dbstart
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/dbstart"
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/lsnrctl start"

bash-3.00# more /etc/init.d/dbshut
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/dbshut"
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/lsnrctl stop"

4,以root使用者給第3步建立的檔案授權
 chmod 755 /etc/init.d/db*

5,到相應的os初始化指令碼目錄下(啟與關os),進行ln操作
   
  cd /etc/rc2.d   ---啟動os
  ln -s /etc/init.d/dbstart   S99oracle

  cd /etc/rc0.d   ---關閉os
  ln -s /etc/init.d/dbshut   K01oracle

bash-3.00# more /etc/rc2.d/S99oracle
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/dbstart"
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/lsnrctl start"
 


bash-3.00# more /etc/rc0.d/K01oracle
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/dbshut"
su - oracle -c "/orainstall/oracle/product/10.2.0/db_1/bin/lsnrctl start"


小結:
1,oracle與os結合相當緊密,要加深對於os的理解,/etc/init.d與/etc/rcx.d的作用與區別
2,學習下dbshut and dbstart的shell

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-621052/,如需轉載,請註明出處,否則將追究法律責任。

相關文章