Oracle12c安装
安装前介质准备
软件 | 版本 | 安装包 |
---|---|---|
Centos | 7.6 | CentOS-7-x86_64-DVD-1810.iso |
Oracle12c | 12.2.0.1 | linuxx64_12201_database.zip |
Rlwrap | 0.37 | rlwrap-0.37-1.el6.x86_64.rpm |
一、关闭防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
或者单独开启端口:
firewall-cmd --zone=public --add-port=15021/tcp --permanent
firewall-cmd --reload
firewall-cmd --query-port=15021/tcp
firewall-cmd --list-port
二、关闭selinx
临时关闭:
setenforce 0
永久关闭(需要重启机器):
vi /etc/selinux/config
SELINUX=disabled
查看:
getenforce
命令关闭:
[root@server1 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@server1 ~]# setenforce 0
三、配置yum
[root@server1 ~]# mkdir /opt/yum
[root@server1 ~]# cp -r /run/media/admin/CentOS\ 7\ x86_64/* /opt/yum
[root@server1 ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///opt/yum
gpgcheck=0
enabled=1
或者:
cat << EOF > /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///opt/yum
gpgcheck=0
enabled=1
EOF
[root@server1 ~]# yum list
或者挂载iso文件:
[root@server1 ~]# mkdir /opt/yum
[root@server1 ~]# mount -o loop Oracle_Linux7.6_V980739-01.iso /mnt
[root@server1 ~]# cp -r /mnt/* /opt/yum
四、禁用透明页
Transparent HugePages memory differs from standard HugePages memory because
the kernel khugepaged thread allocates memory dynamically during runtime. Standard
HugePages memory is pre-allocated at startup, and does not change during runtime.
Transparent HugePages memory is enabled by default with Oracle Linux 6 and later,
Red Hat Enterprise Linux 6 and later, SUSE 11 and later, kernels.
To check if Transparent HugePages is enabled, run one of the following commands as
the root user:
方法一:
Red Hat Enterprise Linux kernels:
# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
Other kernels:
# cat /sys/kernel/mm/transparent_hugepage/enabled
The following is a sample output that shows Transparent HugePages are being used
as the [always] flag is enabled.
[always] never
方法二:
[root@server1 ~]# grep AnonHugePages /proc/meminfo
AnonHugePages: 14336 kB
如果 AnonHugePages > 0 同样表示启用了透明大页
note:If Transparent HugePages is removed from the kernel, then neither /sys/
kernel/mm/transparent_hugepage nor /sys/kernel/mm/
redhat_transparent_hugepage files exist.
To disable Transparent HugePages:
1. For Oracle Linux 7 and Red Hat Enterprise Linux 7, add or modify the
transparent_hugepage=never parameter in the /etc/default/grub file:
transparent_hugepage=never
For example:
vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet numa=off transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
2. Run the grub2–mkconfig command to regenerate the grub.cfg file.
# grub2-mkconfig -o /boot/grub2/grub.cfg
3. Restart the system to make the changes permanent
4.Verify
[root@server1 ~]# more /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@server1 ~]# grep AnonHugePages /proc/meminfo
AnonHugePages: 0 kB
如果报以下错误,可能是/boot空间不足:
[root@localhost GPU]# init 3
Broadcast message from systemd-journald@localhost.localdomain (Wed 2017-09-20 11:26:40 CST):
dracut[11820]: dracut: creation of /boot/initramfs-3.10.0-693.2.2.el7.x86_64kdump.img failed
Message from syslogd@localhost at Sep 20 11:26:40 ...
dracut:dracut: creation of /boot/initramfs-3.10.0-693.2.2.el7.x86_64kdump.img failed
[root@localhost boot]# df /boot
[root@localhost boot]# rpm -qa|grep kernel
卸载老版本内核:
[root@localhost boot]# rpm -e kernel-3.10.0-514.el7.x86_64 kernel-3.10.0-514.26.2.el7.x86_64
[root@localhost boot]# yum remove kernel-3.10.0-957.el7.x86_64
五、磁盘调度
For best performance for Oracle ASM, Oracle recommends that you use the Deadline
I/O Scheduler.
Disk I/O schedulers reorder, delay, or merge requests for disk I/O to achieve better
throughput and lower latency. Linux has multiple disk I/O schedulers available,
including Deadline, Noop, Anticipatory, and Completely Fair Queuing (CFQ).
On each cluster node, enter the following command to verify that the Deadline disk I/O
scheduler is configured for use:
# cat /sys/block/${ASM_DISK}/queue/scheduler
noop [deadline] cfq
In this example, the default disk I/O scheduler is Deadline and ASM_DISK is the Oracle
Automatic Storage Management (Oracle ASM) disk device.
On some virtual environments (VM) and special devices such as fast storage devices,
the output of the above command may be none. The operating system or VM
bypasses the kernel I/O scheduling and submits all I/O requests directly to the device.
Do not change the I/O Scheduler settings on such environments.
If the default disk I/O scheduler is not Deadline, then set it using a rules file:
1. Using a text editor, create a UDEV rules file for the Oracle ASM devices:
# vi /etc/udev/rules.d/60-oracle-schedulers.rules
2. Add the following line to the rules file and save it:
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0",
ATTR{queue/scheduler}="deadline"
3. On clustered systems, copy the rules file to all other nodes on the cluster. For
example:
$ scp 60-oracle-schedulers.rules root@node2:/etc/udev/rules.d/
4. Load the rules file and restart the UDEV service. For example:
a. Oracle Linux and Red Hat Enterprise Linux
# udevadm control --reload-rules
b. SUSE Linux Enterprise Server
# /etc/init.d boot.udev restart
5. Verify that the disk I/O scheduler is set as Deadline.
六、配置SSH
In rare cases, Oracle Clusterware installation can fail during the "AttachHome"
operation when the remote node closes the SSH connection. To avoid this problem,
set the timeout wait to unlimited by setting the following parameter in the SSH daemon
configuration file /etc/ssh/sshd_config on all cluster nodes:
LoginGraceTime 0
#vi /etc/ssh/sshd_config
LoginGraceTime 0
七、安装操作系统依赖包
- preinstall rpm包安装方法
1. Obtain Oracle Linux either by ordering the Oracle Linux media pack from Oracle
Store, or by downloading disk images from the Oracle Software Delivery Cloud
website for Oracle Linux and Oracle VM.
• Oracle Store
https://shop.oracle.com
• Oracle Software Delivery Cloud website:
https://edelivery.oracle.com/linux
2. Start the Oracle Linux installation and respond to installation screens with values
appropriate for your environment.
3. Review the first software selection screen, which lists task-specific software
options. At the bottom of the screen, there is an option to customize now or
customize later. Select Customize now, and click Next.
4. On Oracle Linux, select Servers on the left of the screen and System
administration tools on the right of the screen (options may vary between
releases).
The Packages in System Tools window opens.
5. Select the Oracle Preinstallation RPM package box from the package list. For
example, for Oracle Linux 7, select a package similar to the following:
oracle-database-server-12cR2-preinstall-1.0-4.el7.x86_64.rpm
If you do not have an Oracle Preinstallation RPM package option that is current for
your Oracle Database release, because you are using an Oracle Linux installation
that is previous to your Oracle Database and Oracle Grid Infrastructure release,
then install the RPM for your release manually after completing the operating
system installation.
6. Close the optional package window and click Next.
7. Complete the other screens to finish the Oracle Linux installation.
Oracle Linux automatically creates a standard (not role-allocated) Oracle
installation owner and groups, and sets up other kernel configuration settings as
required for Oracle installations.
8. Repeat steps 2 through 6 on all other cluster member nodes.
yum install oracle-database-server-12cR2-preinstall
- 手动安装方法
Oracle Linux 7:
bc
binutils-2.23.52.0.1-12.el7 (x86_64)
compat-libcap1-1.10-3.el7 (x86_64)
compat-libstdc++-33-3.2.3-71.el7 (i686)
compat-libstdc++-33-3.2.3-71.el7 (x86_64)
glibc-2.17-36.el7 (i686)
glibc-2.17-36.el7 (x86_64)
glibc-devel-2.17-36.el7 (i686)
glibc-devel-2.17-36.el7 (x86_64)
ksh
libaio-0.3.109-9.el7 (i686)
libaio-0.3.109-9.el7 (x86_64)
libaio-devel-0.3.109-9.el7 (i686)
libaio-devel-0.3.109-9.el7 (x86_64)
libX11-1.6.0-2.1.el7 (i686)
libX11-1.6.0-2.1.el7 (x86_64)
libXau-1.0.8-2.1.el7 (i686)
libXau-1.0.8-2.1.el7 (x86_64)
libXi-1.7.2-1.el7 (i686)
libXi-1.7.2-1.el7 (x86_64)
libXtst-1.2.2-1.el7 (i686)
libXtst-1.2.2-1.el7 (x86_64)
libXrender (i686)
libXrender (x86_64)
libXrender-devel (i686)
libXrender-devel (x86_64)
libgcc-4.8.2-3.el7 (i686)
libgcc-4.8.2-3.el7 (x86_64)
libstdc++-4.8.2-3.el7 (i686)
libstdc++-4.8.2-3.el7 (x86_64)
libstdc++-devel-4.8.2-3.el7 (i686)
libstdc++-devel-4.8.2-3.el7 (x86_64)
libxcb-1.9-5.el7 (i686)
libxcb-1.9-5.el7 (x86_64)
make-3.82-19.el7 (x86_64)
nfs-utils-1.3.0-0.21.el7.x86_64 (for Oracle ACFS)
net-tools-2.0-0.17.20131004git.el7 (x86_64) (for Oracle RAC
and Oracle Clusterware)
smartmontools-6.2-4.el7 (x86_64)
sysstat-10.1.5-1.el7 (x86_64)
Oracle Linux 6:
bc
binutils-2.20.51.0.2-5.36.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
e2fsprogs-1.41.12-14.el6 (x86_64)
e2fsprogs-libs-1.41.12-14.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.5.0-4.el6 (i686)
libX11-1.5.0-4.el6 (x86_64)
libXau-1.0.6-4.el6 (i686)
libXau-1.0.6-4.el6 (x86_64)
libxcb-1.8.1-1.el6 (i686)
libxcb-1.8.1-1.el6 (x86_64)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
libXrender (i686)
libXrender (x86_64)
libXrender-devel (i686)
libXrender-devel (x86_64)
make-3.81-19.el6
net-tools-1.60-110.el6_2.x86_64 (for Oracle RAC and Oracle
Clusterware)
nfs-utils-1.2.3-15.0.1 (for Oracle ACFS)
sysstat-9.0.4-11.el6 (x86_64)
smartmontools-5.43-1.el6.x86_64
RedHat Linux 7:
bc
binutils-2.23.52.0.1-12.el7 (x86_64)
compat-libcap1-1.10-3.el7 (x86_64)
compat-libstdc++-33-3.2.3-71.el7 (i686)
compat-libstdc++-33-3.2.3-71.el7 (x86_64)
glibc-2.17-36.el7 (i686)
glibc-2.17-36.el7 (x86_64)
glibc-devel-2.17-36.el7 (i686)
glibc-devel-2.17-36.el7 (x86_64)
ksh
libaio-0.3.109-9.el7 (i686)
libaio-0.3.109-9.el7 (x86_64)
libaio-devel-0.3.109-9.el7 (i686)
libaio-devel-0.3.109-9.el7 (x86_64)
libgcc-4.8.2-3.el7 (i686)
libgcc-4.8.2-3.el7 (x86_64)
libstdc++-4.8.2-3.el7 (i686)
libstdc++-4.8.2-3.el7 (x86_64)
libstdc++-devel-4.8.2-3.el7 (i686)
libstdc++-devel-4.8.2-3.el7 (x86_64)
libxcb-1.9-5.el7 (i686)
libxcb-1.9-5.el7 (x86_64)
libX11-1.6.0-2.1.el7 (i686)
libX11-1.6.0-2.1.el7 (x86_64)
libXau-1.0.8-2.1.el7 (i686)
libXau-1.0.8-2.1.el7 (x86_64)
libXi-1.7.2-1.el7 (i686)
libXi-1.7.2-1.el7 (x86_64)
libXtst-1.2.2-1.el7 (i686)
libXtst-1.2.2-1.el7 (x86_64)
libXrender (i686)
libXrender (x86_64)
libXrender-devel (i686)
libXrender-devel (x86_64)
make-3.82-19.el7 (x86_64)
net-tools-2.0-0.17.20131004git.el7 (x86_64) (for Oracle RAC
and Oracle Clusterware)
nfs-utils-1.3.0-0.21.el7.x86_64 (for Oracle ACFS)
smartmontools-6.2-4.el7 (x86_64)
sysstat-10.1.5-1.el7 (x86_64)
RedHat Linux 6:
bc
binutils-2.20.51.0.2-5.36.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
e2fsprogs-1.41.12-14.el6 (x86_64)
e2fsprogs-libs-1.41.12-14.el6 (x86_64)
glibc-2.12-1.107.el6 (i686)
glibc-2.12-1.107.el6 (x86_64)
glibc-devel-2.12-1.107.el6 (i686)
glibc-devel-2.12-1.107.el6 (x86_64)
ksh
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libX11-1.5.0-4.el6 (i686)
libX11-1.5.0-4.el6 (x86_64)
libXau-1.0.6-4.el6 (i686)
libXau-1.0.6-4.el6 (x86_64)
libXi-1.6.1-3.el6 (i686)
libXi-1.6.1-3.el6 (x86_64)
libXtst-1.2.1-2.el6 (i686)
libXtst-1.2.1-2.el6 (x86_64)
libgcc-4.4.7-3.el6 (i686)
libgcc-4.4.7-3.el6 (x86_64)
libstdc++-4.4.7-3.el6 (i686)
libstdc++-4.4.7-3.el6 (x86_64)
libstdc++-devel-4.4.7-3.el6 (i686)
libstdc++-devel-4.4.7-3.el6 (x86_64)
libxcb-1.8.1-1.el6 (i686)
libxcb-1.8.1-1.el6 (x86_64)
libXrender (i686)
libXrender (x86_64)
libXrender-devel (i686)
libXrender-devel (x86_64)
make-3.81-20.el6 (x86_64)
net-tools-1.60-110.el6_2 (x86_64) (for Oracle RAC and Oracle
Clusterware)
nfs-utils-1.2.3-36.el6 (x86_64) (for Oracle ACFS)
smartmontools-5.43-1.el6 (x86_64)
sysstat-9.0.4-20.el6 (x86_64)
SUSE Linux Enterprise Server 15:
binutils-2.31-6.3.1.x86_64
gcc-7-1.563.x86_64
glibc-2.26-13.8.1.x86_64
glibc-32bit-2.26-13.8.1.x86_64
glibc-devel-2.26-13.8.1.x86_64
libaio-devel-0.3.109-1.25.x86_64
libaio1-0.3.109-1.25.x86_64
libcap1-1.97-1.15.x86_64
libstdc++6-devel-gcc7-7.4.0+r266845-4.3.4.x86_64
libstdc++6-8.2.1+r264010-1.3.7.x86_64
libgcc_s1-8.2.1+r264010-1.3.7.x86_64
libgcc_s1-32bit-8.2.1+r264010-1.3.7.x86_64
make-4.2.1-7.3.2.x86_64
mksh-56c-1.10.x86_64
sysstat-12.0.2-3.3.1.x86_64
xorg-x11-fonts-core-7.6-3.9.noarch
xorg-x11-server-extra-1.19.6-8.6.1.x86_64
xorg-x11-Xvnc-1.8.0-13.8.5.x86_64
xorg-x11-server-1.19.6-8.6.1.x86_64
xorg-x11-libs-7.6.1-1.16.noarch
xorg-x11-essentials-7.6_1-1.22.noarch
xorg-x11-fonts-7.6-3.9.noarch
xorg-x11-7.6_1-1.22.noarch
xorg-x11-driver-video-7.6_1-2.30.x86_64
SUSE Linux Enterprise Server 12:
Centos7.6安装包:
[root@server1 ~]# yum install bc binutils compat-libcap1 compat-libstdc++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make gcc gcc-c++ smartmontools sysstat
查询依赖包:
[root@server1 ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \
bc \
binutils \
compat-libcap1 \
compat-libstdc++ \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ libstdc++-devel \
libxcb libX11 \
libXau \
libXi \
libXtst \
libXrender \
libXrender-devel \
make gcc gcc-c++ smartmontools sysstat |grep 'not installed'
解决compat-libstdc++没有安装的问题:
package compat-libstdc++ is not installed
[root@server1 ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' compat-libstdc++-33
[root@server1 ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
[root@server1 ~]# yum install compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
八、创建用户组和Oracle安装目录
如果没有使用到ASM,则不需要创建asmdba,asmoper
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
创建组:
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54330 racdba
创建用户:
# /usr/sbin/useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle
修改用户属主:
# /usr/sbin/usermod -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba[,oper] oracle
九、创建目录
mkdir -p /opt/oracle12c/product/12.2.0/db_1
chown -R oracle.oinstall /opt/oracle12c
chmod -R 755 /opt/oracle12c
十、配置Oracle环境变量
[root@server1 ~]# su - oracle
[oracle@server1 ~]$ vi .bash_profile
export TEMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/opt/oracle12c
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
umask 022
[root@server1 ~]# source .bash_profile
如果不是全新安装,则需要unset环境变量:
unset ORACLE_BASE
unset ORACLE_HOME
unset ORACLE_SID
unset ORA_CRS_HOME
unset ORA_NLS10
unset TNS_ADMIN
移除环境变量PATH中$ORACLE_HOME/bin
十一、配置资源限制
[root@server1 ~]# vi /etc/security/limits.conf
注意: centos7.6添加路径为/etc/security/limits.d/,级别优先/etc/security/
[root@server1 ~]# vi /etc/security/limits.d/20-nproc.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
oracle soft memlock (使用HugePage:90%Mem,单位KB.不使用HuagePages:3145728 (3G),maximum of 128GB on x86_64 or 3GB on x86 OR 90 % of RAM)
oracle hard memlock (使用HugePage:90%Mem,单位KB.不使用HuagePages:3145728 (3G),maximum of 128GB on x86_64 or 3GB on x86 OR 90 % of RAM)
要使 limits.conf 文件配置生效,必须要确保 pam_limits.so 文件被加入到启动文件中(Oracle19c没有要求):
[root@server1 ~]# locate pam_limits.so
/usr/lib64/security/pam_limits.so
[root@server1 ~]# vi /etc/pam.d/login
session required pam_limits.so
1. Log in as an installation owner.
2. Check the soft and hard limits for the file descriptor setting. Ensure that the result
is in the recommended range. For example:
[root@server1 ~]# su - oracle
[oracle@server1 ~]$ ulimit -Sn
1024
[oracle@server1 ~]$ ulimit -Hn
65536
3. Check the soft and hard limits for the number of processes available to a user.
Ensure that the result is in the recommended range. For example:
[oracle@server1 ~]$ ulimit -Su
2047
[oracle@server1 ~]$ ulimit -Hu
16384
4. Check the soft limit for the stack setting. Ensure that the result is in the
recommended range. For example:
[oracle@server1 ~]$ ulimit -Ss
10240
[oracle@server1 ~]$ ulimit -Hs
32768
提高用户shell限制(不做此步):
/etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
十二、配置内核参数
[root@server1 ~]# vi /etc/sysctl.d/97-oracle-database-sysctl.conf
net.ipv4.neigh.default.base_reachable_time_ms = 600000
net.ipv4.neigh.default.mcast_solicit = 20
net.ipv4.neigh.default.retrans_time_ms = 250
net.ipv4.conf.eth0.rp_filter=0
net.ipv4.conf.eth1.rp_filter=0
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
net.ipv4.tcp_fastopen=3
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
执行以下命令使用内核生效:
[root@server1 ~]# /sbin/sysctl --system
[root@server1 ~]# /sbin/sysctl -a
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
十三、针对隐藏文件配置错误输出
如果安装RAC或Grid需要配置:
During an Oracle Grid Infrastructure installation, OUI uses SSH to run commands and
copy files to the other nodes. During the installation, hidden files on the system (for
example, .bashrc or .cshrc) can cause makefile and other installation errors if they
contain terminal output commands.
To avoid this problem, you must modify hidden files in each Oracle installation owner
user home directory to suppress all output on STDOUT or STDERR (for example, stty,
xtitle, and other such commands) as in the following examples:
Bourne, Bash, or Korn shell:
if [ -t 0 ]; then
stty intr ^C
fi
C shell:
test -t 0
if ($status == 0) then
stty intr ^C
endif
note:If the remote shell can load hidden files that contain stty commands, then
OUI indicates an error and stops the installation.
[oracle@server1 ~]$ vi .bash_profile
if [ -t 0 ]; then
stty intr ^C
fi
[oracle@server1 ~]$ source .bash_profile
十四、安装Oracle12c
[root@server1 soft]# unzip linuxx64_12201_database.zip
[root@server1 soft]# chown -R oracle.oinstall database/
[root@server1 soft]# chmod -R 755 database/
[root@server1 soft]# su - oracle
[oracle@server1 ~]$ cd /opt/soft/database/
[oracle@server1 database]$ export DISPLAY=192.168.1.27:0.0
[oracle@server1 database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 36867 MB Passed
Checking swap space: must be greater than 150 MB. Actual 8191 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-03-29_07-03-48PM. Please wait ...
root用户执行如下脚本:
/home/oracle/oraInventory/orainstRoot.sh
/opt/oracle12c/product/12.2.0/db_1/root.sh
[root@server1 ~]# /home/oracle/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /home/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@server1 ~]# /opt/oracle12c/product/12.2.0/db_1/root.sh
Performing root user operation.
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle12c/product/12.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
no
Oracle Trace File Analyzer (TFA - User Mode) is available at :
/opt/oracle12c/product/12.2.0/db_1/suptools/tfa/release/tfa_home/bin/tfactl
OR
Oracle Trace File Analyzer (TFA - Daemon Mode) can be installed by running this script :
/opt/oracle12c/product/12.2.0/db_1/suptools/tfa/release/tfa_home/install/roottfa.sh
十五、DBCA建库
[oracle@server1 database]$ dbca
十六、Listener及tnsnames
- 配置Listener
[oracle@server1 ~]$ cd $ORACLE_HOME/network/admin/
[oracle@server1 admin]$ vi listener.ora
SID_LIST_ORCL =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(SID_NAME = orcl)
(ORACLE_HOME = /opt/oracle12c/product/12.2.0/db_1)
)
(SID_DESC =
(GLOBAL_DBNAME = TESTDB)
(SID_NAME = orcl)
(ORACLE_HOME = /opt/oracle12c/product/12.2.0/db_1)
)
)
ORCL =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.165)(PORT = 15021))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC15021))
)
)
[oracle@server1 admin]$ lsnrctl start ORCL
SID_NAME 值区分大小写,如果改成大写将无法连接,可查看当前环境变量$ORACLE_SID值。
- 配置tnsnames
[oracle@server1 admin]$ vi tnsnames.ora
TESTDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.165)(PORT = 15021))
)
(CONNECT_DATA =
(SERVICE_NAME = testdb)
)
)
ORCL_CDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.165)(PORT = 15021))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
十七、查看数据库
[oracle@server1 database]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Jun 16 20:34:03 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TESTDB READ WRITE NO
[oracle@server1 admin]$ sqlplus sys@testdb as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 17 09:30:40 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
[oracle@server1 admin]$ sqlplus sys@orcl_cdb as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 17 09:31:11 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TESTDB READ WRITE NO
十八、安装rlwrap
[root@server1 ~]# rpm -ivh rlwrap-0.37-1.el6.x86_64.rpm
[oracle@server1 ~]$ vi .bashrc
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
[oracle@server1 ~]$ source .bashrc