smartrac1 smartrac2
223.223.80.71 223.223.80.72
16.16.16.1 16.16.16.2
1.VBox5.0 安装和下载(略)
2. 先各自安装RHEL6.8,进入系统后关机。
3.创建一个磁盘为固定大小磁盘,设置为共享属性,附加到2个虚机中即可。
4. 再启动两个虚机客户端。
VMware 的模拟硬件环境搭建:(类似,只是共享盘需要用命令)
C:\ProgramFiles(x86)\VMware\VMwareWorkstation>
vmware-vdiskmanager.exe-c-s10240M-alslogic-t2"C:\ShareDisk\sharedisk-1.vmdk"
C:\ProgramFiles(x86)\VMware\VMwareWorkstation>vmware-vdiskmanager.exe-c-s10240M-alslogic-t2"C:\ShareDisk\sharedisk-2.vmdk"
vmware-vdiskmanager.exe-c-s10240M-alslogic-t2"C:\ShareDisk\sharedisk-3.vmdk"
vmware-vdiskmanager.exe-c-s10240M-alslogic-t2"C:\ShareDisk\sharedisk-4.vmdk"
更改VMX文件。
disk.locking="FALSE"
scsi0:1.SharedBus="Virtual"
scsi0:2.SharedBus="Virtual"
scsi0:3.SharedBus="Virtual"
scsi0:4.SharedBus="Virtual"
disk.EnableUUID="TRUE"
5. 配置HOST:
[
root@rac1etc]# vim /etc/hosts
#127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4rac1.sdsmart.cnrac1 ---
一定要注释掉
#::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6rac1.sdsmart.cnrac1---
一定要注释掉
127.0.0.1 localhost
::1 localhost
#Public
223.223.83.110 rac1
223.223.83.112 rac2
#Private
16.16.16.1 rac1-pri
16.16.16.2 rac2-pri
#Virtual
223.223.83.90 rac1-vip
223.223.83.92 rac2-vip
#SCAN
223.223.83.99 rac-scan
6.配置sysctl.conf (固定不变的)
vim /etc/sysctl.conf
fs.aio-max-nr=1048576
fs.file-max=6815744
kernel.shmmni=4096
kernel.sem=25032000100128
net.ipv4.ip_local_port_range=900065500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586
执行
#/sbin/sysctl–p
7.修改/etc/security/limits.conf
vim /etc/security/limits.conf
gridsoftnproc2047
gridhardnproc16384
gridsoftnofile1024
gridhardnofile65536
gridsoftstack10240
gridhardstack32768
oraclesoftnproc2047
oraclehardnproc16384
oraclesoftnofile1024
oraclehardnofile65536
oraclesoftstack10240
oraclehardstack32768
9.禁止网络时间服务、防火墙
servicentpdstop
chkconfigntpdoff
serviceiptablesstop
chkconfigiptablesoff
10.关闭SELinux
vi/etc/selinux/config
SELINUX=disabled
groupadd-g1100oinstall
groupadd-g1200asmadmin
groupadd-g1101dba
groupadd-g1102oper
groupadd-g1201asmdba
groupadd-g1202asmoper
useradd-u1100-goinstall-Gdba,oper,asmdba-d/home/oracle-moracle
useradd-u1200-goinstall-Gasmadmin,asmdba,asmoper,dba-d/home/grid-mgrid
--rm /var/spool/mail/oracle
--userdel-roracle
useradd-u1100-goinstall-Gdba,asmdba-d/home/oracle-moracle
usermod-u1100-goinstall-Gdba,asmdba-d/home/oracle-moracle
useradd-u1200-goinstall-Gasmadmin,dba-d/home/grid-mgrid
usermod-u1200-goinstall-Gasmadmin,dba-d/home/grid-mgrid
12.创建目录授权
mkdir-p/u01/app/grid
mkdir-p/u01/app/11.2.0/grid
mkdir-p/u01/app/oracle/product/11.2.0/db_1
mkdir-p/orasoft/ora11g
--更改属主,权限
chown-Rgrid:oinstall/u01/app
chown-Roracle:oinstall/u01/app/oracle
chown-Rgrid:oinstall/orasoft/ora11g
chmod-R777/orasoft/ora11g
13.RPM包:
cd
/media/
RHEL-6.8\Server.x86_64
/Packages
rpm-Uvhbinutils-2.*
rpm-Uvhcompat-libstdc++-33*
rpm-Uvhelfutils-libelf-0.*
rpm-Uvhelfutils-libelf-devel-*
rpm-Uvhgcc-4.*
rpm-Uvhgcc-c++-4.*
rpm-Uvhglibc-2.*
rpm-Uvhglibc-common-2.*
rpm-Uvhglibc-devel-2.*
rpm-Uvhglibc-headers-2.*
rpm-Uvhksh-2*
rpm-Uvhlibaio-0.*
rpm-Uvhlibaio-devel-0.*
rpm-Uvhlibgcc-4.*
rpm-Uvhlibstdc++-4.*
rpm-Uvhlibstdc++-devel-4.*
rpm-Uvhmake-3.*
rpm-Uvhsysstat-7.*
rpm-UvhunixODBC-2.*
rpm-UvhunixODBC-devel-2.*
14.搭建YUM本地仓库
[
root@rac1mnt]#cp-rf/media/RHEL-6.8\Server.x86_64/ /mnt/
[
root@rac1mnt]# mv /mnt/RHEL-6.8\Server.x86_64 /mnt/
cd /etc/yum.repos.d/
vim
vimrhel-source.repo
name=RedHatEnterpriseLinux$releasever-$basearch-Source
#baseurl=
ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPM
S/
baseurl=file:///mnt/redhat/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
保存后,执行 yum makecache
yum install binutils
yum install
compat-libstdc++-33*
yum install
elfutils-libelf-0.*
yum install
elfutils-libelf-devel-*
yum install
gcc-4.*
yum install
gcc-c++-4.*
yum install
glibc-2.*
yum install
glibc-common-2.*
yum install
glibc-devel-2.*
yum install
glibc-headers-2.*
yum install
ksh-2*
yum install
libaio-0.*
yum install
libaio-devel-0.*
yum install
libgcc-4.*
yum install
libstdc++-4.*
yum install
libstdc++-devel-4.*
yum install
make-3.*
yum install
sysstat-7.*
yum install
unixODBC-2.*
yum install
unixODBC-devel-2.*
15.建立用户环境变量
--grid 用户
ORACLE_BASE=/u01/app/grid;exportORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid;exportORACLE_HOME
GRID_HOME=/u01/app/11.2.0/grid;exportGRID_HOME
ORACLE_SID=+ASM2;exportORACLE_SID
TNS_ADMIN=$ORACLE_HOME/network/admin;exportTNS_ADMIN
PATH=${PATH}:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch;exportPATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
exportLD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
exportCLASSPATH
THREADS_FLAG=native;exportTHREADS_FLAG
exportTEMP=/tmp
exportTMPDIR=/tmp
exportNLS_DATE_FORMAT="YYYY-MM-DDHH24:MI:SS"
if[$USER="oracle"]||[$USER="grid"];then
if[$SHELL="/bin/ksh"];then
ulimit-p16384
ulimit-n65536
else
ulimit-u16384-n65536
fi
fi
ORACLE_BASE=/u01/app/oracle;exportORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;exportORACLE_HOME
ORACLE_SID=
gnnt2;exportORACLE_SID
TNS_ADMIN=$ORACLE_HOME/network/admin;exportTNS_ADMIN
PATH=${PATH}:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch;exportPATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
exportLD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
exportCLASSPATH
THREADS_FLAG=native;exportTHREADS_FLAG
exportTEMP=/tmp
exportTMPDIR=/tmp
exportNLS_LANG=AMERICAN_AMERICA.AL32UTF8
exportNLS_DATE_FORMAT="YYYY-MM-DDHH24:MI:SS"
if[$USER="oracle"]||[$USER="grid"];then
if[$SHELL="/bin/ksh"];then
ulimit-p16384
ulimit-n65536
else
ulimit-u16384-n65536
fi
fi
16.建立SSH认证(oracle/grid) 非常重要
visshx(在oracle/grid下均建立此脚本)
mkdir-p~/.ssh
chmod-R755~/.ssh
/usr/bin/ssh-keygen-trsa
/usr/bin/ssh-keygen-tdsa
cat~/.ssh/id_rsa.pub>>~/.ssh/authorized_keys
cat~/.ssh/id_dsa.pub>>~/.ssh/authorized_keys
echo-n"waitanotherhost$1runfinish,presstwicekeycontinue!!!"
reada
reada
ssh$1cat~/.ssh/id_rsa.pub>>~/.ssh/authorized_keys
ssh$1cat~/.ssh/id_dsa.pub>>~/.ssh/authorized_keys
chmod-R644~/.ssh/authorized_keys
--授权
chmod 755 ~/sshx
建立完毕后互相测试是否不需要密码认证 非常重要
ssh rac1.sdsmart.cn date
sshrac2.sdsmart.cndate
sshrac1 date
ssh rac2 date
sshrac1-pri.sdsmart.cn date
sshrac2-pri.sdsmart.cn date
sshrac1-pub.sdsmart.cn date
sshrac2-pub.sdsmart.cn date
17.设置时间同步
vi/etc/ntp.conf
server10.135.8.100prefer
也可以本地设定日期时间:
$date-s'2016-07-11 16:55:00'
如果仅需要设置日期或者时间,可以使用date -d mm/dd/yy及date -s hh:mm:ss。
18.创建UDEV
---
创建个文件
echo"options=--whitelisted--replace-whitespace">>/etc/scsi_id.config
---添加RULE
--5块硬盘(/dev/sdb sdc sdd sde sdf)
foriinbcd e ;
do
echo"KERNEL==\"sd*\",BUS==\"scsi\",PROGRAM==\"/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/\$name\",RESULT==\"`/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/sd$i`\",NAME=\"asm-disk$i\",OWNER=\"grid\",GROUP=\"asmadmin\",MODE=\"0660\"">>/etc/udev/rules.d/99-oracle-asmdevices.rules
done
查看结果如下:
cat/etc/udev/rules.d/99-oracle-asmdevices.rules
rm/etc/udev/rules.d/99-oracle-asmdevices.rules
--检查是否可写
ddif=/dev/sdbof=/dev/nullbs=1Mcount=1
19. 启动UDEV
/sbin/start_udev
[
root@rac1rules.d]#cat99-oracle-asmdevices.rules
KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name",RESULT=="1ATA_VBox_HARDDISK_VB1faf0bb4-32ab5fcf",NAME="asm-diskb",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd*",RESULT=="1ATA_VBox_HARDDISK_VB1cab8d6b-307a9107",NAME="asm-diskc",RESULT=="1ATA_VBox_HARDDISK_VBac63a170-a1d9ad9d",NAME="asm-diskd",RESULT=="1ATA_VBox_HARDDISK_VBd1c2dd31-a66738c5",NAME="asm-diske",RESULT=="1ATA_VBox_HARDDISK_VB445d4c5e-9312d88b",NAME="asm-diskf",MODE="0660"
[
root@rac1rules.d]#ls-l/dev/asm*
ls:cannotaccess/dev/asm*:Nosuchfileordirectory
[
root@rac1rules.d]#
[
root@rac1rules.d]#
[
root@rac1rules.d]#
[
root@rac1rules.d]#start_udev
Startingudev:[OK]
[
root@rac1rules.d]#
ls-l/dev/asm*
brw-rw----1gridasmadmin8,16Jul710:27/dev/asm-diskb
brw-rw----1gridasmadmin8,32Jul710:27/dev/asm-diskc
brw-rw----1gridasmadmin8,48Jul710:27/dev/asm-diskd
brw-rw----1gridasmadmin8,64Jul710:27/dev/asm-diske
brw-rw----1gridasmadmin8,80Jul710:27/dev/asm-diskf
[
root@rac1rules.d]#
20.rz传输压缩包,解压缩
###grid用户
unzipp13390677_112040_Linux-x86-64_3of7.zip
###oracle用户
unzipp13390677_112040_Linux-x86-64_1of7.zip
unzipp13390677_112040_Linux-x86-64_2of7.zip
unzipp19121551_112040_Linux_x86_64.zip
检查是否正常,可进行安装
[
grid@rac1~]$cd/mnt/redhat/oracle/grid/
[
grid@rac1grid]$./runcluvfy.shstage-precrsinst-n smartrac1,smartrac2-verbose>/tmp/runcvuvfy.out
给出的报告可以忽略掉
pdksh 和 elfunits 两个组件包,也可自行安装.
elfutils-libelf-devel-0.97
pdksh-5.2.14
21 安装、配置Grid的三方RPM包
cd /mnt/redhat/oracle/grid/rpm
rpm-ivhcvuqdisk-1.0.9-1.rpm
CVUQDISK_GRP=oinstall;exportCVUQDISK_GRP
22.安装GRID
需要进到主机进行图形化安装,分辨率设置再1024以上。
最后执行脚本
rac1 rac2 上执行脚本:
/u01/app/oraInventory/orainstRoot.sh
rac1 rac2 上执行脚本:
/u01/app/11.2.0/grid/root.sh
23.进行asmca配置
grid用户执行
asmca命令。
增加两个区:
EXTERNAL: 独立硬盘设备。
24.安装ORACLE服务器端程序。
1.进入Oracle用户
2.图形化安装。
暂时忽略以上错误,点击下一步。
24. RAC关机顺序指令:
---rac1
su-oracle
sqlplus/assysdba
shutdownimmediate
su-grid
alterdiskgroupdatadismount;
alterdiskgroupfradismount;
---rac2
su-grid
alterdiskgroupdatamount;
alterdiskgroupframount;
上述这个步骤主要就是让oracle进行ASMINSTANCERECOVERY
su-oracle
sqlplus/assysdba
startup
---rac1
su-grid
alterdiskgroupdatamount;
alterdiskgroupframount;
su-oracle
sqlplus/assysdba
startup
su-oracle
sqlplus/assysdba
shutdownimmediate
su-grid
alterdiskgroupdatadismount;
alterdiskgroupfradismount;
---rac2
su-grid
alterdiskgroupdatamount;
alterdiskgroupframount;
上述这个步骤主要就是让oracle进行ASMINSTANCERECOVERY
su-oracle
sqlplus/assysdba
startup
---rac1
su-grid
alterdiskgroupdatamount;
alterdiskgroupframount;
su-oracle
sqlplus/assysdba
startup
异常问题处理
--卸了重装
./runInstaller -silent -deinstall -removeallfiles "REMOVE_HOMES={/u01/app/oracle/product/11.2.0_1}" -invPtrLoc /etc/oraInst.loc
--检查集群状态
crsctlcheckcluster
srvctlstatusdatabase-dYMS
--节点应用程序状态
statusnodeapps
--列出所有的配置数据库
srvctlconfigdatabase
--数据库配置
--手工注册监听
srvctlconfigdatabase-dYMS-a
alter system register;
--查看RAC节点状态
crsctl stat res -t
--查看节点
crs_stat -t -v
--启动单实例
srvctl enable instance -d ractest -i ractest1
srvctl relocate scan_listener -i 1 -n rac2
--启动监听
srvctlstartlistener-nrac1
--日志路径
集群日志:
/u01/app/11.2.0/grid/log
ASMINSTANCE日志:
/u01/app/grid/diag/asm/+asm
DBINSTANCE日志:
/u01/app/oracle/diag
//拷贝迁移虚拟机造成IP网卡无法在正常运行的方法。
1.先用ifconfig看看当前网卡的实际物理地址
2.更改 /etc/sysconfig/network-scripting 下的 ifcfg-ethXX 拷贝ifconfig看到的物理地址到 ifcfg-ethXX
3.更
@H_594_1502@改
@H_594_1502@/etc/udev/rules.d/
@H_594_1502@70
@H_594_1502@-persistent-net.rules对应的物理地址即可。
增加虚拟内存: