一步一步搭建oracle 11gR2 rac+dg之共享磁碟設定(三)

達芬奇的夢發表於2017-05-10

 

一步一步在RHEL6.5+VMware Workstation 10上搭建 oracle 11gR2 rac + dg 之共享磁碟準備 (三)

注意:這一步是配置rac的過程中非常重要的一步,很多童鞋多次安裝rac都不成功,主要原因就是失敗在共享磁碟的配置上,包括小麥苗我自己,多次安裝才懂的這個道理,所以,這一步大家一定要睜大眼睛多看多想,如有不懂的地方就直接聯絡小麥苗吧。

 

本部分目錄截圖:

  1. 配置共享儲存

這個是重點,也是最容易出錯的地方,我最初安裝的時候就是在這裡老報錯,大家看仔細了喲!!!

 

 

  1. 新增共享磁碟
    1. 第一步

cmd 中進入 WMware Workstation 安裝目錄,執行命令建立磁碟:

cd C:\Program Files (x86)\VMware\VMware Workstation

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 2g -a lsilogic -t 2 "E:\My Virtual Machines\rac\sharedisk\ocr_vote.vmdk"

VixDiskLib: Invalid configuration file parameter. Failed to read configuration file.

Creating disk 'E:\My Virtual Machines\rac\sharedisk\ocr_vote.vmdk'

Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 2g -a lsilogic -t 2 "E:\My Virtual Machines\rac\sharedisk\data.vmdk"

VixDiskLib: Invalid configuration file parameter. Failed to read configuration file.

Creating disk 'E:\My Virtual Machines\rac\sharedisk\data.vmdk'

Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 5g -a lsilogic -t 2 "E:\My Virtual Machines\rac\sharedisk\data.vmdk"

VixDiskLib: Invalid configuration file parameter. Failed to read configuration file.

Creating disk 'E:\My Virtual Machines\rac\sharedisk\data.vmdk'

Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 5g -a lsilogic -t 2 "E:\My Virtual Machines\rac\sharedisk\fra.vmdk"

VixDiskLib: Invalid configuration file parameter. Failed to read configuration file.

Creating disk 'E:\My Virtual Machines\rac\sharedisk\fra.vmdk'

Create: 100% done.

Virtual disk creation successful.

 

C:\Program Files (x86)\VMware\VMware Workstation>

 

 

其實這個步驟可以透過介面建立,如下:

尤其注意這一步的選擇,目前測試透過的只能這樣選擇:

 

點選下一步,輸入名稱,完成,依次新增需要的磁碟!

  1. 第二步

關閉兩臺虛擬機器,用記事本開啟 虛擬機器名字.wmx,即開啟配置檔案,2個節點都需要修改 例如: D:\rhela\rhela.vmx

 

新增以下內容,紅色字型修改為自己的共享虛擬機器磁碟檔案路徑,當然如果在上一步中如果是透過介面來建立的那麼需要把下邊的缺失的部分新增進去即可:

#shared disks configure

disk.EnableUUID="TRUE"

disk.locking = "FALSE"

scsi1.shared = "TRUE"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.dataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize= "4096"

diskLib.maxUnsyncedWrites = "0"

 

scsi1.present = "TRUE"

scsi1.virtualDev = "lsilogic"

scsil.sharedBus = "VIRTUAL"

scsi1:0.present = "TRUE"

scsi1:0.mode = "independent-persistent"

scsi1:0.fileName = "E:\share\ocr_vote.vmdk"

scsi1:0.deviceType = "disk"

scsi1:0.redo = ""

scsi1:1.present = "TRUE"

scsi1:1.mode = "independent-persistent"

scsi1:1.fileName = "E:\share\data.vmdk"

scsi1:1.deviceType = "disk"

scsi1:1.redo = ""

scsi1:2.present = "TRUE"

scsi1:2.mode = "independent-persistent"

scsi1:2.fileName = "E:\share\fra.vmdk"

