手机版 欢迎访问it开发者社区(www.mfbz.cn)网站

当前位置: > 开发

非图形方式安装与配置 Oracle 11g RAC(2)——配置操作系统环境

时间:2021/4/18 16:32:57|来源:|点击: 次

非图形方式安装与配置 Oracle 11g RAC(2)——配置操作系统环境

安装包含两个节点(节点名称分别为:rac1 和 rac2)的 Oracle 11g RAC,操作系统为 CentOS6.5,Grid 和 Oracle 软件的版本为 11.2.0.4。

一、查看操作系统版本

# Linux 内核版本
[root@rac1 ~]# uname -a
Linux rac1 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

[root@rac2 ~]# uname -a
Linux rac2 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

# Linux 系统版本
[root@rac1 ~]# cat /etc/redhat-release 
CentOS release 6.5 (Final)

[root@rac2 ~]# cat /etc/redhat-release 
CentOS release 6.5 (Final)

二、安装必要的软件(两个节点同时操作)

1、配置 yum 源

从 2020 年 12 月开始,CentOS6 官方将相关的软件源移出了官方 yum 源,这样在使用 yum 命令安装软件时会出现以下错误:

[root@rac2 ~]# yum install -y vim
Loaded plugins: fastestmirror
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

解决办法如下:

(1)关闭 fastestmirrors

修改 /etc/yum/pluginconf.d/fastestmirror.conf 文件,把其中的 enabled 选项修改为 0,如下所示:

[root@rac2 ~]# vi /etc/yum/pluginconf.d/fastestmirror.conf

[main]
enabled=0   # 把 enabled 选项的参数由 1 改为 0
verbose=0
always_print_best_host = true
socket_timeout=3
#  Relative paths are relative to the cachedir (and so works for users as well
# as root).
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook
#include_only=.nl,.de,.uk,.ie

(2)设置 yum 源

执行以下命令:

[root@rac2 network-scripts]# cd /etc/yum.repos.d

