oracle etc目錄下的init.ohasd和ohasd檔案丟失後如何啟動GI

來源:互聯網
上載者:User

我們已經知道11.2和12c RAC中的/etc/init.d/init.ohasd是啟動RAC所有其他進程的守護進程。
那麼如果有人誤刪除了這個檔案或者錯誤修改了,怎麼辦呢?
這個解決不難,因為在Standalone環境中,/etc/init.d/init.ohasd來自於$GRID_HOME/crs/init/init.ohasd,而/etc/init.d/ohasd來自於$GRID_HOME/crs/init/ohasd。
[root@lunarlib etc]# env|grep ORA
ORACLE_SID=+ASM
GRID_HOME=/u01/app/11.2.0.4/grid
[root@lunarlib rootwork]# ls -lrt $GRID_HOME/crs/init
total 28
-rw-r--r-- 1 root root 6721 Oct 11 01:30 ohasd
-rw-r--r-- 1 root root 8794 Oct 11 01:30 init.ohasd
-rw-r--r-- 1 root root 7038 Oct 11 01:30 ohasd.sles
[root@lunarlib rootwork]#
我們對比一下$GRID_HOME/crs/init/和/etc/init.d/下的ohasd和init.ohasd,看看檔案內容是否一致:
[/shell]
[root@lunarlib rootwork]# ls -lrt $GRID_HOME/crs/init/ohasd
-rw-r--r-- 1 root root 6721 Oct 11 01:30 /u01/app/11.2.0.4/grid/crs/init/ohasd
[root@lunarlib rootwork]# ls -lrt /etc/init.d/ohasd
-rwxr-x--- 1 root root 6721 Oct 11 01:30 /etc/init.d/ohasd
[root@lunarlib rootwork]# ls -lrt $GRID_HOME/crs/init/init.ohasd
-rw-r--r-- 1 root root 8794 Oct 11 01:30 /u01/app/11.2.0.4/grid/crs/init/init.ohasd
[root@lunarlib rootwork]# ls -lrt /etc/init.d/init.ohasd
-rwxr-x--- 1 root root 8794 Jan 11 11:56 /etc/init.d/init.ohasd
[root@lunarlib rootwork]#
[root@lunarlib rootwork]# diff $GRID_HOME/crs/init/ohasd /etc/init.d/ohasd
[root@lunarlib rootwork]# diff $GRID_HOME/crs/init/init.ohasd /etc/init.d/init.ohasd
[root@lunarlib rootwork]#
可以看到,$GRID_HOME/crs/init/和/etc/init.d/目錄下的檔案內容是一致的,只是許可權不同。/etc/init.d/目錄下的檔案許可權是750,$GRID_HOME/crs/init下的許可權是644。
好了,解決方案有了,如果/etc/init.d/init.ohasd或者/etc/init.d/ohasd丟失了,手工建立/etc/init.d/init.ohasd 就可以了:
cp $GRID_HOME/crs/init/init.ohasd /etc/init.d/init.ohasd
chmod 750 /etc/init.d/init.ohasd
如果再細心一點,我們會發現$GRID_HOME/crs/init目錄下除了這兩個檔案外,還有一個名稱為ohasd.sles的檔案。
熟悉SLES Linux的朋友可能猜到了,是的,這個是在SLES Linux上使用的ohasd版本。
檢查目前的版本是否為SLES:
[root@lunarlib rootwork]# rpm -q sles-release
package sles-release is not installed
[root@lunarlib rootwork]#
現在,我們刪除/etc/init.d/init.ohasd檔案來類比init.ohasd檔案丟失或者損壞:
[root@lunarlib rootwork]# rm -f /etc/init.d/init.ohasd
[root@lunarlib rootwork]#
然後我們使用$GRID_HOME/crs/init/下面的檔案複製過來,手工啟動試試看:
下面的顯示刪除/etc/init.d/init.ohasd後reboot系統的結果(也可以使用kill進程的方式,不重啟主機):
[root@lunarlib rootwork]# ps -ef | grep -v grep|grep ohasd
[root@lunarlib rootwork]# ps -ef | grep -v grep|grep -E 'init|d.bin|ocls|evmlogger|UID'
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 09:37 ?        00:00:00 /sbin/init
[root@lunarlib rootwork]#
可以看到,當前沒有任何RAC的進程被啟動。
我們嘗試恢複這個丟失的ohasd守護進程設定檔:
[root@lunarlib rootwork]# cp $GRID_HOME/crs/init/init.ohasd /etc/init.d/init.ohasd
cp: overwrite `/etc/init.d/init.ohasd'? y
[root@lunarlib rootwork]#
然後reboot系統後,該進程已經啟動了:
[root@lunarlib rootwork]# ps -ef | grep -v grep|grep ohasd
root      2882     1  0 10:33 ?        00:00:00 /bin/sh /etc/init.d/init.ohasd run
[root@lunarlib rootwork]# ps -ef | grep -v grep|grep -E 'init|d.bin|ocls|evmlogger|UID'
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 10:32 ?        00:00:00 /sbin/init
root      2882     1  0 10:33 ?        00:00:00 /bin/sh /etc/init.d/init.ohasd run
[root@lunarlib rootwork]#
[root@lunarlib rootwork]# /sbin/initctl list |grep oracle-ohasd
oracle-ohasd start/running, process 2882
[root@lunarlib rootwork]#

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.