scsi1:2.deviceType = "disk"

scsi1:2.redo = ""

 

第二個節點新增共享磁碟的時候也可以使用介面新增:

  1. 第三步

關閉 VMware Workstation 軟體重新開啟

此時看到共享磁碟正確載入則配置正確

 

 

 

 

  1. 設定共享磁碟

這裡可以採用asmlib也可以採用udev來管理,我安裝的時候asmlib沒有透過一直報錯,最後採用了udev來管理,推薦採用udev來管理,asmlib最高支援到rhel5.9,所以這裡只演示採用udev來管理,當然使用raw也可以的,有興趣的可以聯絡我,,,

 

 

  1. 可以使用udev來 共享儲存規劃

 

 

  1. 配置 udev 繫結的 scsi_id

注意以下兩點:

首先切換到root使用者下:

5.1. 不同的作業系統,scsi_id 命令的位置不同。

[root@localhost ~]# cat /etc/issue

Oracle Linux Server release 6.5

Kernel \r on an \m

 

注意:rhel 6 之後只支援 --whitelisted --replace-whitespace 引數,之前的 -g -u -s 引數已經不支援了。

 

[root@localhost ~]# which scsi_id

/sbin/scsi_id

[root@localhost ~]#

5.2. 編輯 /etc/scsi_id.config 檔案,如果該檔案不存在,則建立該檔案並新增如下行:

 

[root@localhost ~]# vi /etc/scsi_id.config

options=--whitelisted --replace-whitespace

[root@localhost ~]#

5.3. 如果是使用 VMware 虛擬機器,直接輸入 scsi_id 命令可能無法獲取 id,需修改 VMware 檔案引數,這一步如果在新增磁碟的時候做過這一步的話就可以跳過了,直接獲取uuid即可