[root@rac2 yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

[root@rac1 /]# yum clean all
Cleaning repos: 
Cleaning up Everything

[root@rac1 /]# yum makecache
[root@rac1 yum.repos.d]# yum makecache
base                                            | 3.7 kB     00:00     
base/group_gz                                   | 242 kB     00:00     
base/filelists_db                               | 6.4 MB     00:22     
base/primary_db                                 | 4.7 MB     00:16     
base/other_db                                   | 2.8 MB     00:17     
extras                                          | 3.4 kB     00:00     
extras/filelists_db                             |  24 kB     00:00     
extras/prestodelta                          
.................

[root@rac1 /]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
102  1749  102  1749    0     0   1836      0 --:--:-- --:--:-- --:--:--  9505

如果以上命令执行失败,也可以直接编辑 CentOS-Base.repo 文件。命令如下:

#  出现错误
[root@rac2 yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo

curl: (7) couldn't connect to host

[root@rac2 yum.repos.d]# echo > CentOS-Base.repo

## 直接编辑CentOS-Base.repo 文件
[root@rac2 yum.repos.d]# vi CentOS-Base.repo
###    输入以下内容
#####################################################################################

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#####################################################################################

[root@rac1 yum.repos.d]# yum clean all
Cleaning repos: base extras updates
Cleaning up Everything
[root@rac1 yum.repos.d]# yum makecache
base                                                      | 3.7 kB     00:00     
base/group_gz                                             | 242 kB     00:00     
base/filelists_db                                         | 6.4 MB     00:02     
base/primary_db                                           | 4.7 MB     00:01     
base/other_db                                             | 2.8 MB     00:00     
extras                                                    | 3.4 kB     00:00     
extras/filelists_db                                       |  24 kB     00:00     
extras/prestodelta                                        | 2.2 kB     00:00     
extras/primary_db                                         |  29 kB     00:00     
extras/other_db                                           |  14 kB     00:00     
updates                                                   | 3.4 kB     00:00     
updates/filelists_db                                      | 8.4 MB     00:02     
updates/prestodelta                                       | 357 kB     00:00     
updates/primary_db                                        |  12 MB     00:07     
updates/other_db                                          | 479 kB     00:00     
Metadata Cache Created

2、安装常用的命令

### 1、安装 vim 文本编辑器
[root@rac1 /]# yum install -y vim
[root@rac1 yum.repos.d]# yum install -y vim
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-5.el6_10.2 will be installed
.........

Installed:
  vim-enhanced.x86_64 2:7.4.629-5.el6_10.2                                                                                            

Dependency Installed:
  gpm-libs.x86_64 0:1.20.6-12.el6           perl.x86_64 4:5.10.1-144.el6              perl-Module-Pluggable.x86_64 1:3.90-144.el6   
  perl-Pod-Escapes.x86_64 1:1.04-144.el6    perl-Pod-Simple.x86_64 1:3.13-144.el6     perl-libs.x86_64 4:5.10.1-144.el6             
  perl-version.x86_64 3:0.77-144.el6        vim-common.x86_64 2:7.4.629-5.el6_10.2    vim-filesystem.x86_64 2:7.4.629-5.el6_10.2    

Complete!


### 2、安装 wget 命令
[root@rac1 yum.repos.d]# yum install -y wget
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.12-10.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
 Package                      Arch                           Version                               Repository                    Size
=========================================================================================
Installing:
 wget                         x86_64                         1.12-10.el6                           base                         484 k

Transaction Summary
==========================================================================================
Install       1 Package(s)

Total download size: 484 k
Installed size: 1.8 M
Downloading Packages:
wget-1.12-10.el6.x86_64.rpm                              | 484 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : wget-1.12-10.el6.x86_64                                     1/1 
  Verifying  : wget-1.12-10.el6.x86_64                                     1/1 

Installed:
  wget.x86_64 0:1.12-10.el6                                                                                                           

Complete!


### 3、安装 rz、sz 命令
[root@rac1 yum.repos.d]# yum install -y lrzsz
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lrzsz.x86_64 0:0.12.20-27.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================
 Package                      Arch                          Version                                 Repository                   Size
==============================================================================================
Installing:
 lrzsz                        x86_64                        0.12.20-27.1.el6                        base                         71 k

Transaction Summary
=========================================================================================
Install       1 Package(s)

Total download size: 71 k
Installed size: 159 k
Downloading Packages:
lrzsz-0.12.20-27.1.el6.x86_64.rpm                                |  71 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : lrzsz-0.12.20-27.1.el6.x86_64                             1/1 
  Verifying  : lrzsz-0.12.20-27.1.el6.x86_64                             1/1 

Installed:
  lrzsz.x86_64 0:0.12.20-27.1.el6                                                                                                     

Complete!


### 4、安装 unzip 命令
[root@rac1 yum.repos.d]# yum install -y unzip
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package unzip.x86_64 0:6.0-5.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package                       Arch                           Version                              Repository                    Size
=====================================================================================
Installing:
 unzip                         x86_64                         6.0-5.el6                            base                         152 k

Transaction Summary
======================================================================================
Install       1 Package(s)

Total download size: 152 k
Installed size: 324 k
Downloading Packages:
unzip-6.0-5.el6.x86_64.rpm                                    | 152 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : unzip-6.0-5.el6.x86_64                                       1/1 
  Verifying  : unzip-6.0-5.el6.x86_64                                       1/1 

Installed:
  unzip.x86_64 0:6.0-5.el6                                                                                                            

Complete!


### 5、安装 scp 命令
[root@rac1 yum.repos.d]# yum install -y openssh-clients
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package openssh-clients.x86_64 0:5.3p1-124.el6_10 will be installed
...................

Installed:
  openssh-clients.x86_64 0:5.3p1-124.el6_10                                                                                           

Dependency Installed:
  libedit.x86_64 0:2.11-4.20080712cvs.1.el6                                                                                           

Dependency Updated:
  openssh.x86_64 0:5.3p1-124.el6_10                              openssh-server.x86_64 0:5.3p1-124.el6_10                             

Complete!


### 6、安装 partprobe 命令
[root@rac1 yum.repos.d]# yum install -y parted
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package parted.x86_64 0:2.1-29.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package                        Arch                           Version                             Repository                    Size
==========================================================================================
Installing:
 parted                         x86_64                         2.1-29.el6                          base                         608 k

Transaction Summary
========================================================================================
Install       1 Package(s)

Total download size: 608 k
Installed size: 2.2 M
Downloading Packages:
parted-2.1-29.el6.x86_64.rpm                                 | 608 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : parted-2.1-29.el6.x86_64                                       1/1 
  Verifying  : parted-2.1-29.el6.x86_64                                       1/1 

Installed:
  parted.x86_64 0:2.1-29.el6                                                                                                          

Complete!

三、上传 Oracle 软件(在节点 rac1 上操作)

[root@rac1 yum.repos.d]# mkdir -p /soft/grid
[root@rac1 yum.repos.d]# mkdir -p /soft/oracle
[root@rac1 yum.repos.d]# cd /soft/grid
[root@rac1 grid]# rz

# Grid 和 Oracle 软件的版本为 11.2.0.4,文件信息如下:
[root@rac1 grid]# ll
总用量 1177008
-rw-r--r--. 1 root root 1205251894 1月   7 2020 p13390677_112040_Linux-x86-64_3of7.zip
[root@rac1 grid]# 
[root@rac1 grid]# cd /soft/oracle
[root@rac1 oracle]# rz

[root@rac1 oracle]# ll
总用量 2487208
-rw-r--r--. 1 root root 1395582860 1月   7 2020 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 root root 1151304589 1月   7 2020 p13390677_112040_Linux-x86-64_2of7.zip

四、关闭防火墙和 selinux(两个节点同时操作)

1、永久关闭防火墙

[root@rac1 /]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]

[root@rac1 /]# chkconfig iptables off

2、关闭selinux

将文件 /etc/selinux/config 中的 SELINUX=enforcing 改为 SELINUX=disabled

[root@rac1 /]# vi /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  ### 将SELINUX=enforcing改为SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@rac1 /]# setenforce 0

五、修改主机的 shell 限制(两个节点同时操作)

修改 /etc/security/limits.conf 文件,在文件的结尾添加以下内容:

[root@rac1 /]# vi /etc/security/limits.conf
####在文件的结尾添加以下内容:

##############################################################
grid soft nofile 65536
grid hard nofile 65536
grid soft nproc 16384
grid hard nproc 16384

oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
##############################################################

六、修改主机的内核参数(两个节点同时操作)

修改 /etc/sysctl.conf 文件,在文件的结尾添加以下内容:

[root@rac1 /]# vi /etc/sysctl.conf
####在文件的结尾添加以下内容:

##############################################################
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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@rac1 /]# /sbin/sysctl -p

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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

七、修改 /etc/pam.d/login(两个节点同时操作)

修改 /etc/pam.d/login 文件,在文件的结尾添加以下内容:

[root@rac1 /]# vi /etc/pam.d/login

session required /lib/security/pam_limits.so 
session required pam_limits.so

Copyright © 2002-2019 某某自媒体运营 版权所有