##安装桌面
yum -y groupinstall "Server with GUI"
#启动桌面
startx
#设置启动模式
[root@rhel7-ora12c-ip21 ~]# systemctl get-default
multi-user.target
[root@rhel7-ora12c-ip21 ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3 #多用户模式
# graphical.target: analogous to runlevel 5 #图形化模式
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#
[root@rhel7-ora12c-ip21 ~]# systemctl set-default graphical.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
[root@localhost ~]# systemctl get-default
graphical.target
##创建用户和组
groupadd -g 500 oinstall
groupadd -g 501 dba
groupadd -g 502 oper
groupadd -g 600 asmadmin
groupadd -g 601 asmdba
groupadd -g 602 asmoper
useradd -u 1000 -g oinstall -G dba,oper,asmdba oracle
useradd -u 1001 -g oinstall -G dba,asmdba,asmadmin,asmoper grid
##packages for linux 7
rpm -qa | grep binutils-2.23.52.0.1-12.el7.x86_64
rpm -qa | grep compat-libcap1-1.10-3.el7.x86_64
rpm -qa | grep compat-libstdc++-33-3.2.3-71.el7.i686
rpm -qa | grep compat-libstdc++-33-3.2.3-71.el7.x86_64
rpm -qa | grep gcc-4.8.2-3.el7.x86_64
rpm -qa | grep gcc-c++-4.8.2-3.el7.x86_64
rpm -qa | grep glibc-2.17-36.el7.i686
rpm -qa | grep glibc-2.17-36.el7.x86_64
rpm -qa | grep glibc-devel-2.17-36.el7.i686
rpm -qa | grep glibc-devel-2.17-36.el7.x86_64
rpm -qa | grep ksh
rpm -qa | grep libaio-0.3.109-9.el7.i686
rpm -qa | grep libaio-0.3.109-9.el7.x86_64
rpm -qa | grep libaio-devel-0.3.109-9.el7.i686
rpm -qa | grep libaio-devel-0.3.109-9.el7.x86_64
rpm -qa | grep libgcc-4.8.2-3.el7.i686
rpm -qa | grep libgcc-4.8.2-3.el7.x86_64
rpm -qa | grep libstdc++-4.8.2-3.el7.i686
rpm -qa | grep libstdc++-4.8.2-3.el7.x86_64
rpm -qa | grep libstdc++-devel-4.8.2-3.el7.i686
rpm -qa | grep libstdc++-devel-4.8.2-3.el7.x86_64
rpm -qa | grep libXi-1.7.2-1.el7.i686
rpm -qa | grep libXi-1.7.2-1.el7.x86_64
rpm -qa | grep libXtst-1.2.2-1.el7.i686
rpm -qa | grep libXtst-1.2.2-1.el7.x86_64
rpm -qa | grep make-3.82-19.el7.x86_64
rpm -qa | grep sysstat-10.1.5-1.el7.x86_64
yum -y install binutils compat-libcap1 compat-libstdc++-33
compat-libstdc++-33*.i686 gcc gcc-c++ glibc glibc*.i686 glibc-devel
glibc-devel*.i686 ksh libaio libaio-*.i686 libaio-devel
libaio-devel*.i686 libgcc libgcc*.i686 libstdc++ libstdc++-*.i686
libstdc++-devel libstdc++devel*.i686 libXi libXi*.i686 libXtst
libXtst*.i686 make sysstat unixODBC unixODBC-devel unixODBC*.i686
yum -y localinstall compat-libstdc++-33-3.2.3-72.el7.* #单独下载
##vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
/sbin/sysctl -p
##官方文档对shmmax的设置解释,(文档 ID 567506.1),我一般直接使用当前设置/sbin/sysctl -a | grep shm
#Oracle Global Customer Support officially recommends a " maximum" for SHMMAX of "1/2 of physical RAM".
#The maximum size of a shared memory segment is limited by the size of
the available user address space. On 64-bit systems, this is a
theoretical 2^64bytes. So the "theoretical limit" for SHMMAX is the
amount of physical RAM that you have. However, to actually attempt to
use such a value could potentially lead to a situation where no system
memory is available for anything else. Therefore a more realistic
"physical limit" for SHMMAX would probably be "physical RAM - 2Gb".
#In an Oracle RDBMS application, this "physical limit" still leaves
inadequate system memory for other necessary functions. Therefore, the
common "Oracle maximum" for SHMMAX that you will often see is "1/2 of
physical RAM". Many Oracle customers chose a higher fraction, at their
discretion.
#Occasionally, Customers may erroneously think that that setting the
SHMMAX as recommended in this NOTE limits the total SGA. That is not
true. Setting the SHMMAX as recommended only causes a few more "shared
memory segments" to be used for whatever total SGA that you subsequently
configure in Oracle. For additional detail, please see
##
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 10240
##创建安装目录
mkdir -p /u01/app/grid
mkdir -p /u01/app/gridhome
mkdir -p /u01/app/oracle
chown grid:oinstall /u01/app/grid
chown grid:oinstall /u01/app/gridhome
chown -R oracle:oinstall /u01/app/oracle
##修改hosts文件
ip add | grep enp0s8 | grep inet | awk '{print $2}' | awk -F"/" '{printf $1" "}{cmd="hostname";system(cmd)}' >> /etc/hosts
cat /etc/hosts
##关闭防火墙和selinux
[root@rhel7-ora12c-ip21 ~]# systemctl stop firewalld
[root@rhel7-ora12c-ip21 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@rhel7-ora12c-ip21 ~]# getenforce
Enforcing
[root@rhel7-ora12c-ip21 ~]# setenforce 0
[root@rhel7-ora12c-ip21 ~]# getenforce
Permissive
[root@rhel7-ora12c-ip21 ~]# vi /etc/selinux/config
SELINUX=disabled
或
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
##udev绑定裸设备,这里只绑定权限
[root@rhel7-ora12c-ip21 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb1
1ATA_VBOX_HARDDISK_VBc9bd6bdf-a347ac26
[root@rhel7-ora12c-ip21 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdc1
1ATA_VBOX_HARDDISK_VB8aeda10c-71ca412a
[root@rhel7-ora12c-ip21 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u -d /dev/$parent",
RESULT=="1ATA_VBOX_HARDDISK_VBc9bd6bdf-a347ac26", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u -d /dev/$parent",
RESULT=="1ATA_VBOX_HARDDISK_VB8aeda10c-71ca412a", OWNER="grid", GROUP="asmadmin", MODE="0660"
[root@rhel7-ora12c-ip21 ~]# systemctl restart systemd-udev-trigger.service
[root@rhel7-ora12c-ip21 ~]# ls -Ll /dev/sd?1
##节点二使用partprobe去发现分区
#使用多路径绑定
#/etc/multipath.conf multipaths { multipath { wwid 36006048cd70c3e37a4a85c04d0c79c6d alias data1 } multipath { wwid 36006048cb82e28ed3701a9e1eecb820a alias crs1 } multipath { wwid 3600601606a003a001eebdf56d80e0b2f alias data2 } multipath { wwid 3600601606a003a004aebdf56fce34966 alias data3 } } |
方法1:双节点设置 [root@rac1 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules ENV{DM_NAME}=="data1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="oraasm-$env{DM_NAME}" ENV{DM_NAME}=="data2", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="oraasm-$env{DM_NAME}" ENV{DM_NAME}=="data3", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="oraasm-$env{DM_NAME}" ENV{DM_NAME}=="crs1", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="oraasm-$env{DM_NAME}" |
方法2:双节点设置 cd /dev/mapper for i in `ls mpath*`; do printf "%s %s\n" "$i" "$(udevadm info --query=all --name=/dev/mapper/$i |grep -i dm_uuid)"; done data1 E: DM_UUID=mpath-36006048cd70c3e37a4a85c04d0c79c6d crs1 E: DM_UUID=mpath-36006048cb82e28ed3701a9e1eecb820a data2 E: DM_UUID=mpath-3600601606a003a001eebdf56d80e0b2f data3 E: DM_UUID=mpath-3600601606a003a004aebdf56fce34966 [root@rac1 ~]#
vi /etc/udev/rules.d/99-oracle-asmdevices.rules KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36006048cd70c3e37a4a85c04d0c79c6d",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36006048cb82e28ed3701a9e1eecb820a",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600601606a003a001eebdf56d80e0b2f",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600601606a003a004aebdf56fce34966",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660" |
#重启udev服务 systemctl restart systemd-udev-trigger.service |
##验证权限和属组 ls -Ll /dev/mapper/* ls -Ll /dev/oraasm-* ls -Ll /dev/dm-* |
##设置用户参数文件
su - grid
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/gridhome
export ORACLE_SID=+ASM1
PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/gridhome
export ORACLE_SID=+ASM2
PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
su - oracle
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1
ORACLE_SID=orcl2
export ORACLE_BASE ORACLE_HOME ORACLE_SID
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin:/usr/bin:/sbin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1
ORACLE_SID=orcl2
export ORACLE_BASE ORACLE_HOME ORACLE_SID
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin:/usr/bin:/sbin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
##建立互信关系
oracle:
cd /home/oracle
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
ssh
rhel7-ora12c-ip22 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh
rhel7-ora12c-ip22 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys
rhel7-ora12c-ip22:~/.ssh/authorized_keys
ssh
rhel7-ora12c-ip21 date;ssh
rhel7-ora12c-ip22 date;ssh
rhel7-ora12c-ip21-priv date;ssh
rhel7-ora12c-ip22-priv date
grid:
cd /home/grid
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
ssh
rhel7-ora12c-ip22 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh
rhel7-ora12c-ip22 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys
rhel7-ora12c-ip22:~/.ssh/authorized_keys
ssh
rhel7-ora12c-ip21 date;ssh
rhel7-ora12c-ip22 date;ssh
rhel7-ora12c-ip21-priv date;ssh
rhel7-ora12c-ip22-priv date
##安装cvuqdisk
[root@rhel7-ora12c-ip21 gridhome]# rpm -ivh ./cv/rpm/cvuqdisk-1.0.10-1.rpm
##安装前检查脚本
./runcluvfy.sh stage -pre crsinst -n
rhel7-ora12c-ip21,rhel7-ora12c-ip22 -fixup -verbose >> check.txt
##安装数据库软件和实例
./gridSetup.sh
注意:12c R2强制安装GIMR,要求空间最低37G
注:这里没有设置DNS,我把对DNS提示的错误全部忽略,物理内存要求大于8G,我忽略
##安装rdbms和instance和11G区别不大,正常安装即可
asmca创建磁盘组
安装rdbms
#创建实例
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28572479/viewspace-2145406/,如需转载,请注明出处,否则将追究法律责任。
未经允许不得转载:测试博客 » RHEL7.3 安装oracle12C R2 RAC