[root@localhost ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb

[root@localhost ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc

D:\VMs\Oracle Database 11gR2\Oracle Database 11gR2.vmx

使用文字編輯器編輯該檔案,在尾部新增一行引數:

disk.EnableUUID="TRUE"

儲存檔案,重新啟動虛擬機器。這裡注意修改檔案的時候一定要在關機的狀態下修改,或者 scsi_id -g -u /dev/sdc 來獲得uuid-g -u引數在rhel6以後已經不用了

[root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb

36000c29fbe57659626ee89b4fba07616

[root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc

36000c29384cde894e087e5f0fcaa80f4

[root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdd

36000c29022aee23728231ed9b1f9743d

[root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sde

36000c2938f431664218d1d2632ff1352

  1. 建立並配置 udev rules 檔案

[root@localhost ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29fe0fc917d7e9982742a28ce7c", NAME="asm-diskb", OWNER="grid",GROUP="oinstall", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c293ffc0900fd932348de4b6baf8", NAME="asm-diskc", OWNER="grid",GROUP="oinstall", MODE="0660"

 

 

根據步驟 5 獲取的 ID 修改 RESULT 值

這裡需要注意,一個KERNEL就是一行,不能換行的,我之前就是犯了這個錯誤的

新增4塊硬碟:

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29346c1344ffb26f0e5603d519e", NAME="asm-diskb", OWNER="grid",GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29d08ee059a345571054517cd03", NAME="asm-diskc", OWNER="grid",GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c295037a910bfb765af8f400aa07", NAME="asm-diskd", OWNER="grid",GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2982bda048f642acd3c429ec983", NAME="asm-diske", OWNER="grid",GROUP="asmadmin", MODE="0660"

 

 

  1. 傳送到rac2

scp /etc/udev/rules.d/99-oracle-asmdevices.rules rac2:/etc/udev/rules.d

 

 

  1. 新增完成後,重啟 udev,不同 Linux 發行版本重啟方式不一樣。

該步驟慢一點,大約可能需要30秒左右吧,等等等等。。。。。。

[root@localhost ~]# start_udev

Starting udev: [ OK ]

[root@localhost ~]#

  1. 檢視繫結的 asm,如果此時還是看不到 asm disk,請重啟作業系統後再檢視。

[root@localhost ~]# ll /dev/asm*

brw-rw---- 1 grid asmadmin 8, 17 Oct 17 14:26 /dev/asm-diskb

brw-rw---- 1 grid asmadmin 8, 33 Oct 17 14:26 /dev/asm-diskc

  1. 對硬碟進行分割槽

[root@localhost share]# fdisk -l | grep "Disk /dev/sd"

 

 

 

以下操作在節點1完成:

[root@rac01 ~]# fdisk /dev/sdb

Command (m for help): p

 

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Device Boot Start End Blocks Id System

 

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-1044, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):

Using default value 1044

 

Command (m for help): p

 

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Device Boot Start End Blocks Id System

/dev/sdb1 1 1044 8385898+ 83 Linux

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

...

 

fdisk /dev/sdc

fdisk /dev/sdd

 

 

 

  1. 共享磁碟設定不正確報錯

執行root指令碼報錯:

 

第一種:

DiskGroup CRS creation failed with the following message:

ORA-15018: diskgroup cannot be created

ORA-15080: synchronous I/O operation to a disk failed

 

第二種:

Configuration of ASM failed, see logs for details

Did not succssfully configure and start ASM

CRS-2500: Cannot stop resource 'ora.crsd' as it is not running

CRS-4000: Command Stop failed, or completed with errors.

Command return code of 1 (256) from command: /u01/app/grid/11.2.0/bin/crsctl stop resource ora.crsd -init

Stop of resource "ora.crsd -init" failed

Failed to stop CRSD

 

 

第三種:

2014-06-05 06:39:01: Did not succssfully configure and start ASM

2014-06-05 06:39:01: Exiting exclusive mode

2014-06-05 06:39:01: Command return code of 1 (256) from command: /u01/app/grid/11.2.0/bin/crsctl stop resource ora.crsd -init

2014-06-05 06:39:01: Stop of resource "ora.crsd -init" failed

2014-06-05 06:39:01: Failed to stop CRSD

2014-06-05 06:39:32: Initial cluster configuration failed. See /u01/app/grid/11.2.0/cfgtoollogs/crsconfig/rootcrs_rac1.log for details

 

 

2013-01-21 11:19:25.396: [ CRSOCR][1] OCR context init failure. Error: PROC-26: Error while accessing the physical storage ASM error [SLOS: cat=8, opn=kgfoOpenFile01, dep=15056, loc=kgfokge

ORA-17503: ksfdopnGOpenFile05 Failed to open file +OCR.255.4294967295

ORA-17503: ksfdopn:2 Failed to open file +OCR.255.4294967295

ORA-15001: diskgroup "OCR"

] [8]

2013-01-21 11:19:25.396: [ CRSD][1][PANIC] CRSD exiting: Could not init OCR, code: 26

2013-01-21 11:19:25.396: [ CRSD][1] Done.

 

 

 

2014-06-06 23:20:23.442: [ OCRRAW][2849145568]propriogid:1_2: INVALID FORMAT

2014-06-06 23:20:23.442: [ OCRRAW][2849145568]proprioini: all disks are not OCR/OLR formatted

2014-06-06 23:20:23.442: [ OCRRAW][2849145568]proprinit: Could not open raw device

2014-06-06 23:20:23.445: [ OCRAPI][2849145568]a_init:16!: Backend init unsuccessful : [26]

2014-06-06 23:20:23.445: [ CRSOCR][2849145568] OCR context init failure. Error: PROC-26: Error while accessing the physical storage

2014-06-06 23:20:23.445: [ CRSD][2849145568][PANIC] CRSD exiting: Could not init OCR, code: 26

2014-06-06 23:20:23.446: [ CRSD][2849145568] Done.

 

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

相關文章