签到成功

知道了

CNDBA社区CNDBA社区

Linux 7.4 平台下 Oracle 19.3 单实例安装手册

2019-06-14 16:04 5153 1 原创 Oracle 19c
作者: dave

在之前的博客我们看了Oracle 12c和18c的单实例安装,如下:

https://www.cndba.cn/dave/article/3427

linux 6.4 平台下 Oracle 12c 单实例 安装手册
https://www.cndba.cn/dave/article/323https://www.cndba.cn/dave/article/3427https://www.cndba.cn/dave/article/3427https://www.cndba.cn/dave/article/3427

Oracle 18c 单实例安装手册 详细截图版
https://www.cndba.cn/dave/article/2971

https://www.cndba.cn/dave/article/3427

本篇我们看下Redhat 7.4 平台下Oracle 19.3的单实例安装。

因为19.3 是18c的升级,所以安装步骤相同。 前期的要求部分这里不再重复描述,如有不清楚,请参考之前18c的安装文档。

1安装前准备工作


1.1 手动配置

1.1.1配置本地yum源

[root@www.cndba.cn yum.repos.d]# cat cndba.repo 
[www.cndba.cn]
name=CNDBA.CN YUM Server
baseurl=file:///mnt
gpgcheck=0
enabled=1

1.1.2挂载镜像

[root@www.cndba.cn yum.repos.d]# mount /dev/cdrom /mnt
mount: /dev/sr0 is write-protected, mounting read-only
[root@www.cndba.cn yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Cleaning repos: www.cndba.cn
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
[root@www.cndba.cn yum.repos.d]#

1.1.3配置/etc/hosts

[root@www.cndba.cn ~]# vim /etc/hosts
192.168.1.51 cndba

1.1.4安装操作系统必备的软件包

yum install binutils gcc gcc-c++  compat-libstdc++-33 glibc  glibc.i686  glibc-devel  ksh libgcc.i686   libstdc++-devel  libaio  libaio.i686  libaio-devel  libaio-devel.i686  libXtst  libXtst.i686  libX11  libX11.i686 libXau  libXau.i686  libxcb  libxcb.i686  libXi  libXi.i686  make  sysstat  compat-libcap1 -y

RedHat7.*的镜像文件中没有compat-libstdc包,需要手动安装

[root@www.cndba.cn software]# rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm 
warning: compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:compat-libstdc++-33-3.2.3-72.el7 ################################# [100%]

1.1.5配置Linux的系统参数

1)配置Linux的内核参数

[root@www.cndba.cn ~]# vim /etc/sysctl.conf 
添加以下内容
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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
shmall大于或等于shmmax的值,以页为单位。shmmax物理内存大小的一半(以字节为单位)
用root用户执行sysctl -p 使修改生效。
[root@cndba ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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

2)设置 Oracle 用户的 Shell 限制

[root@www.cndba.cn ~]# vim /etc/security/limits.conf
添加以下内容
oracle  soft  nproc  2047
oracle  hard  nproc  16384
oracle  soft  nofile  1024
oracle  hard  nofile  65536
oracle  soft  stack  10240
oracle  hard  stack  32768
oracle soft memlock 3145728
oracle hard memlock 3145728

注意:
limits.conf 文件发生更改时,这些更改立即生效。但是,如果 Oracle 用户已登录,
则这些更改将在注销这些用户并重新登录之后生效。必须先完成此操作,然后再使用这些帐户进行安装。

3)设置PAM

确保加载了最新版本的 PAM,然后在 /etc/pam.d/login 文件中添加或编辑以下行:

[root@www.cndba.cn ~]# vim /etc/pam.d/login
添加以下内容
session required pam_limits.so

4)关闭防火墙/SELINUX

关闭防火墙
[root@www.cndba.cn ~]# systemctl stop firewalld
[root@www.cndba.cn ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
关闭SELINUX
[root@www.cndba.cn ~]# vi /etc/selinux/config
[root@www.cndba.cn ~]# cat /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
# 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=targeted

1.2 创建用户和组

[root@www.cndba.cn ~]# /usr/sbin/groupadd -g 54321 oinstall
[root@www.cndba.cn ~]# /usr/sbin/groupadd -g 54322 dba
[root@www.cndba.cn ~]# /usr/sbin/groupadd -g 54323 oper
[root@www.cndba.cn ~]# /usr/sbin/useradd -u 54321 -g oinstall -G dba,oper oracle
[root@www.cndba.cn software]# echo 'oracle' | passwd --stdin oracle
然后,可以使用ID命令验证要使用的Oracle安装所有者是否将Oracle Inventory组作为其主要组。例如:
[oracle@cndba ~]$ id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper)

1.3 创建目录

创建Oracle Homehttps://www.cndba.cn/dave/article/3427

[root@www.cndba.cn ~]# mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
[root@www.cndba.cn ~]# chown -R oracle:oinstall /u01
[root@www.cndba.cn ~]# chmod -R 775 /u01/

1.4 设置环境变量

切换到oracle用户下执行vim .bash_profile编辑.bash_profile文件添加以下内容:

[oracle@cndba ~]$ vim .bash_profile
ORACLE_SID=cndba;export ORACLE_SID  
ORACLE_UNQNAME=cndba;export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"; export NLS_DATE_FORMAT
#NLS_LANG=american_america.ZHS16GBK; export NLS_LANG
export NLS_LANG=AMERICAN_AMERICA.UTF8
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022

使设置的环境变量生效
[oracle@cndba ~]$ source .bash_profile

2安装数据库软件

从Oracle 18c开始,数据库软件直接采用解压缩的方式进行,需要直接解压缩到$ORACLE_HOME目录下,这点和之前区别较大。 这里直接进行解压缩。https://www.cndba.cn/dave/article/3427

[root@www.cndba.cn u01]# chown oracle:oinstall LINUX.X64_193000_db_home.zip 
[root@www.cndba.cn software]# su - oracle
[oracle@dave ~]$ unzip -d /u01/app/oracle/product/19.3.0/dbhome_1/ /u01/LINUX.X64_193000_db_home.zip

切换到Oracle用户进去Oracle Home目录执行./runInstaller安装Oracle 18c数据库软件
[oracle@cndba dbhome_1]$ cd /u01/app/oracle/product/19.3.0/dbhome_1/
[oracle@cndba dbhome_1]$ ./runInstaller









[root@dave yum.repos.d]# /u01/app/oraInventory/orainstRoot.sh 
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@dave yum.repos.d]# /u01/app/oracle/product/19.3.0/dbhome_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.3.0/dbhome_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.
Oracle Trace File Analyzer (TFA - Standalone Mode) is available at :
    /u01/app/oracle/product/19.3.0/dbhome_1/bin/tfactl

Note :
1. tfactl will use TFA Service if that service is running and user has been granted access
2. tfactl will configure TFA Standalone Mode only if user has no access to TFA Service or TFA is not installed

[root@dave yum.repos.d]# 

安装成功退出即可。

3 DBCA创建数据库

可以通过手动执行命令方式来创建数据库,也可通过DBCA来创建。推荐是使用DBCA方式,方便而且不容易出错。
在Oracle用户下执行DBCA命令创建数据库https://www.cndba.cn/dave/article/3427

[oracle@cndba dbhome_1]$ dbca

https://www.cndba.cn/dave/article/3427














https://www.cndba.cn/dave/article/3427

[oracle@dave ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jun 14 12:04:36 2019
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> show pdbs

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 DAVE               READ WRITE NO
SQL>

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2237
    原创
  • 2
    翻译
  • 535
    转载
  • 185
    评论
  • 访问:6531551次
  • 积分:4229
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