Oracle Dataguard (the main library is Oracle rac cluster) configuration tutorial (01) - dataguard server to install Oracle software

Oracle Dataguard (the main library is Oracle rac cluster) configuration tutorial (01) - dataguard server to install Oracle software

insert image description here
/
This column explains in detail the configuration process of Oracle Dataguard (the Oracle version is 11g, and the main database is a two-node Oracle rac cluster). The main contents include:
(1) The installation of dataguard server Oracle software.
(2) Configuration of Oracle RAC main library and Dataguard server.
(3) Master-slave synchronization test.
(4) Master and standby library switching.
/

1. System environment

The main library is an Oracle rac two-node cluster. The operating system version is as follows:

[root@rac2 ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

The Oracle versions are as follows:

[oracle@rac2 ~]$ sqlplus -v
SQL*Plus: Release 11.2.0.4.0 Production

The IP addresses and hostnames used by the cluster are as follows:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Public Network ——公用IP
192.168.1.101 rac1   # 节点1的主机名为 rac1
192.168.1.102 rac2   # 节点2的主机名为 rac2

#Private Interconnect ——私有IP
10.1.1.101 rac1-priv
10.1.1.102 rac2-priv

#Virtual IP——虚拟IP,与公用IP必须在同一网段    
192.168.1.111 rac1-vip
192.168.1.112 rac2-vip

#scan IP
192.168.1.201 rac-scan

Oracle RAC cluster information is as follows:

[grid@rac1 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.BAK.dg     ora....up.type ONLINE    ONLINE    rac1        
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac1        
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1        
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac1        
ora.OCR.dg     ora....up.type ONLINE    ONLINE    rac1        
ora.asm        ora.asm.type   ONLINE    ONLINE    rac1        
ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac1        
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora.hisdb.db   ora....se.type ONLINE    ONLINE    rac1        
ora....network ora....rk.type ONLINE    ONLINE    rac1        
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    rac1        
ora.ons        ora.ons.type   ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    OFFLINE   OFFLINE               
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    OFFLINE   OFFLINE               
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac1        

Install Oracle software for the dataguard server (no need to build a library):

2. Configure the installation environment

1. View the operating system version of the dataguard server

[root@wgx-dg ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core) 

2. View the dataguard server IP address

[root@wgx-dg ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.151  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::20c:29ff:fed0:7d7d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:d0:7d:7d  txqueuelen 1000  (Ethernet)
        RX packets 26731  bytes 10589717 (10.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1923  bytes 167644 (163.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 36  bytes 2932 (2.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 36  bytes 2932 (2.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

3. Turn off the firewall

systemctl stop firewalld        # 关闭防火墙
systemctl disable firewalld     # 永久关闭防火墙
systemctl status firewalld      # 查看防火墙状态
# 关闭防火墙
[root@localhost ~]# systemctl stop firewalld

# 永久关闭防火墙
[root@localhost ~]# systemctl disable firewalld

# 查看防火墙状态
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

210 12:18:01 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
210 12:18:12 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
210 12:20:25 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
210 12:20:25 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.

4. Close selinux

(1) Modify the file /etc/selinux/config, set SELINUX=disabled

[root@localhost ~]# 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=diabled
# 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=targetedxxxxxxxxxx [root@localhost ~]# 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=diabled# 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=targetedsqlshell

(2) Execute setenforce 0

[root@localhost ~]# setenforce 0

5. View and modify the host name

hostname        # 查看主机名
hostname hisdg  # 临时修改主机名

# 查看主机名
[root@localhost ~]# hostname
localhost.localdomain

# 临时修改主机名
[root@localhost ~]# hostname hisdg

# 永久修改主机名
[root@localhost ~]# vi /etc/hostname
hisdg

# 查看主机名
[root@localhost ~]# hostname
hisdg

6. Modify the /etc/hosts file and add the host name and IP address

# 查看本机 ip 地址
[root@hisdg ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.151  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::20c:29ff:fed0:7d7d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:d0:7d:7d  txqueuelen 1000  (Ethernet)
        RX packets 405  bytes 45066 (44.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 304  bytes 45037 (43.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 72  bytes 6252 (6.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 72  bytes 6252 (6.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        
# 修改 /etc/hosts 文件
[root@hisdg ~]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.151 hisdg

7. Modify the system kernel parameters

(1) Edit the /etc/sysctl.conf file and add the following content at the end of the file

[root@hisdg ~]# vi /etc/sysctl.conf

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).


fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 1073741824  
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

######################################################################################
# 参数详解:
kernel.shmmax:
用于定义单个共享内存段的最大值。设置应该足够大,能在一个共享内存段下容纳下整个的SGA ,设置的过低可能会导致需要创建多个共享内存段,这样可能导致系统性能的下降。
官方建议值:
32位linux系统:可取最大值为4GB(4294967296bytes)-1byte,即4294967295。建议值为多于内存的一半,所以如果是32为系统,一般可取值为4294967295。32位系统对SGA大小有限制,所以SGA肯定可以包含在单个共享内存段中。
64位linux系统:可取的最大值为物理内存值-1byte,建议值为多于物理内存的一半,一般取值大于SGA_MAX_SIZE即可,可以取物理内存-1byte。
内存为 12G 时,该值为 12*1024*1024*1024-1 = 12884901887
内存为 16G 时,该值为 16*1024*1024*1024-1 = 17179869183
内存为 32G 时,该值为 32*1024*1024*1024-1 = 34359738367
内存为 64G 时,该值为 64*1024*1024*1024-1 = 68719476735
内存为 128G 时,该值为 128*1024*1024*1024-1 = 137438953471

kernel.shmall:该参数控制可以使用的共享内存的总页数。Linux共享内存页大小为4KB,共享内存段的大小都是共享内存页大小的整数倍。
当内存为 12G 时, kernel.shmall = 3145728
当内存为 16G 时, kernel.shmall = 4194304
当内次为 32G 时, kernel.shmall = 8388608
当内存为 64G 时, kernel.shmall = 16777216
当内存为 128G 时, kernel.shmall = 33554432

kernel.sem:
以kernel.sem = 250 32000 100 128为例:
       250是参数semmsl的值,表示一个信号量集合中能够包含的信号量最大数目。
       32000是参数semmns的值,表示系统内可允许的信号量最大数目。
       100是参数semopm的值,表示单个semopm()调用在一个信号量集合上可以执行的操作数量。
       128是参数semmni的值,表示系统信号量集合总数。

net.ipv4.ip_local_port_range:表示应用程序可使用的IPv4端口范围。
net.core.rmem_default:表示套接字接收缓冲区大小的缺省值。
net.core.rmem_max:表示套接字接收缓冲区大小的最大值。
net.core.wmem_default:表示套接字发送缓冲区大小的缺省值。
net.core.wmem_max:表示套接字发送缓冲区大小的最大值。
######################################################################################

(2) Execute the sysctl -p command to make the configuration file take effect

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

8. Modify user resource limits

(1) Modify the number of processes and the maximum number of sessions: add the following at the end of the configuration file /etc/security/limits.conf

[root@hisdg ~]# 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

(2) Set associated information: add the following content at the end of the file /etc/pam.d/login

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

.....

session required /lib64/security/pam_limits.so
session required pam_limits.so

3. Create users and directories and set environment variables

1. Create oracle users and groups

###################################################################################
groupadd oinstall                      # 创建组:oinstall
groupadd dba                           # 创建组:dba
useradd -g oinstall -G dba oracle      # 创建 oracle 用户
echo "oracle" | passwd --stdin oracle  #为 oracle 用户设置密码
###################################################################################

[root@hisdg ~]# groupadd oinstall                      # 创建组:oinstall
[root@hisdg ~]# groupadd dba                           # 创建组:dba
[root@hisdg ~]# useradd -g oinstall -G dba oracle      # 创建 oracle 用户
[root@hisdg ~]# echo "oracle" | passwd --stdin oracle  #为 oracle 用户设置密码
更改用户 oracle 的密码 。
passwd:所有的身份验证令牌已经成功更新。

2. Create an installation directory and authorize it

###################################################################################
# (1)创建目录
mkdir -p /u01/app/oracle /u01/app/oraInventory /u01/app/oradata/ 
# (2)更改所有者和所属的组
chown -R oracle:oinstall /u01/
# (3)授予操作权限
chmod -R 775 /u01/
# (4)查看目录的所有者及权限
ll /usr/local/

# 执行如下命令
[root@hisdg ~]# mkdir -p /u01/app/oracle /u01/app/oraInventory /u01/app/oradata/ 
[root@hisdg ~]# chown -R oracle:oinstall /u01/
[root@hisdg ~]# chmod -R 775 /u01/
[root@hisdg ~]# ll /u01/app/
总用量 0
drwxrwxr-x. 2 oracle oinstall  6 210 13:00 oracle
drwxrwxr-x. 2 oracle oinstall  6 210 13:00 oradata
drwxrwxr-x. 2 oracle oinstall  6 210 13:03 oraInventory

3. Set the environment variables of the oracle user

[root@hisdg app]# vi /home/oracle/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=hisdg
export ORACLE_OWNER=oracle
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
alias sqlplus='rlwrap sqlplus'
alias lsnrctl='rlwrap lsnrctl'
alias rman='rlwrap rman'

Make the environment variable take effect:

[root@hisdg app]# source /home/oracle/.bash_profile

4. Install readline-6.2 and rlwrap-0.37

(1) Install readline-6.2

# 安装编译工具 gcc:
[root@hisdg app]# yum install -y gcc

已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.bfsu.edu.cn
正在解决依赖关系
--> 正在检查事务
......
更新完毕:
  gcc.x86_64 0:4.8.5-44.el7                                                                                                     

作为依赖被升级:
  cpp.x86_64 0:4.8.5-44.el7             gcc-c++.x86_64 0:4.8.5-44.el7              gcc-gfortran.x86_64 0:4.8.5-44.el7         
  gcc-gnat.x86_64 0:4.8.5-44.el7        gcc-go.x86_64 0:4.8.5-44.el7               gcc-objc.x86_64 0:4.8.5-44.el7             
  gcc-objc++.x86_64 0:4.8.5-44.el7      gcc-plugin-devel.x86_64 0:4.8.5-44.el7     libgcc.x86_64 0:4.8.5-44.el7               
  libgfortran.x86_64 0:4.8.5-44.el7     libgnat.x86_64 0:4.8.5-44.el7              libgnat-devel.x86_64 0:4.8.5-44.el7        
  libgo.x86_64 0:4.8.5-44.el7           libgo-devel.x86_64 0:4.8.5-44.el7          libgomp.x86_64 0:4.8.5-44.el7              
  libobjc.x86_64 0:4.8.5-44.el7         libquadmath.x86_64 0:4.8.5-44.el7          libquadmath-devel.x86_64 0:4.8.5-44.el7    
  libstdc++.x86_64 0:4.8.5-44.el7       libstdc++-devel.x86_64 0:4.8.5-44.el7      libstdc++-static.x86_64 0:4.8.5-44.el7     

完毕!


# 上传软件
[root@hisdg soft]# pwd
/soft
[root@hisdg soft]# ll
总用量 2476
drwxr-xr-x. 2 root root     214 210 13:26 libtermcap-devel
-rw-r--r--. 1 root root 2277926 63 2021 readline-6.2.tar.gz
-rw-r--r--. 1 root root  251438 515 2019 rlwrap-0.37.tar.gz

# 解压缩
[root@hisdg soft]# tar zxvf readline-6.2.tar.gz

readline-6.2/
readline-6.2/doc/
readline-6.2/doc/Makefile.in
readline-6.2/doc/texinfo.tex
readline-6.2/doc/version.texi
.....

# 编译、安装软件
[root@hisdg soft]# cd readline-6.2

[root@hisdg readline-6.2]# ./configure && make && make install

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu

...........

readline.so.6.2install: you may need to run ldconfig
make[1]: 离开目录“/soft/readline-6.2/shlib”

(2) Install libtermcap-devel

# 查看 rpm 包
[root@hisdg libtermcap-devel]# pwd
/soft/libtermcap-devel
[root@hisdg libtermcap-devel]# ll
总用量 1408
-rw-r--r--. 1 root root 310928 97 2017 ncurses-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root  69900 97 2017 ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
-rw-r--r--. 1 root root 729508 97 2017 ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root 323192 97 2017 ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm


# 安装 rpm 包
[root@hisdg libtermcap-devel]# rpm -ivh --force --nodeps *.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:ncurses-base-5.9-14.20130511.el7_################################# [ 25%]
   2:ncurses-libs-5.9-14.20130511.el7_################################# [ 50%]
   3:ncurses-5.9-14.20130511.el7_4    ################################# [ 75%]
   4:ncurses-devel-5.9-14.20130511.el7################################# [100%]

(3) Install rlwrap-0.37

[root@hisdg soft]# ll
总用量 2484
drwxr-xr-x. 2 root root      214 210 13:26 libtermcap-devel
drwxrwxr-x. 6  286 wheel    4096 210 13:28 readline-6.2
-rw-r--r--. 1 root root  2277926 63 2021 readline-6.2.tar.gz
-rw-r--r--. 1 root root   251438 515 2019 rlwrap-0.37.tar.gz

# 解压缩软件 rlwrap-0.37
[root@hisdg soft]# tar zxvf rlwrap-0.37.tar.gz

rlwrap-0.37/
rlwrap-0.37/completions/
rlwrap-0.37/completions/testclient
rlwrap-0.37/completions/coqtop
rlwrap-0.37/doc/
....

[root@hisdg soft]# ll
总用量 2484
drwxr-xr-x. 2 root root      214 210 13:26 libtermcap-devel
drwxrwxr-x. 6  286 wheel    4096 210 13:28 readline-6.2
-rw-r--r--. 1 root root  2277926 63 2021 readline-6.2.tar.gz
drwxrwxr-x. 8  500   500    4096 55 2010 rlwrap-0.37
-rw-r--r--. 1 root root   251438 515 2019 rlwrap-0.37.tar.gz


# 编译、安装软件
[root@hisdg soft]# cd rlwrap-0.37
[root@hisdg rlwrap-0.37]# ./configure && make && make install

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c

........

make[3]: 进入目录“/soft/rlwrap-0.37”
chmod a+x /usr/local/share/rlwrap/filters/* 
make[3]: 离开目录“/soft/rlwrap-0.37”
make[2]: 离开目录“/soft/rlwrap-0.37”
make[1]: 离开目录“/soft/rlwrap-0.37”

Fourth, install the required dependencies

1. Upload the dependency packages required to install Oracle to the server

[root@hisdg pack]# pwd
/soft/pack
[root@hisdg pack]# ll
总用量 119612
-rw-r--r--. 1 root root   195388 314 2015 compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
-rw-r--r--. 1 root root  6236316 823 2019 cpp-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root    33596 44 2020 elfutils-default-yama-scope-0.176-4.el7.noarch.rpm
-rw-r--r--. 1 root root   199264 44 2020 elfutils-libelf-0.176-4.el7.x86_64.rpm
-rw-r--r--. 1 root root    40632 44 2020 elfutils-libelf-devel-0.176-4.el7.x86_64.rpm
-rw-r--r--. 1 root root    77868 44 2020 elfutils-libelf-devel-static-0.176-4.el7.x86_64.rpm
-rw-r--r--. 1 root root   297776 44 2020 elfutils-libs-0.176-4.el7.x86_64.rpm
-rw-r--r--. 1 root root 16966352 823 2019 gcc-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  7529552 823 2019 gcc-c++-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  6983372 823 2019 gcc-gfortran-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root 13559304 823 2019 gcc-gnat-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  6199712 823 2019 gcc-go-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  6026156 823 2019 gcc-objc-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  6447348 823 2019 gcc-objc++-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   847636 823 2019 gcc-plugin-devel-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  3815032 44 2020 glibc-2.17-307.el7.1.x86_64.rpm
-rw-r--r--. 1 root root 12057552 44 2020 glibc-common-2.17-307.el7.1.x86_64.rpm
-rw-r--r--. 1 root root  1126396 44 2020 glibc-devel-2.17-307.el7.1.x86_64.rpm
-rw-r--r--. 1 root root   705348 44 2020 glibc-headers-2.17-307.el7.1.x86_64.rpm
-rw-r--r--. 1 root root   287768 811 2017 gmp-6.0.0-15.el7.x86_64.rpm
-rw-r--r--. 1 root root   185500 811 2017 gmp-devel-6.0.0-15.el7.x86_64.rpm
-rw-r--r--. 1 root root  9389840 826 2020 kernel-headers-3.10.0-1127.19.1.el7.x86_64.rpm
-rw-r--r--. 1 root root    24744 625 2019 libaio-0.3.109-13.el7.x86_64.rpm
-rw-r--r--. 1 root root    13176 1125 2015 libaio-devel-0.3.109-13.el7.x86_64.rpm
-rw-r--r--. 1 root root   104736 823 2019 libgcc-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   307596 823 2019 libgfortran-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   989820 823 2019 libgnat-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  2821040 823 2019 libgnat-devel-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  2287136 823 2019 libgo-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   235848 823 2019 libgo-devel-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   161828 823 2019 libgomp-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root    51732 74 2014 libmpc-1.0.1-3.el7.x86_64.rpm
-rw-r--r--. 1 root root    32904 74 2014 libmpc-devel-1.0.1-3.el7.x86_64.rpm
-rw-r--r--. 1 root root    81836 823 2019 libobjc-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   194380 823 2019 libquadmath-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root    54228 823 2019 libquadmath-devel-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   312504 823 2019 libstdc++-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root  1580840 823 2019 libstdc++-devel-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root 11580600 823 2019 libstdc++-docs-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root   422504 823 2019 libstdc++-static-4.8.5-39.el7.x86_64.rpm
-rw-r--r--. 1 root root    50076 413 2017 libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
-rw-r--r--. 1 root root    42784 823 2019 lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64.rpm
-rw-r--r--. 1 root root   208316 74 2014 mpfr-3.1.1-4.el7.x86_64.rpm
-rw-r--r--. 1 root root    69904 74 2014 mpfr-devel-3.1.1-4.el7.x86_64.rpm
-rw-r--r--. 1 root root   210440 16 2019 pdksh-5.2.14-37.el7.centos.1.x86_64.rpm
-rw-r--r--. 1 root root   376916 16 2019 pdksh-debuginfo-5.2.14-37.el7.centos.1.x86_64.rpm
-rw-r--r--. 1 root root   323020 44 2020 sysstat-10.1.5-19.el7.x86_64.rpm
-rw-r--r--. 1 root root   423152 823 2019 unixODBC-2.3.1-14.el7.x86_64.rpm
-rw-r--r--. 1 root root    56144 823 2019 unixODBC-devel-2.3.1-14.el7.x86_64.rpm
-rw-r--r--. 1 root root    91960 1112 2018 zlib-1.2.7-18.el7.x86_64.rpm
-rw-r--r--. 1 root root    51128 1112 2018 zlib-devel-1.2.7-18.el7.x86_64.rpm

2. Install the required dependencies

[root@hisdg pack]# rpm -ivh --nodeps --force *.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:libgcc-4.8.5-39.el7              ################################# [  2%]
   2:glibc-common-2.17-307.el7.1      ################################# [  4%]
   3:glibc-2.17-307.el7.1             ################################# [  6%]
   4:zlib-1.2.7-18.el7                ################################# [  8%]
   5:libquadmath-4.8.5-39.el7         ################################# [ 10%]
   6:libstdc++-4.8.5-39.el7           ################################# [ 12%]
   7:gmp-1:6.0.0-15.el7               ################################# [ 14%]
   8:mpfr-3.1.1-4.el7                 ################################# [ 16%]
   9:libmpc-1.0.1-3.el7               ################################# [ 18%]
  10:gmp-devel-1:6.0.0-15.el7         ################################# [ 20%]
  11:mpfr-devel-3.1.1-4.el7           ################################# [ 22%]
  12:libstdc++-devel-4.8.5-39.el7     ################################# [ 24%]
  13:elfutils-libelf-0.176-4.el7      ################################# [ 25%]
  14:libgo-4.8.5-39.el7               ################################# [ 27%]
  15:libgo-devel-4.8.5-39.el7         ################################# [ 29%]
  16:libmpc-devel-1.0.1-3.el7         ################################# [ 31%]
  17:cpp-4.8.5-39.el7                 ################################# [ 33%]
  18:libgfortran-4.8.5-39.el7         ################################# [ 35%]
  19:zlib-devel-1.2.7-18.el7          ################################# [ 37%]
  20:elfutils-libelf-devel-0.176-4.el7################################# [ 39%]
  21:libaio-0.3.109-13.el7            ################################# [ 41%]
  22:libgnat-4.8.5-39.el7             ################################# [ 43%]
  23:libgomp-4.8.5-39.el7             ################################# [ 45%]
  24:libobjc-4.8.5-39.el7             ################################# [ 47%]
  25:libtool-ltdl-2.4.2-22.el7_3      ################################# [ 49%]
  26:unixODBC-2.3.1-14.el7            ################################# [ 51%]
  27:lm_sensors-libs-3.4.0-8.20160601g################################# [ 53%]
  28:libgnat-devel-4.8.5-39.el7       ################################# [ 55%]
  29:kernel-headers-3.10.0-1127.19.1.e################################# [ 57%]
  30:glibc-headers-2.17-307.el7.1     ################################# [ 59%]
  31:glibc-devel-2.17-307.el7.1       ################################# [ 61%]
  32:gcc-4.8.5-39.el7                 ################################# [ 63%]
  33:gcc-c++-4.8.5-39.el7             ################################# [ 65%]
  34:gcc-objc-4.8.5-39.el7            ################################# [ 67%]
  35:libquadmath-devel-4.8.5-39.el7   ################################# [ 69%]
  36:elfutils-default-yama-scope-0.176################################# [ 71%]
  37:elfutils-libs-0.176-4.el7        ################################# [ 73%]
  38:gcc-gfortran-4.8.5-39.el7        ################################# [ 75%]
  39:gcc-objc++-4.8.5-39.el7          ################################# [ 76%]
  40:gcc-gnat-4.8.5-39.el7            ################################# [ 78%]
  41:gcc-go-4.8.5-39.el7              ################################# [ 80%]
  42:gcc-plugin-devel-4.8.5-39.el7    ################################# [ 82%]
  43:sysstat-10.1.5-19.el7            ################################# [ 84%]
  44:unixODBC-devel-2.3.1-14.el7      ################################# [ 86%]
  45:libaio-devel-0.3.109-13.el7      ################################# [ 88%]
  46:elfutils-libelf-devel-static-0.17################################# [ 90%]
  47:libstdc++-static-4.8.5-39.el7    ################################# [ 92%]
  48:compat-libstdc++-33-3.2.3-72.el7 ################################# [ 94%]
  49:pdksh-5.2.14-37.el7.centos.1     ################################# [ 96%]
  50:pdksh-debuginfo-5.2.14-37.el7.cen################################# [ 98%]
  51:libstdc++-docs-4.8.5-39.el7      ################################# [100%]

5. Oracle software installation and configuration

1. Upload and unzip the Oracle installation file

(1) Upload the installation file to the server

Switch to the oracle user and upload the installation file to the /home/oracle directory:

[oracle@hisdg ~]$ pwd
/home/oracle
[oracle@hisdg ~]$ ll
总用量 2487200
-rw-r--r--. 1 oracle oinstall 1395582860 17 2020 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 oracle oinstall 1151304589 17 2020 p13390677_112040_Linux-x86-64_2of7.zip

(2) Unzip the installation file

# 解压缩安装文件
[oracle@hisdg ~]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@hisdg ~]$ unzip p13390677_112040_Linux-x86-64_2of7.zip

# 查看目录所有者及权限
[oracle@hisdg ~]$ ll
总用量 2487200
drwxr-xr-x. 7 oracle oinstall        136 827 2013 database
-rw-r--r--. 1 oracle oinstall 1395582860 17 2020 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 oracle oinstall 1151304589 17 2020 p13390677_112040_Linux-x86-64_2of7.zip

2. Modify the oracle response template file - db_install.rsp

(1) View the answer file

The file is stored in the decompressed installation package by default, under the /home/oracle/database/response directory.

[oracle@hisdg response]$ pwd
/home/oracle/database/response
[oracle@hisdg response]$ ll
总用量 80
-rwxr-xr-x. 1 oracle oinstall 44533 827 2013 dbca.rsp
-rw-r--r--. 1 oracle oinstall 25116 827 2013 db_install.rsp
-rwxr-xr-x. 1 oracle oinstall  5871 827 2013 netca.rsp

(2) Modify the answer file

# 把应答模板文件db_install.rsp复制到/home/oracle/目录下
[oracle@hisdg response]$ cp db_install.rsp /home/oracle/
[oracle@hisdg response]$ cd /home/oracle
[oracle@hisdg ~]$ ll
总用量 2487228
drwxr-xr-x. 7 oracle oinstall        136 827 2013 database
-rw-r--r--. 1 oracle oinstall      25116 210 14:10 db_install.rsp
-rw-r--r--. 1 oracle oinstall 1395582860 17 2020 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 oracle oinstall 1151304589 17 2020 p13390677_112040_Linux-x86-64_2of7.zip

# 修改应答文件的内容如下:
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=hisdg
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=  #不创建数据库,不用设置
oracle.install.db.config.starterdb.SID=           #不创建数据库,不用设置
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryLimit=81920
oracle.install.db.config.starterdb.password.ALL=oracle
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false            
DECLINE_SECURITY_UPDATES=true

3. Install oracle silently according to the answer file

(1) Switch to the oracle user and execute the /home/oracle/soft/database/runInstaller file

[oracle@hisdg database]$ pwd
/home/oracle/database
[oracle@hisdg database]$ ll
总用量 44
drwxr-xr-x.  4 oracle oinstall   248 827 2013 install
-rw-r--r--.  1 oracle oinstall 30016 827 2013 readme.html
drwxr-xr-x.  2 oracle oinstall    61 210 14:13 response
drwxr-xr-x.  2 oracle oinstall    34 827 2013 rpm
-rwxr-xr-x.  1 oracle oinstall  3267 827 2013 runInstaller
drwxr-xr-x.  2 oracle oinstall    29 827 2013 sshsetup
drwxr-xr-x. 14 oracle oinstall  4096 827 2013 stage
-rw-r--r--.  1 oracle oinstall   500 827 2013 welcome.html


[oracle@hisdg database]$ ./runInstaller  -silent -responseFile /home/oracle/db_install.rsp -ignorePrereq
正在启动 Oracle Universal Installer...

检查临时空间: 必须大于 120 MB。   实际为 18278 MB    通过
检查交换空间: 必须大于 150 MB。   实际为 4495 MB    通过
准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2023-02-10_02-19-50PM. 请稍候...[oracle@hisdg database]$ 可以在以下
位置找到本次安装会话的日志: /u01/app/oraInventory/logs/installActions2023-02-10_02-19-50PM.log
Oracle Database 11g 的 安装 已成功。
请查看 '/u01/app/oraInventory/logs/silentInstall2023-02-10_02-19-50PM.log' 以获取详细资料。

以 root 用户的身份执行以下脚本:
	1. /u01/app/oraInventory/orainstRoot.sh
	2. /u01/app/oracle/product/11.2.0/db_1/root.sh


Successfully Setup Software.

(2) During installation, you can use the following command to view the installation log information

[oracle@hisdg ~]$ tail -f /u01/app/oraInventory/logs/installActions2023-02-10_02-19-50PM.log
信息: 正在安装
信息: 将文件提取到 '/u01/app/oracle/product/11.2.0/db_1'
信息: 将文件提取到 '/u01/app/oracle/product/11.2.0/db_1'
信息: 根据文件 'oracle.server_EE_exp_1.xml' 中的信息执行快速复制操作。
信息: 根据文件 'racfiles.jar' 中的信息执行快速复制操作。
信息: 根据文件 'oracle.server_EE_dirs.lst' 中的信息执行快速复制操作。
信息: 根据文件 'oracle.server_EE_filemap.jar' 中的信息执行快速复制操作。
信息: 根据文件 'oracle.server_EE_1.xml' 中的信息执行快速复制操作。
信息: 根据文件 'setperms1.sh' 中的信息执行快速复制操作。
信息: Number of threads for fast copy :1
.......

(3) Open another terminal, switch to the root user, and execute orainstRoot.sh and root.sh scripts

# 切换为root用户
[oracle@hisdg ~]$ su - root
密码:
上一次登录:五 210 14:11:33 CST 2023192.168.1.8pts/1 上

# 执行脚本:orainstRoot.sh
[root@hisdg ~]# /u01/app/oraInventory/orainstRoot.sh
更改权限/u01/app/oraInventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。

更改组名/u01/app/oraInventory 到 oinstall.
脚本的执行已完成。

# 执行脚本:root.sh
[root@hisdg ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh
Check /u01/app/oracle/product/11.2.0/db_1/install/root_hisdg_2023-02-10_14-35-46.log for the output of root script

4. Configure monitoring

(1) Run the netca script to generate sqlnet.ora and listener.ora files

The generated files are located in the $ORACLE_HOME/network/admin directory:

[oracle@hisdg database]$ netca -silent -responsefile /home/oracle/database/response/netca.rsp

正在对命令行参数进行语法分析:
参数"silent" = true
参数"responsefile" = /home/oracle/database/response/netca.rsp
完成对命令行参数进行语法分析。
Oracle Net Services 配置:
完成概要文件配置。
Oracle Net 监听程序启动:
    正在运行监听程序控制: 
      /u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
    监听程序控制完成。
    监听程序已成功启动。
监听程序配置完成。
成功完成 Oracle Net Services 配置。退出代码是0


[oracle@hisdg database]$ cd $ORACLE_HOME/network/admin
[oracle@hisdg admin]$ 
[oracle@hisdg admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/network/admin
[oracle@hisdg admin]$ ll
总用量 12
-rw-r--r--. 1 oracle oinstall 366 210 14:48 listener.ora
drwxr-xr-x. 2 oracle oinstall  64 210 14:22 samples
-rw-r--r--. 1 oracle oinstall 381 1217 2012 shrept.lst
-rw-r--r--. 1 oracle oinstall 219 210 14:48 sqlnet.ora

(2) Start monitoring

[oracle@hisdg admin]$ lsnrctl start LISTENER

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-FEB-2023 14:49:22

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started

(3) Check the monitoring status

[oracle@hisdg admin]$ netstat -tlnp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::1521                 :::*                    LISTEN      22518/tnslsnr       
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 ::1:25                  :::*                    LISTEN      -        



[oracle@hisdg admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-FEB-2023 14:50:09

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                10-FEB-2023 14:48:04
Uptime                    0 days 0 hr. 2 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/hisdg/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hisdg)(PORT=1521)))
The listener supports no services
The command completed successfully

Guess you like

Origin blog.csdn.net/weixin_44377973/article/details/128970167