Grid軟件安裝過程當中orainstRoot.sh和root.sh腳本到底作了什麼?

在Linux平臺上,從Oracle 11gR2開始,不管是單實例的庫,仍是RAC庫,若是須要用到ASM時,一般都須要單獨安裝Grid Infrastructure軟件。而在Linux平臺上以圖形界面【OUI Oracle Universal Installer】安裝Oracle 11gR2 Grid軟件過程當中,會提示以root用戶執行orainstRoot.sh和root.sh腳本【以下圖一:單實例安裝,圖二:RAC安裝】。 linux

Linux平臺安裝單實例時,grid軟件須要執行的腳本

圖一:Linux平臺安裝單實例時,grid軟件須要執行的腳本 oracle

Linux平臺安裝RAC時,grid軟件須要執行的腳本

圖二:Linux平臺安裝RAC時,grid軟件須要執行的腳本 app

那麼這兩個腳本分別作了什麼,有什麼做用呢?本文簡單記錄: ide

一 /u01/app/oraInventory/orainstRoot.sh腳本的做用

1 添加grid用戶及oinstall組對Oracle Central Inventory 目錄的讀寫權限;

Oracle Central Inventory 目錄默認狀況下,位於$ORACLE_BASE的上一級目錄下,以下圖三: spa

Oracle Central Inventory

圖三:Oracle Central Inventory的路徑 操作系統

2 刪除其它用戶組對該目錄的讀、寫、執行權限;

1
2
3
4
5
6
7
8
9
10
11gOCM->pwd
/u01/app
11gOCM>ls
total 20
drwxrwxr-x. 3 grid   oinstall 4096 Oct 28 10:38 11.2.0
drwxr-xr-x  2 grid   oinstall 4096 Oct 30 10:20 acfs
drwxrwxr-x. 8 grid   oinstall 4096 Oct 28 10:38 grid
drwxrwxr-x. 8 oracle oinstall 4096 Nov  5 10:57 oracle
drwxrwx---. 6 grid   oinstall 4096 Oct 10 11:09 oraInventory
11gOCM->

3 建立/etc/oraInst.loc文件。

1
2
3
4
5
11gOCM->
cat/etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
11gOCM->

二 /u01/app/11.2.0/grid/root.sh腳本的做用

1 cp grid用戶的$ORACLE_HOME/bin下的oraenv、dbhome、coraenv可執行程序到/usr/local/bin路徑下;

1
2
3
4
5
6
7
8
9
10
11
12
13
11gOCM->pwd
/u01/app/11.2.0/grid/bin
11gOCM-> ll oraenv dbhome coraenv
-rwxr-xr-x. 1 grid oinstall 5778 Jan  1  2000 coraenv
-rwxr-xr-x. 1 grid oinstall 2415 Jan  1  2000 dbhome
-rwxr-xr-x. 1 grid oinstall 6183 Jan  1  2000 oraenv
11gOCM-> ll/usr/local/bin/
total 232
-rwxr-xr-x. 1 grid root   5778 Oct 10 10:54 coraenv
-rwxr-xr-x. 1 grid root   2415 Oct 10 10:54 dbhome
-rwxr-xr-x. 1 grid root   6183 Oct 10 10:54 oraenv
-rwxr-xr-x  1 root root 214001 Oct 10 16:39 rlwrap
11gOCM->

2 建立/etc/oratab文件;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
11gOCM->cat/etc/oratab
#Backup file is  /u01/app/11.2.0/grid/srvm/admin/oratab.bak.11gocm line added by Agent
#
 
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.
 
# 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:<N|Y>:
#
# 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.
#
#
+ASM:/u01/app/11.2.0/grid:N
orcl:/u01/app/oracle/product/11.2.0/db_1:N             # line added by Agent
11gOCM->

3 建立grid用戶的OCR keys文件;

4 啓動ohasd守護進程,而且將ohasd守護進程的啓動文件寫入到/etc/inittab文件中,以便於ohasd守護進程隨着操做系統的啓動而啓動。若是是Oracle Enterprise Linux 6及以上版本的操做系統的話,則將該配置信息寫入到/etc/init/oracle-ohasd.conf的獨立配置文件中。

1
2
3
4
5
6
7
8
9
11gOCM->cat/etc/init/oracle-ohasd.conf
# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Oracle OHASD startup
 
start on runlevel [35]
stop  on runlevel [!35]
respawn
exec/etc/init.d/init.ohasd run >/dev/null2>&1

這是Oracle Enterprise Linux 6及以上版本的操做系統上的變化,在之前版本的操做系統下,由/etc/inittab文件來控制的條目均轉移到/etc/init下單個文件來控制。 orm

相關文章
相關標籤/搜索