- CentOS 7.9
- Oracle Database 19.3 - Enterprise Edition
1)数据库安装:至少1GB,推荐2G以上;
2)Grid安装:至少8GB;
2.2 SWAP和内存关系1)1GB ~ 2GB:1.5倍 RAM;
2)2GB ~ 16GB:1倍 RAM;
3)大于16GB:16GB
2.3 磁盘空间要求Linux X86-64:
1)单机Grid:至少6.5 GB
2)企业版Oracle:至少7.2 GB
2.4 设置主机名称编辑/etc/hosts文件,增加主机名称:
192.168.56.109 strong strong.oracle.com2.5 网络和防火墙配置(已配置则不需配置) 2.5.1 网络配置
[root@strong ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_onLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=1e1f0b6a-9871-4268-b051-c3037442f163
DEVICE=enp0s3
onBOOT=yes
IPADDR=192.168.56.109
PREFIX=24
GATEWAY=192.168.56.1
IPV6_PRIVACY=no
2.5.2 防火墙配置查看防火墙状态,若防火墙是打开的,则将其关闭:
systemctl status firewalld
关闭防火墙(临时):
systemctl stop firewalld
关闭防火墙(永久):
systemctl disable firewalld
最后,编辑/etc/selinux/config文件,将其设置为SELINUX=permissive,并重启服务器或执行命令setenforce Permissive使其生效。
2.6 本地YUM源配置配置本地Yum源,用于安装Oracle数据库软件所需的RPM包,首先将Linux镜像盘挂在在/mnt目录:
[root@strong ~]# mount /dev/cdrom /mnt/ mount: /dev/sr0 is write-protected, mounting read-only
然后编辑Yum配置文件,切换到对应目录进行配置:
[root@strong ~]# cd /etc/yum.repos.d/ [root@strong yum.repos.d]# ll total 40 -rw-r--r--. 1 root root 1664 Oct 23 2020 CentOS-base.repo -rw-r--r--. 1 root root 1309 Oct 23 2020 CentOS-CR.repo -rw-r--r--. 1 root root 649 Oct 23 2020 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 Oct 23 2020 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 Oct 23 2020 CentOS-Media.repo -rw-r--r--. 1 root root 1331 Oct 23 2020 CentOS-Sources.repo -rw-r--r--. 1 root root 8515 Oct 23 2020 CentOS-Vault.repo -rw-r--r--. 1 root root 616 Oct 23 2020 CentOS-x86_64-kernel.repo
删除所有自带的repo文件,新建一个本地的repo文件:
[root@strong yum.repos.d]# vim server.repo [server] name=CentOS 7.9 baseurl=file:///mnt/ gpgcheck=0 enabled=1
最后执行clean和list命令:
[root@strong yum.repos.d]# yum clean all Loaded plugins: fastestmirror, langpacks Cleaning repos: server Cleaning up list of fastest mirrors [root@strong yum.repos.d]# yum list2.7 安装Oracle 12.2 所需RPM包
Oracle 19.3数据库软件依赖的RPM包如下,需要进行安装:
bc
binutils
compat-libcap1
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
安装命令如下:
yum install bc -y yum install binutils -y yum install compat-libcap1 -y yum install compat-libstdc++-33 -y yum install elfutils-libelf -y yum install elfutils-libelf-devel -y yum install fontconfig-devel -y yum install glibc -y yum install glibc-devel -y yum install ksh -y yum install libaio -y yum install libaio-devel -y yum install libX11 -y yum install libXau -y yum install libXi -y yum install libXtst -y yum install libXrender -y yum install libXrender-devel -y yum install libgcc -y yum install libstdc++ -y yum install libstdc++-devel -y yum install libxcb -y yum install make -y yum install smartmontools -y yum install sysstat -y yum install gcc-c++ -y2.8 创建用户和组
groupadd oinstall groupadd dba groupadd oper useradd -g oinstall -G dba,oper oracle passwd oracle
2.9 配置内核参数简单起见,扩展组不需单独创建,扩展组包括:backupdba、dgdba、kmdba、racdba。
在文件/etc/sysctl.conf增加内核参数:
[root@strong ~]# vim /etc/sysctl.conf 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
运行sysctl -p命令使其生效。
在文件/etc/security/limits.conf增加资源限制参数:
vim /etc/security/limits.conf 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 134217728 oracle soft memlock 1342177282.10 创建目录(root用户)
创建目录用于数据库软件安装:
mkdir -p /u01/app/oracle mkdir -p /u01/app/oraInventory chown -R oracle:oinstall /u01/app/oracle chown -R oracle:oinstall /u01/app/oraInventory chown -R oracle:oinstall /u01/ chmod -R 775 /u01/app mkdir -p /u01/app/oracle/product/19.0.0/dbhome_12.11 配置Oracle用户环境变量(Oracle用户)
vim .bash_profile ORACLE_base=/u01/app/oracle ORACLE_SID=orcl export ORACLE_base ORACLE_SID export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1 export PATH=$PATH:$ORACLE_HOME/bin2.12 准备Oracle数据库软件(Oracle用户) 2.12.1 创建目录存放Oracle软件
mkdir /u01/soft2.12.2 上传软件并解压缩
[oracle@strong ~]$ cd /u01/app/oracle/product/19.0.0/dbhome_1 [oracle@strong dbhome_1]$ unzip /u01/soft/LINUX.X64_193000_db_home.zip3 安装Oracle数据库软件 3.1 执行xhost+(root用户)
xhost +3.2 开启显示
export DISPLAY=10.1.135.129:0.03.3 启动安装
[oracle@strong ~]$ cd /u01/app/oracle/product/19.0.0/dbhome_1 [oracle@strong dbhome_1]$ ./runInstaller3.4 安装详细步骤
1)选择配置选项
2)选择数据库安装选项
3)选择数据库安装版本,选择企业版
4)指定数据库安装位置,默认即可
5)创建安装软件仓库
6)操作系统权限组操作,默认即可
7)Root脚本执行配置,若打算自动执行脚本,则进行相关配置
8)先决条件检查
9)先决条件检查完成,出现安装概要页面
10)安装产品,由于前面配置了Root脚本自动运行,这里直接点击Yes即可
11)安装完成,出现如下页
数据库软件安装完成后,就可以使用DBCA创建数据库了。
4 DBCA创建数据库在命令行运行dbca命令,用于数据库的创建。
1)选择数据库操作
2)选择数据库创建模式
3)选择数据库部署类型
4)指定数据库识别符,若创建容器数据库CDB,可勾选Create as Container database,否则创建的是非容器数据库
5)选择数据库存储选项
6)指定闪回恢复区以及数据库日志模式
7)指定网络配置详情,不设置则使用默认1521端口
8)选择数据Vault配置选项,默认
9)指定配置选项
(a)设置内存分配
(b)设置连接数
(c)设置字符集,建议使用UTF8
(d)指定数据库连接模式,默认是专用服务器模式
(e)是否安装样例数据库
10)是否安装EM Express,端口默认是5500
11)设置管理密码
12)选择数据库创建选项
13)数据库概要页面
14)进度页面,进行数据库的安装
15)安装完成
16)验证实例状态和版本
[oracle@strong ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 8 16:42:01 2021 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ orcl OPEN
17)登录EM Express
18)查看数据库主页



