千家信息网

Oracle Linux 7.1 安装oracle 12c RAC

发表于:2025-01-21 作者:千家信息网编辑
千家信息网最后更新 2025年01月21日,OS环境:[root@rac12c1 ~]# uname -aLinux rac12c1 3.8.13-55.1.6.el7uek.x86_64 #2 SMP Wed Feb 11 14:18:22
千家信息网最后更新 2025年01月21日Oracle Linux 7.1 安装oracle 12c RAC

OS环境:

[root@rac12c1 ~]# uname -aLinux rac12c1 3.8.13-55.1.6.el7uek.x86_64 #2 SMP Wed Feb 11 14:18:22 PST 2015 x86_64 x86_64 x86_64 GNU/Linux

IP规划:

[root@rac12c1 ~]# cat /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6# Public IP for Oracle 12C RAC 172.16.30.221    rac12c1.localdomain    rac12c1 172.16.30.222    rac12c2.localdomain    rac12c2# Private IP for Oracle 12C RAC 192.168.30.221     rac12c1pri.localdomain rac12c1pri 192.168.30.222     rac12c1pri.localdomain rac12c2pri# Virtual IP for Oracle 12C RAC 172.16.30.223    rac12c1vip.localdomain rac12c1vip 172.16.30.224    rac12c2vip.localdomain rac12c2vip #SCAN172.16.30.225 rac12c-scan.localdomain rac12c-scan

禁用Selinux:

[root@rac12c1 ~]# cat /etc/selinux/config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:#     enforcing - SELinux security policy is enforced.#     permissive - SELinux prints warnings instead of enforcing.#     disabled - No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of three two values:#     targeted - Targeted processes are protected,#     minimum - Modification of targeted policy. Only selected processes are protected. #     mls - Multi Level Security protection.SELINUXTYPE=targeted [root@rac12c1 ~]# setenforce 0

修改/dev/shm大小为8G

tmpfs             /dev/shm                 tmpfs   rw,exec,size=2048M 0 0[root@rac12c1 ~]# mount -o remount /dev/shm/

禁用防火墙:

[root@rac12c1 ~]# systemctl start firewalld.service[root@rac12c1 ~]# systemctl stop firewalld.service[root@rac12c1 ~]# ]# systemctl disable firewalld.servicerm '/etc/systemd/system/basic.target.wants/firewalld.service'rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'

重启各个节点操作系统,检查各个节点网络连通性:

[root@rac12c1 ~]# ping rac12c2pri[root@rac12c1 ~]# ping rac12c2

,,,

配置YUM:

[root@rac12c1 ~]# cat /etc/yum.repos.d/base.repo [ol7_latest]name=Oracle Linux $releasever Latest ($basearch)baseurl=file:///mntgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oraclegpgcheck=0enabled=1

安装oracle相关的依赖包:

[root@rac12c1 ~]# yum install oracle-rdbms-server-12cR1-preinstall -y

创建用户组和用户,上步操作依据创建了oinstall 54321 dba 54322用户组)和用户oracle(54321),所以执行如下操作创建相关的用户组和用户

添加组

[root@rac12c1 ~]# groupadd -g 54323 oper[root@rac12c1 ~]# groupadd -g 54325 asmdba[root@rac12c1 ~]# groupadd -g 54328 asmadmin[root@rac12c1 ~]# groupadd -g 54329 asmoper

添加grid用户

