14

centos系统oracle 19c安装教程

 2 years ago
source link: http://www.koogg.com/2021/09/25/centos%e5%ae%89%e8%a3%85oracle-19c%e6%95%99%e7%a8%8b/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用的客户端为 Mobaxterm ,此客户端自带支持X11,这样可以使用图形化界面安装,必须也在服务器安装一个组件,安装组件前:

这里默认是不支持的,

#yum install xorg-x11-apps xorg-x11-xauth
#clock

弹出时钟以后,可继续下一步操作。

系统环境的初级准备

  • 关闭防火墙

关闭运行的防火墙

#systemctl stop firewalld.service

关闭防火墙的自启动

#systemctl disable firewalld.service

  • 关闭Selinux

#vi /etc/selinux/config

  • 关闭NUMA

查看default 的grub 的entry

#grubby --default-kernel

查看default grub的具体信息

#grubby --info /boot/vmlinuz-3.10.0-957.el7.x86_64

更新args,添加numa=off的参数

#grubby --args=numa=off --update-kernel /boot/vmlinuz-3.10.0-957.el7.x86_64

重启服务器应用设置

#reboot

  • 修改hosts文件

查看当前主机名和IP地址

#hostname

#ifconfig

修改hosts文件添加以下内容

#vi /etc/hosts

192.168.0.34 ecs-c9b1-1029725

  • 安装依赖包

#yum install bc binutils  compat-libcap1  compat-libstdc++33 compat-libstdc++-33  elfutils-libelf  elfutils-libelf-devel  fontconfig-devel  glibc  glibc-devel  ksh  libaio  libaio-devel  libX11  libXau  libXi  libXtst  libXrender  libXrender-devel  libgcc  libstdc++  libstdc++-devel  libxcb  make  smartmontools  sysstat  kmod*

创建oracle用户

#groupadd oinstall

#groupadd  dba

#useradd -g oinstall -G dba oracle

修改oracle用户密码

#passwd oracle

设置系统参数

1、修改 /etc/sysctl.conf

具体设置理由请参考google,给个设置建议值:

  1. kernel.shmmax :

内存为 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

  1. kernel.shmall :

等于kernel.shmmax/4096

当内存为 12G 时, kernel.shmall = 3145728

当内存为 16G 时, kernel.shmall = 4194304

当内存为 32G 时, kernel.shmall = 8388608

当内存为 64G 时, kernel.shmall = 16777216

当内存为 128G 时, kernel.shmall = 33554432

# vi /etc/sysctl.conf

kernel.shmall = 34359738367

kernel.shmmax = 8388608

fs.file-max = 6815744

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

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

执行#sysctl -p 命令使以上设置生效

%E5%9B%BE%E7%89%879.png

2、编辑/etc/pam.d/login 添加如下内容:

#vi /etc/pam.d/login

session    required     pam_limits.so

%E5%9B%BE%E7%89%8710.png

3、编辑vi /etc/profile添加如下内容:   #系统环境变量

if [ /$USER = "oracle" ] ; then

if [ /$SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

ulimit -u 16384 -n 65536

umask 022

%E5%9B%BE%E7%89%8711.png

4、编辑/etc/security/limits.conf 添加如下内容:

#vi /etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

%E5%9B%BE%E7%89%8712.png
%E5%9B%BE%E7%89%8714.png
  • 配置环境变量

切换至oracle用户

#su – oracle

# vi ~/.bash_profile

export ORACLE_BASE=/data/oracle/app

export ORACLE_HOME=/data/oracle/app/product/19.3.0/db_1

export ORACLE_SID=orcl

export PATH=$ORACLE_HOME/bin:$PATH

%E5%9B%BE%E7%89%8715.png

新建刚定义的文件夹,并给oracle用户赋权限

#su – root

#mkdir -p /data/oracle/app/product/19.3.0/db_1

# chown -R oracle:oinstall /data/oracle

%E5%9B%BE%E7%89%8716.png
  • 上传并解压安装包

我已经使用Mobaxterm自带的文件管理器,传至root目录下,

%E5%9B%BE%E7%89%8717.png

先把文件移动至ORACLE_HOME的目录下

# mv /root/LINUX.X64_193000_db_home.zip  /data/oracle/app/product/19.3.0/db_1

切换至oracle用户,解压文件

#su – oracl

# cd /data/oracle/app/product/19.3.0/db_1/

# unzip LINUX.X64_193000_db_home.zip

%E5%9B%BE%E7%89%8718.png
%E5%9B%BE%E7%89%8719.png

在oracle用户下操作,这里的IP就是你操作机器的IP,不是服务器的IP,如果是同局域网的简单,直接即可,否则记得做映射,不然整不出来哦。 因为我是在另外一台云主机192.168.0.53上远程操作192.168.0.34这台服务器,所以直接设置即可。

# export DISPLAY=192.168.0.53:0.0

#cd /data/oracle/app/product/19.3.0/db_1/

#./runInstaller

%E5%9B%BE%E7%89%8720.png
  • 图形化操作
%E5%9B%BE%E7%89%8721.png
%E5%9B%BE%E7%89%8722.png
%E5%9B%BE%E7%89%8723.png
%E5%9B%BE%E7%89%8724.png
%E5%9B%BE%E7%89%8725.png
%E5%9B%BE%E7%89%8726.png
%E5%9B%BE%E7%89%8727.png
%E5%9B%BE%E7%89%8728.png

我的点击 Fix & Check Again后,

%E5%9B%BE%E7%89%8729.png

继续 OK,

%E5%9B%BE%E7%89%8730.png

这里的swap分区大小的问题。我这个的修复代码如下

另新建一个连接,使用root用户:

#dd if=/dev/zero of=/home/swap bs=1024 count=16777216

#mkswap /home/swap

#swapon /home/swap

%E5%9B%BE%E7%89%8731.png
%E5%9B%BE%E7%89%8732.png
%E5%9B%BE%E7%89%8733.png
%E5%9B%BE%E7%89%8734.png
%E5%9B%BE%E7%89%8735.png
%E5%9B%BE%E7%89%8736.png

数据库已经安装完成,接下来创建监听和实例。

Oracle 用户下

#netca

%E5%9B%BE%E7%89%8737.png
%E5%9B%BE%E7%89%8738.png
%E5%9B%BE%E7%89%8739.png
%E5%9B%BE%E7%89%8740.png
%E5%9B%BE%E7%89%8741.png
%E5%9B%BE%E7%89%8742.png
%E5%9B%BE%E7%89%8743.png

接下来创建一个实例,

Oracle 用户下

#dbca

%E5%9B%BE%E7%89%8744.png
%E5%9B%BE%E7%89%8745.png
%E5%9B%BE%E7%89%8746.png
%E5%9B%BE%E7%89%8747.png
%E5%9B%BE%E7%89%8748.png
%E5%9B%BE%E7%89%8749.png
%E5%9B%BE%E7%89%8750.png
%E5%9B%BE%E7%89%8751.png
%E5%9B%BE%E7%89%8752.png
%E5%9B%BE%E7%89%8753.png
%E5%9B%BE%E7%89%8754.png
%E5%9B%BE%E7%89%8755.png
%E5%9B%BE%E7%89%8756.png
%E5%9B%BE%E7%89%8757.png
%E5%9B%BE%E7%89%8758.png

接下来就可以用navicat连接了:

%E5%9B%BE%E7%89%8759.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK