扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
本次配置ASM沿用了搭建RAC的环境配置,系统选用CENTOS6.8
站在用户的角度思考问题,与客户深入沟通,找到桐梓网站设计与桐梓网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站设计制作、成都网站制作、企业官网、英文网站、手机端网站、网站推广、域名注册、虚拟主机、企业邮箱。业务覆盖桐梓地区。
首先本地配置YUM,安装GRID集群件所需要的RPM包
[root@rac01 Packages]# cd /etc/yum.repos.d/
[root@rac01 yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Vault.repo
[root@rac01 yum.repos.d]# rm -rf *
[root@rac01 yum.repos.d]# vi local.repo
[kingsql]
name=This is kingsql repo
baseurl=file:///rpm/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@rac01 yum.repos.d]# mkdir -p /rpm
[root@rac01 yum.repos.d]# cd /rpm
[root@rac01 rpm]cp /root/CentOS-6.8-x86_64-bin-DVD1/Packages/* /rpm/
rpm -ivh vsftpd-2.2.2-12.el6_5.1.x86_64.rpm
rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
rpm -ivh libxml2-2.7.6-14.el6_5.2.x86_64.rpm
rpm -ivh libxml2-python-2.7.6-14.el6_5.2.x86_64.rpm
rpm -ivh createrepo-0.9.9-22.el6.noarch.rpm
[root@rac01 rpm]# createrepo ./
[root@rac01 rpm]# yum clean all
[root@rac01 rpm]# yum makecache
[root@rac01 rpm]#yum install libXp* xterm* unixODBC* sysstat* make* libstdc++* libgomp* libgcc* libaio* kernel-headers* glibc* gcc* elfutils* binutils* bind bind-devel bind-chroot caching-nameserver compat-libcap1* compat-libstdc++-33* openssh* xdpyinfo vi unzip
本次配置ASM,DNS配置可选可不选
————————————————————————————————————————————————————————
vi /etc/named.conf
options {
listen-on port 53 { any; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "/dev/null";
};
zone "kingsql.org" IN {
type master;
file "kingsql.org.zone";
};
zone "56.168.192.in-addr.arpa" {
type master;
file "192.168.56.rev";
};
[root@rac01 named]# cd /var/named
[root@rac01 named]# pwd
/var/named
[root@rac01 named]# vi kingsql.org.zone
$TTL 1D
@ IN SOA kingsql.org. hostmaster.kingsql.org. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS ns1.kingsql.org.
ns1 IN A 192.168.56.101
cluster-scan IN A 192.168.56.156
cluster-scan IN A 192.168.56.157
cluster-scan IN A 192.168.56.158
--------------------------------------------------------------------------------------------
[root@rac01 named]# vi 192.168.56.rev
$TTL 1D
@ IN SOA kingsql.org. hostmaster.kingsql.org. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS ns1.kingsql.org.
ns1 IN A 192.168.56.101
156 IN PTR cluster-scan.kingsql.org.
157 IN PTR cluster-scan.kingsql.org.
158 IN PTR cluster-scan.kingsql.org.
--------------------------------------------------------------------------------------------
service network restart
cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.56.101
chkconfig named on ##设置开机自启动
service named start
Starting named: [ OK ]
nslookup cluster-scan.kingsql.org
nslookup 192.168.56.156
nslookup 192.168.56.157
nslookup 192.168.56.158
——————————————————————————————————————————————————————————————————
关闭防火墙
chkconfig iptables off
service iptables stop
修改selinux为disabled
vi /etc/selinux/config
创建用户和组
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
passwd grid
passwd oracle
建立目录,修改权限
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.4/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
关闭ntpd服务
service ntpd stop
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.original
rm -rf /var/run/ntpd.pid
修改grid用户的环境变量
[grid@rac1 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.4/grid
export ORACLE_SID=+ASM1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
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
export
修改root用户环境变量
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048586
/sbin/sysctl -p
vi /etc/security/limits.conf
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
vi /etc/pam.d/login
session required pam_limits.so
——————————————————————————————————————————————————————————————————————
查磁盘号
[root@rac1 ~]# /sbin/scsi_id -u -g /dev/sdb
1ATA_VBOX_HARDDISK_VB1274608b-98003b66
[root@rac1 ~]# /sbin/scsi_id -u -g /dev/sdc
1ATA_VBOX_HARDDISK_VBbf237514-f3435ff0
[root@rac1 ~]# /sbin/scsi_id -u -g /dev/sdd
1ATA_VBOX_HARDDISK_VBc894130b-2f10eef0
[root@rac1 ~]# /sbin/scsi_id -u -g /dev/sde
1ATA_VBOX_HARDDISK_VB58f6ed82-b0dc76dc
[root@rac1 ~]# /sbin/scsi_id -u -g /dev/sdf
1ATA_VBOX_HARDDISK_VB0e0cbf34-6238f247
[root@rac1 ~]# /sbin/scsi_id -u -g /dev/sdg
1ATA_VBOX_HARDDISK_VB98788216-29530089
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB1274608b-98003b66", NAME="asm-disk1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBbf237514-f3435ff0", NAME="asm-disk2", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBc894130b-2f10eef0", NAME="asm-disk3", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB58f6ed82-b0dc76dc", NAME="asm-disk4", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB0e0cbf34-6238f247", NAME="asm-disk5", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB98788216-29530089", NAME="asm-disk6", OWNER="grid", GROUP="asmadmin", MODE="0660"
[root@rac01 ~]# start_udev
Starting udev: [ OK ]
[root@rac1 ~]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 9月 18 11:49 /dev/asm-disk1
brw-rw---- 1 grid asmadmin 8, 32 9月 18 11:49 /dev/asm-disk2
brw-rw---- 1 grid asmadmin 8, 48 9月 18 11:49 /dev/asm-disk3
brw-rw---- 1 grid asmadmin 8, 64 9月 18 11:49 /dev/asm-disk4
brw-rw---- 1 grid asmadmin 8, 80 9月 18 11:49 /dev/asm-disk5
brw-rw---- 1 grid asmadmin 8, 96 9月 18 11:49 /dev/asm-disk6
安装集群件自带的RPM包
[root@rac01 ~]# mv p13390677_112040_Linux-x86-64_3of7.zip /home/grid/
[grid@rac01 ~]$ cd grid/
[grid@rac01 grid]$ ls
install response runInstaller sshsetup welcome.html
readme.html rpm runcluvfy.sh stage
[grid@rac01 grid]$ cd rpm/
[grid@rac01 rpm]$ ls
cvuqdisk-1.0.9-1.rpm
[grid@rac01 rpm]$ su root
Password:
[root@rac1 ~]# rpm -ivh /home/grid/grid/rpm/cvuqdisk-1.0.9-1.rpm
Preparing... ########################################### [100%]
Using default group oinstall to install package
1:cvuqdisk ########################################### [100%]
修改/etc/hosts
[root@rac01 ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.101 rac01
192.168.56.111 rac01-vip
192.168.1.229 rac01-priv
192.168.56.156 cluster-scan
安装ASM
scan-name写/etc/hosts中的cluster-scan
注意修改公共主机名和虚拟主机名,若为单节点则不用配置SSH互信
注意etho 和 eth2 哪个是公共网卡哪个是桥接网卡
选择ASM
冗余选择外部冗余
选择不使用IPM
执行脚本
安装完成后配置asmca
create 创建磁盘组
剩下的硬盘起名为DATA磁盘组
Mount all,之后推出
此时直接启用dbca配置可能会无法发现磁盘组,我们需要进入grid家目录执行chmod +s权限,使ORACLE用户可以看到磁盘组
cd /u01/app/11.2.0/grid/bin/
chmod +s oracle
启用dbca
使用 DBCA 启动创建恢复目录数据库的进程
在 database templates( 数据库模板 ) 页上,保留默认值“ General Purpose ” ( 一般用途 ) 或 Transaction Processing( 事物处理 )
在 database identification( 数据库标识 ) ,输入恢复目录数据库的名称,使用 rcat.example.com 作为 Global Database Name (全局数据库名)
Management options (管理选项) 取消选中 configure enterprise manager( 配置 em)
Automatic Maintenance Tasks( 自动维护任务 ) 取消选中 Enable Automatic Maintenance Tasks (启用自动维护任务)
所有账户使用同一管理口令
Database file locations( 数据库文件位置 ) 选择 Automatic Storage Management ( ASM )(自动存储管理)作为 Storage Type( 存储类型 ). 选择 Use common location for all database files (所有数据库文件使用公共位置) 然后选择 DATA 磁盘组
在 recovery configuration( 恢复配置 ), 选中 specify flash recovery( 指定快速恢复区 ) 选择 +FRA 磁盘组,并确保 Flash Recovery Area size (快速恢复区大小)为 4062MB
不勾选示例方案
在 initialization parameter (初始化参数),将内存大小设置为 303MB ,单击 Use Automatic Memory Management( 使用自动内存管理 )
字符集选项卡选择 use unicode(AL32UTF8)
之后进行create database
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流