一、簡介
1.1 ASMLib
在Red Hat Enterprise Linux (RHEL)6以前,Oracle均是使用ASMLib這個內核支持庫配置ASM。ASMLIB是一種基於Linux module,專門爲Oracle Automatic Storage Management特性設計的內核支持庫(kernel support library)。但是,在2011年5月,甲骨文發表了一份Oracle數據庫ASMLib的聲明,聲明中稱甲骨文將不再提供Red Hat Enterprise Linux (RHEL)6的ASMLib和相關更新。
甲骨文在這份聲明中表示,ASMLib更新將通過Unbreakable Linux Network (ULN)來發布,並僅對Oracle Linux客戶開放。ULN雖然爲甲骨文和紅帽的客戶服務,但如果客戶想要使用ASMlib,就必須使用Oracle的kernel來替換掉紅帽的。
因此,目前在Red Hat Enterprise Linux (RHEL)6以上使用Oracle+ASM,已不再使用ASMLib,而是採用udev設備文件來配置ASM。
什麼是 udev?
udev 是Linux2.6 內核裏的一個功能,它替代了原來的devfs,成爲當前Linux 默認的設備管理工具。udev 以守護進程的形式運行,通過偵聽內核發出來的uevent 來管理/dev目錄下的設備文件。不像之前的設備管理工具,udev 在用戶空間(user space) 運行,而不在內核空間(kernel space) 運行。
ASMLIB是一種基於Linux module,專門爲Oracle Automatic Storage Management特性設計的內核支持庫(kernel support library)。
理論上可以從ASMLIB API中得到的以下益處:
總是使用direct,async IO
解決了永久性設備名的問題,即便在重啓後設備名已經改變的情況下
解決了文件權限、擁有者的問題
減少了I/O期間從用戶模式到內核模式的上下文切換,從而可能降低cpu使用率
減少了文件句柄的使用量
ASMLIB API提供了傳遞如I/O優先級等元信息到存儲設備的可能
ASMLIB可能帶來的缺點:
對於多路徑設備(multipathing)需要在/etc/sysconfig/oracleasm-_dev_oracleasm配置文件中設置ORACLEASM_SCANORDER及ORACLEASM_SCANEXCLUDE,以便ASMLIB能找到正確的設備文件,具體可以參考Metalink Note
因爲ASM INSTANCE使用ASMLIB提供的asm disk,所以增加了額外的層面
每次Linux Kernel更新,都需要替換新的ASMLIB包
增加了因人爲錯誤造成宕機downtime的可能
使用ASMLIB意味着要花費更多時間去創建和維護
因爲ASMLIB的存在,可能引入更多的bug,這是我們最不想看到的
使用ASMLIB創建的disk,其disk header並不會和普通的asm disk header有什麼不同,僅僅是在頭部多出了ASMLIB的屬性空間。
二、安裝過程
2.1環境工具準備
在 CentOS7.3上安裝 Oracle 11gR2 + ASM 使用udev
實驗環境:
OS: CentOS7.3
Database: Oracle Database 11gR2 x64 (11.2.0.3.0)
VMware: VMware Workstation
軟件:
xmanager-passive
XSHELL
2.2檢查硬件
在正式安裝開始前,請先檢查你的軟硬件條件是否滿足安裝需要。
硬件上可以使用命令查看內存情況和 CPU 特性:
其中內存的要求是不低於 1G,這裏我分配2G內存
[root@test soft]# cat /proc/meminfo
df -kh /dev/shm //檢查共享內存
df -kh /tmp //檢查臨時磁盤空間
more /proc/version //檢查操作系統版本
uname -r //檢查內核版本
grep MemTotal /proc/meminfo //內存
grep SwapTotal /proc/meminfo //交換空間
2.2安裝軟件包檢查
沒有安裝過的包會提示is not installed :
[root@test soft]# rpm -q binutils \
compat-libstdc++-33 \
elfutils-libelf \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgomp \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel \
numactl-devel
檢查結果如下,有些包沒有安裝,使用yum安裝沒有安裝的包
檢查下列包是否安裝,若未安裝則要先安裝:
建議用 rpm –q packagename 逐個檢查,因爲是官方要求,所以爲了不在安裝時出現不必要的麻煩,還是確認都全部安裝爲好。
rpm -qa | grep binutils-
rpm -qa | grep compat-libstdc++-
rpm -qa | grep elfutils-libelf-
rpm -qa | grep elfutils-libelf-devel-
rpm -qa | grep glibc-
rpm -qa | grep glibc-common-
rpm -qa | grep glibc-devel-
rpm -qa | grep gcc-
rpm -qa | grep gcc-c++-
rpm -qa | grep libaio-
rpm -qa | grep libaio-devel-
rpm -qa | grep libgcc-
rpm -qa | grep libstdc++-
rpm -qa | grep libstdc++-devel-
rpm -qa | grep make-
rpm -qa | grep sysstat-
rpm -qa | grep unixODBC-
rpm -qa | grep unixODBC-devel-
[root@test soft]# rpm -qa | grep binutils-
binutils-2.25.1-22.base.el7.x86_64
[root@test soft]# rpm -qa | grep binutils-
binutils-2.25.1-22.base.el7.x86_64
[root@test soft]# rpm -qa | grep compat-libstdc++-
compat-libstdc++-33-3.2.3-72.el7.x86_64
[root@test soft]# rpm -qa | grep elfutils-libelf-
elfutils-libelf-0.166-2.el7.x86_64
[root@test soft]# rpm -qa | grep elfutils-libelf-devel-
[root@test soft]# rpm -qa | grep glibc-
glibc-devel-2.17-307.el7.1.x86_64
glibc-common-2.17-307.el7.1.x86_64
glibc-2.17-307.el7.1.x86_64
glibc-headers-2.17-307.el7.1.x86_64
[root@test soft]# rpm -qa | grep glibc-common-
glibc-common-2.17-307.el7.1.x86_64
[root@test soft]# rpm -qa | grep glibc-devel-
glibc-devel-2.17-307.el7.1.x86_64
[root@test soft]# rpm -qa | grep gcc-
libgcc-4.8.5-39.el7.x86_64
gcc-4.8.5-39.el7.x86_64
gcc-c++-4.8.5-39.el7.x86_64
[root@test soft]# rpm -qa | grep gcc-c++-
gcc-c++-4.8.5-39.el7.x86_64
[root@test soft]# rpm -qa | grep libaio-
libaio-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.x86_64
[root@test soft]# rpm -qa | grep libaio-devel-
libaio-devel-0.3.109-13.el7.x86_64
[root@test soft]# rpm -qa | grep libgcc-
libgcc-4.8.5-39.el7.x86_64
[root@test soft]# rpm -qa | grep libstdc++-
libstdc++-4.8.5-39.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.x86_64
libstdc++-devel-4.8.5-39.el7.x86_64
[root@test soft]# rpm -qa | grep libstdc++-devel-
libstdc++-devel-4.8.5-39.el7.x86_64
[root@test soft]# rpm -qa | grep make-
make-3.82-23.el7.x86_64
[root@test soft]# rpm -qa | grep sysstat-
sysstat-10.1.5-11.el7.x86_64
[root@test soft]# rpm -qa | grep unixODBC-
unixODBC-devel-2.3.1-14.el7.x86_64
unixODBC-2.3.1-14.el7.x86_64
[root@test soft]# rpm -qa | grep unixODBC-devel-
unixODBC-devel-2.3.1-14.el7.x86_64
2.3修改主機名,永久生效:
[root@test soft]# hostnamectl set-hostname test
編輯/etc/hosts
文件添加IP和主機名的隱射關係
[root@test soft]# vi /etc/hosts
2.4磁盤準備
添加四塊磁盤,每塊分配20G的大小,用於ASM和FRA,添加磁盤需要先關閉虛擬機
(1)編輯虛擬機設置
(2)選擇添加硬盤
(3)默認選擇SCSI
(4)創建新的虛擬磁盤
(5)分配20G大小,選擇將虛擬磁盤存儲爲單個文件
重複上面的步驟一共添加四塊盤就好
這裏4塊磁盤添加完畢後,爲了避免後邊再重啓一次,可以先把後邊需要的一個步驟做了,就是找到虛擬機的配置文件,在最後添加一行 disk.EnableUUID=“TRUE”,這裏注意修改文件的時候一定要在關機的狀態下修改該參數文件。
設置完畢後啓動虛擬機
2.5對磁盤進行分區
磁盤添加完成後,啓動虛擬機,作爲 root 用戶登錄系統,分區新添加的兩塊磁盤sdb和sdc,這裏並不做格式化和掛載操作,僅僅是分區。
[root@test ~]# fdisk -l | grep sd*
Disk /dev/sdd: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
分區步驟如下:
[root@test ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x407c9eb6.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048): //默認回車
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): //默認回車
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): w //輸入w保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@test ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xa807b184.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
使用partprobe
命令使系統重新識別所有分區
[root@test ~]# partprobe
查看分區後的情況:
[root@test ~]# fdisk -l | grep sdb
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
/dev/sdb1 2048 41943039 20970496 83 Linux
[root@test ~]# fdisk -l | grep sdc
Disk /dev/sdc: 21.5 GB, 21474836480 bytes, 41943040 sectors
/dev/sdc1 2048 41943039 20970496 83 Linux
2.6添加用戶及用戶組
groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin
groupadd asmoper
groupadd asmdba
添加用戶到組
useradd -g oinstall -G dba,asmdba,oper,asmadmin oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid
修改oracle用戶和grid用戶的密碼,爲了方便,把密碼和用戶名設置一樣
echo oracle | passwd --stdin oracle
echo grid | passwd --stdin grid
查看用戶及屬組設置是否正確
[root@test ~]# id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba),1003(oper),1004(asmadmin),1006(asmdba)
[root@test ~]# id grid
uid=1002(grid) gid=1001(oinstall) groups=1001(oinstall),1002(dba),1004(asmadmin),1005(asmoper),1006(asmdba)
2.7創建目錄並且配置 grid 和 oracle 用戶的配置文件
使用root用戶執行如下命令
mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/grid
chown -R oracle:oinstall /u01/app/oracle
chgrp -R oinstall /u01
chmod -R 775 /u01
切換到oracle用戶下,編輯oracle用戶的配置文件
[root@test app]# su - oracle
[oracle@test ~]$ vi .bash_profile //在文件末尾添加如下配置
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$PATH:$ORACLE_HOME/bin
切換到grid用戶下,編輯grid用戶的配置文件
[root@test app]# su - grid
[grid@test ~]$ vi .bash_profile //在末尾添加如下配置
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
umask 022
使用source
命令刷新一下配置文件
[grid@test ~]$ source .bash_profile
2.8使用udev管理磁盤
配置 udev綁定的scsi_id
首先切換到root用戶下:
不同的操作系統,scsi_id 命令的位置不同
[grid@test ~]$ cat /etc/issue
\S
Kernel \r on an \m
CentOS7.3的scsi_id
的命令不在PATH變量下,所以要將其路徑添加到PATH變量才能直接用,不然要用絕對路徑調用,顯得麻煩
[root@test /]# export PATH=$PATH:/usr/lib/udev/
[root@test /]# which scsi_id
/usr/lib/udev/scsi_id
編輯 /etc/scsi_id.config 文件,如果該文件不存在,則創建該文件並添加如下行:
[root@test rules.d]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
options=--whitelisted --replace-whitespace
獲取新增加的磁盤的uuid
[root@test /]# scsi_id -g -u /dev/sdb
36000c29321cc22ea16daf79fc3529aab
[root@test /]# scsi_id -g -u /dev/sdc
36000c29b4b094016e2d1869e49548c19
[root@test /]# scsi_id -g -u /dev/sdd
36000c292edd8df6bcc3a6e123c251774
[root@test /]# scsi_id -g -u /dev/sde
36000c29b979c7244acc21fb0e3936825
創建並配置 udev rules 文件
根據獲取的UUID修改 RESULT 值,這裏需要注意,一個KERNEL就是一行,不能換行
注意:這裏的GROUP=“asmadmin”, 最好修改成 GROUP=“asmdba”,不然最後可能用dbca創建數據庫實例的時候找不見磁盤組
[root@test /]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29321cc22ea16daf79fc3529aab", RUN+="/bin/sh -c 'mknod /dev/asmdiskb b $major $minor; chown grid:asmdba /dev/asmdiskb; chmod 0660 /dev/asmdiskb'"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29b4b094016e2d1869e49548c19", RUN+="/bin/sh -c 'mknod /dev/asmdiskc b $major $minor; chown grid:asmdba /dev/asmdiskc; chmod 0660 /dev/asmdiskc'"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c292edd8df6bcc3a6e123c251774", RUN+="/bin/sh -c 'mknod /dev/asmdiskd b $major $minor; chown grid:asmdba /dev/asmdiskd; chmod 0660 /dev/asmdiskd'"
KERNEL=="sd*",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="36000c29b979c7244acc21fb0e3936825", RUN+="/bin/sh -c 'mknod /dev/asmdiske b $major $minor; chown grid:asmdba /dev/asmdiske; chmod 0660 /dev/asmdiske'"
配置完畢後重啓udev,CentOS7重啓用以下命令,與前面的版本有所不同
[root@test /]# /sbin/udevadm trigger --type=devices --action=change
或者:
[root@test /]# /sbin/udevadm control --reload
但是我重啓後沒有作用,無奈使用重啓虛擬機大法,重啓前最好快照一下,重啓虛擬機後識別出了新加的磁盤,如下所示:
[root@test ~]# ll /dev/asm*
brw-rw----. 1 grid asmdba 8, 16 May 17 05:13 /dev/asmdiskb
brw-rw----. 1 grid asmdba 8, 32 May 17 05:13 /dev/asmdiskc
brw-rw----. 1 grid asmdba 8, 48 May 17 05:13 /dev/asmdiskd
brw-rw----. 1 grid asmdba 8, 64 May 17 05:13 /dev/asmdiske
2.9修改系統內核參數
編輯 /etc/security/limits.conf 文件,在文件尾部添加如下內容:
[root@test ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
編輯 /etc/pam.d/login 文件,在文件尾部添加如下內容:
[root@test ~]# vi /etc/pam.d/login
session required pam_limis.so
編輯 /etc/profile 文件,設置 shell 限制,在文件尾部添加如下內容:
[root@test ~]# vi /etc/profile
if [ /$USER = "oracle" ] || [ /$USER = "grid" ]; then
if [ /$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
編輯/etc/sysctl.conf文件,修改內核參數:
[root@test ~]# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
使修改生效
[root@test ~]# sysctl -p
2.10安裝grid軟件
將壓縮包用winscp上傳到虛擬機並解壓
[root@test soft]# unzip p10404530_112030_Linux-x86-64_3of7.zip
作爲 grid 用戶登錄系統,執行安裝程序。
安裝過程中的日誌生成地址:/u01/app/oraInventory/logs/
檢查安裝腳本是否具有可執行權限
由圖可知無權限執行,用命令更改一下:
[root@test grid]# chown -R grid.oinstall /soft/grid/
打開Xmanager - Passive 軟件,然後在 Xshell 會話設置如下:
[grid@test grid]$ export DISPLAY=192.168.33.102:0.0 //這裏的ip地址就是本機的ip地址(ipconfig可以查詢到)
[grid@test grid]$ xhost +
提示有包需要安裝,直接用yum安裝,如果安裝後還是檢查不過,直接勾選忽略接着做
按照提示以root用戶執行兩個腳本:
[root@test ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@test ~]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user: //由於是單實例,所以要執行下面這個命令,以root用戶執行
/u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl //單實例執行這個命令
To configure Grid Infrastructure for a Cluster execute the following command: //如果是安裝集羣則執行下面的命令
/u01/app/11.2.0/grid/crs/config/config.sh //集羣這個命令
This command launches the Grid Infrastructure Configuration Wizard. The wizard also supports silent operation, and the parameters can be passed through the response file that is available in the installation media.
[root@test ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
//這步能不能過的前提是是否已經啓動服務ohas.service,由於實在Centos7版本安裝,啓動該服務的命令要用systemctl,但是oracle11g的腳本還是以service的形式啓動,所以啓動不了該服務,那麼此處就過不去,必須手動添加ohas.service爲系統服務並啓動,下面會展示怎麼添加並啓動服務
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node test successfully pinned.
Adding Clusterware entries to inittab
test 2020/05/17 08:46:13 /u01/app/11.2.0/grid/cdata/test/backup_20200517_084613.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
解決方法:
在CentOS7中ohasd需要被設置爲一個服務,在運行腳本root.sh之前。
步驟如下:
(1)以root用戶創建服務文件
#touch /usr/lib/systemd/system/ohas.service
#chmod 777 /usr/lib/systemd/system/ohas.service
(2)將以下內容添加到新創建的ohas.service文件中
[Unit]
Description=Oracle High Availability Services
After=syslog.target
[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Restart=always
[Install]
WantedBy=multi-user.target
(3)以root用戶運行下面的命令
systemctl daemon-reload
systemctl enable ohas.service
systemctl start ohas.service
(4)查看運行狀態
systemctl status ohas.service
安裝成功,如下圖:
利用asmca啓動asm實例
[grid@test grid]$ asmca
Step 1. 給磁盤組命名
Step 2. 選擇冗餘方式
High: 爲每個分配單元創建三個副本(因此至少需要三個磁盤)
Normal: 單鏡像(默認)
External: 不會鏡像,假定底層存在一個 LVM 並且它正在執行認爲適當的任何一種 RAID 級別。
Step 3. 添加磁盤掛載位置
Step 4. 輸入磁盤掛載位置和名稱
這裏我只創建了兩個磁盤,一個磁盤組,沒有創建 FRA 區域。如果你創建了 3 個或者 3 個以上磁盤,可以留一部分給後面的 FRA 使用(什麼是FRA? 就是閃回區)。
點擊 Create ASM 創建 Disk Group
稍等半分左右就創建好了
使用netmgr命令爲ASM實例配置監聽
使用命令啓動監聽
[grid@test admin]$ lsnrctl start
[grid@test admin]$ lsnrctl status
通過 grid 用戶執行crs_stat -t
檢查 ASM 是否安裝好,如下所示表示搭建 OK。
[grid@test ~]$ crs_stat -t
連接到ASM實例,查看基本信息
[grid@test admin]$ echo $ORACLE_SID
+ASM
[grid@test admin]$ sqlplus / as sysasm
SQL> select * from v$version;
SQL> select name,total_mb from v$asm_diskgroup;
NAME TOTAL_MB
------------------------------------------------------------ ----------
DATA 40960
SQL> select name,group_number,file_number,alias_index,alias_directory,system_created from v$asm_alias;
NAME
--------------------------------------------------------------------------------
GROUP_NUMBER FILE_NUMBER ALIAS_INDEX AL SY
------------ ----------- ----------- -- --
ASM
1 4294967295 0 Y Y
ASMPARAMETERFILE
1 4294967295 53 Y Y
REGISTRY.253.1040634279
1 253 106 N Y
三、搭建 Oracle 數據庫
詳情見我的Oracle安裝教程,首先安裝數據庫軟件,然後建立監聽,最後建庫,建庫的時候會多處一個數據放置位置+DATA,這就是使用ASM管理表空間數據文件,這裏不再贅述oracle數據庫的安裝過程了,相信大家也很熟悉了,到此在CentOS7.3上部署基於ASM的oracle數據庫就完畢了,當然遠不止這些,需要大家進一步在搭建的環境中進行探索。