[[root@rac12c1 ~]# useradd -u 54322 -g oinstall -G dba,asmdba,asmadmin,asmoper grid

为oracle和grid用户设置密码

[root@rac12c1~]# passwd oracle[root@rac12c1~]# passwd grid

确保oracle是oper,asmdba组成员

[root@rac12c1 ~]# usermod  -g oinstall -G dba,oper,asmdba oracle

修改用户资源限制:grid soft nofile 1024

 grid hard nofile 65536 grid soft nproc 16384 grid hard nproc 16384 grid soft stack 10240 grid hard stack 32768 grid hard memlock 134217728 grid soft memlock 134217728## # Oracle user oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 oracle hard memlock 13217728 oracle soft memlock 134217728# End of file

修改内核参数,

fs.file-max = 6815744kernel.sem = 250 32000 100 128kernel.shmmni = 4096kernel.shmall = 1073741824kernel.shmmax = 4398046511104kernel.panic_on_oops = 1net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576fs.aio-max-nr = 1048576net.ipv4.ip_local_port_range = 9000 65500
[root@rac12c1 ~]# /sbin/sysctl -p

安装 oracleasm-support and oracleasmlib,配置共享磁盘。

[root@rac12c1 ~]# rpm -qa | grep oracleasmkmod-oracleasm-2.0.8-8.el7.x86_64oracleasm-support-2.1.8-3.el7.x86_64oracleasmlib-2.0.8-2.el7.x86_64

http://www.oracle.com/technetwork/server-storage/linux/asmlib/ol7-2352094.html 下载ASMLIB包。

[root@rac12c1 ~]# /etc/init.d/oracleasm configure -iConfiguring the Oracle ASM library driver.This will configure the on-boot properties of the Oracle ASM librarydriver.  The following questions will determine whether the driver isloaded on boot and what permissions it will have.  The current valueswill be shown in brackets ('[]').  Hitting  without typing ananswer will keep that current value.  Ctrl-C will abort.Default user to own the driver interface [grid]: gridDefault group to own the driver interface [asmadmin]: asmadminScan for Oracle ASM disks on boot (y/n) [y]: yWriting Oracle ASM library driver configuration: doneInitializing the Oracle ASMLib driver:                     [  OK  ]Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@rac12c1 ~]# /usr/sbin/oracleasm configureORACLEASM_UID=gridORACLEASM_GID=asmadminORACLEASM_SCANBOOT=trueORACLEASM_SCANORDER=""ORACLEASM_SCANEXCLUDE=""ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
[root@rac12c1 ~]# tail -2 /etc/pam.d/login session required /lib64/security/pam_limits.sosession required pam_limits.so

配置DNS:

[root@rac12c1 ~]# vim /etc/resolv.conf# Generated by NetworkManagersearch localdomain

禁用NTP服务:

[root@rac12c1 ~]#/sbin/service ntpd stop[root@rac12c1 ~]#chkconfig ntpd off[root@rac12c1 ~]#mv /etc/ntp.conf /etc/ntp.conf.org[root@rac12c1 ~]#rm /var/run/ntpd.pid

建立安装目录:

[root@rac12c1 ~]#mkdir -p /u01/app/12.1.0/grid[root@rac12c1 ~]#mkdir -p /u01/app/grid[root@rac12c1 ~]#mkdir -p /u01/app/oracle[root@rac12c1 ~]#mkdir -p /u01/app/oracle/product/12.1.0/db_1[root@rac12c1 ~]#chown -R grid:oinstall /u01[root@rac12c1 ~]#chown -R oracle:oinstall /u01/app/oracle[root@rac12c1 ~]## chmod -R 775 /u01/

分区,配置共享磁盘:

[oracle@rac12c1 ~]$ ls -l /dev/sd*brw-rw---- 1 root disk 8,  0 Aug 21 18:33 /dev/sdabrw-rw---- 1 root disk 8,  1 Aug 21 18:33 /dev/sda1brw-rw---- 1 root disk 8,  2 Aug 21 18:33 /dev/sda2brw-rw---- 1 root disk 8,  3 Aug 21 18:33 /dev/sda3brw-rw---- 1 root disk 8, 16 Aug 22 20:27 /dev/sdbbrw-rw---- 1 root disk 8, 17 Aug 22 20:27 /dev/sdb1brw-rw---- 1 root disk 8, 32 Aug 21 22:47 /dev/sdcbrw-rw---- 1 root disk 8, 33 Aug 21 22:47 /dev/sdc1brw-rw---- 1 root disk 8, 48 Aug 21 22:47 /dev/sddbrw-rw---- 1 root disk 8, 49 Aug 21 22:47 /dev/sdd1brw-rw---- 1 root disk 8, 64 Aug 21 22:47 /dev/sdebrw-rw---- 1 root disk 8, 65 Aug 21 22:47 /dev/sde1[oracle@rac12c1 ~]$ /etc/init.d/oracleasm createdisk CRS /dev/sdc1[oracle@rac12c1 ~]$ /etc/init.d/oracleasm createdisk DATA1 /dev/sd1[oracle@rac12c1 ~]$ /etc/init.d/oracleasm createdisk DATA2 /dev/sde1[root@rac12c1 ~]# /etc/init.d/oracleasm scandisks Scanning the system for Oracle ASMLib disks:               [  OK  ][root@rac12c1 ~]# /etc/init.d/oracleasm listdisks CRSDATA1DATA2

另外一个节点,扫描共享磁盘。

配置用户环境变量:

[root@rac12c1 ~]# cat /home/grid/.bash_profile # .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHexport ORACLE_BASE=/u01/app/grid export ORACLE_HOME=/u01/app/12.1.0/grid export ORACLE_SID=+ASM1export 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 export DISPLAY=:0.0 umask=022 alias asmcmd='rlwrap asmcmd'[root@rac12c1 ~]# cat /home/oracle/.bash_profile # .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHPATH=$PATH:$HOME/bin export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1 export ORACLE_SID=crmdb1 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 export DISPLAY=:0.0 umask=022 export PATH alias sqlplus='rlwrap sqlplus'alias rman='rlwrap rman'

安装cvuqdisk软件包

[root@rac12c1 ~]# rpm -ivh cvuqdisk-1.0.9-1.rpm
开始安装GRID=》安装数据软件=>安装数据库。

[grid@rac12c1 rpm]$ crsctl stat res -t--------------------------------------------------------------------------------Name           Target  State        Server                   State details       --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.CRS.dg               ONLINE  ONLINE       rac12c1                  STABLE               ONLINE  ONLINE       rac12c2                  STABLEora.DATA.dg               ONLINE  ONLINE       rac12c1                  STABLE               ONLINE  ONLINE       rac12c2                  STABLEora.LISTENER.lsnr               ONLINE  ONLINE       rac12c1                  STABLE               ONLINE  ONLINE       rac12c2                  STABLEora.asm               ONLINE  ONLINE       rac12c1                  Started,STABLE               ONLINE  ONLINE       rac12c2                  Started,STABLEora.net1.network               ONLINE  ONLINE       rac12c1                  STABLE               ONLINE  ONLINE       rac12c2                  STABLEora.ons               ONLINE  ONLINE       rac12c1                  STABLE               ONLINE  ONLINE       rac12c2                  STABLE--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.LISTENER_SCAN1.lsnr      1        ONLINE  ONLINE       rac12c1                  STABLEora.MGMTLSNR      1        ONLINE  ONLINE       rac12c1                  169.254.109.218 192.                                                             168.30.221,STABLEora.crmdb.db      1        ONLINE  ONLINE       rac12c2                  Open,STABLE      2        ONLINE  ONLINE       rac12c1                  Open,STABLEora.cvu      1        ONLINE  ONLINE       rac12c1                  STABLEora.mgmtdb      1        ONLINE  ONLINE       rac12c1                  Open,STABLEora.oc4j      1        ONLINE  ONLINE       rac12c1                  STABLEora.rac12c1.vip      1        ONLINE  ONLINE       rac12c1                  STABLEora.rac12c2.vip      1        ONLINE  ONLINE       rac12c2                  STABLEora.scan1.vip      1        ONLINE  ONLINE       rac12c1                  STABLE--------------------------------------------------------------------------------[oracle@rac12c1 ~]$ srvctl status database -d crmdbInstance crmdb1 is running on node rac12c1Instance crmdb2 is running on node rac12c2
SQL> select a.name,a.open_mode,b.instance_name from gv$database a,gv$instance b where a.inst_id=b.inst_id;NAME   OPEN_MODE        INSTANCE_NAME--------- -------------------- ----------------CRMDB   READ WRITE        crmdb1CRMDB   READ WRITE        crmdb2SQL> select * from v$version where rownum=1;BANNER              CON_ID---------------------------------------------------------------------------------------------------- ----------Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production          0

===end====

0