Linux服务器Oracle19C安装详细教程(附Oracle19C安装程序)

  • Oracle19C的安装与配置
  • 把19C的安装包传送到我们的虚拟机(Oracle 19C
  • oracle19C默认安装到/opt/目录下,要保证该目录空间足够
[root@yanshi data]# ll
总用量 2631532
-rw-r--r--. 1 root root     195388 Dec 28  2019 compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
-rw-r--r--. 1 root root      18204 5月  20 20:01 oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 2694664264 5月  20 20:01 oracle-database-ee-19c-1.0-1.x86_64.rpm

--将compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm安装
[root@yanshi Oracle_11G]# rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm 
警告:compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:compat-libstdc++-33-3.2.3-72.el7 ################################# [100%]

--将oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm安装到data目录下
[root@yanshi data]# rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
警告:oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
错误:依赖检测失败:
        compat-libcap1 被 oracle-database-preinstall-19c-1.0-1.el7.x86_64 需要
        ksh 被 oracle-database-preinstall-19c-1.0-1.el7.x86_64 需要
  • 这里看到有2个依赖包没有安装,下面开始安装依赖包
[root@yanshi data]# yum install -y compat-libcap1
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 compat-libcap1.x86_64.0.1.10-7.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================
 Package               架构            版本                   源                                大小
============================================================================================================
正在安装:
 compat-libcap1        x86_64        1.10-7.el7             server                            19 k
 
事务概要
============================================================================================================
安装  1 软件包

总下载量:19 k
安装大小:29 k
Downloading packages:
compat-libcap1-1.10-7.el7.x86_64.rpm                                                                                             |  19 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
  正在安装    : compat-libcap1-1.10-7.el7.x86_64                                                                                                    1/1 
  验证中      : compat-libcap1-1.10-7.el7.x86_64                                                                                                    1/1 

已安装:
  compat-libcap1.x86_64 0:1.10-7.el7                                                                                                                    

完毕!
  • 这里完成了第一个依赖包的安装,继续安装下一个依赖包
[root@yanshi data]# yum install -y ksh
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 ksh.x86_64.0.20120801-139.el7 将被 安装
--> 处理 ksh-20120801-139.el7.x86_64 与 pdksh 的冲突
--> 解决依赖关系完成
错误:ksh conflicts with pdksh-5.2.14-37.el5_8.1.x86_64
 您可以尝试添加 --skip-broken 选项来解决该问题
 您可以尝试执行:rpm -Va --nofiles --nodigest
  • 这里提示与pdksh冲突,我们移除pdksh
[root@yanshi data]# yum remove -y pdksh
已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 pdksh.x86_64.0.5.2.14-37.el5_8.1 将被 删除
--> 解决依赖关系完成

依赖关系解决

============================================================================================================
 Package          架构              版本                      源                                大小
============================================================================================================
正在删除:
 pdksh           x86_64        5.2.14-37.el5_8.1           installed                          378 k

事务概要
============================================================================================================
移除  1 软件包

安装大小:378 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : pdksh-5.2.14-37.el5_8.1.x86_64                                                                                                      1/1 
/var/tmp/rpm-tmp.Zy6BGe:行3: -e: 未找到命令
  验证中      : pdksh-5.2.14-37.el5_8.1.x86_64                                                                                                      1/1 

删除:
  pdksh.x86_64 0:5.2.14-37.el5_8.1                                                                                                                      

完毕!
  • 再次安装依赖包
[root@yanshi data]# yum install -y ksh
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 ksh.x86_64.0.20120801-139.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================
 Package            架构                 版本                       源                              大小
============================================================================================================
正在安装:
 ksh               x86_64           20120801-139.el7             server                           885 k

事务概要
============================================================================================================
安装  1 软件包

总下载量:885 k
安装大小:3.1 M
Downloading packages:
ksh-20120801-139.el7.x86_64.rpm                                                                                                  | 885 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : ksh-20120801-139.el7.x86_64                                                                                                         1/1 
  验证中      : ksh-20120801-139.el7.x86_64                                                                                                         1/1 

已安装:
  ksh.x86_64 0:20120801-139.el7                                                                                                                         

完毕!
  • 继续安装刚才失败的程序
[root@yanshi data]# rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
警告:oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:oracle-database-preinstall-19c-1.################################# [100%]
  • 安装Oracle主程序
[root@yanshi data]# yum install -y oracle-database-ee-19c-1.0-1.x86_64.rpm
已加载插件:fastestmirror, langpacks
正在检查 oracle-database-ee-19c-1.0-1.x86_64.rpm: oracle-database-ee-19c-1.0-1.x86_64
oracle-database-ee-19c-1.0-1.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 oracle-database-ee-19c.x86_64.0.1.0-1 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================
 Package                  架构        版本                   源                              大小
============================================================================================================
正在安装:
oracle-database-ee-19c   x86_64      1.0-1    /oracle-database-ee-19c-1.0-1.x86_64         6.9 G

事务概要
============================================================================================================
安装  1 软件包

总计:6.9 G
安装大小:6.9 G
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
  正在安装    : oracle-database-ee-19c-1.0-1.x86_64[#####################################]1/1 

[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-19c configure
  验证中      : oracle-database-ee-19c-1.0-1.x86_64[#####################################]1/1

已安装:
  oracle-database-ee-19c.x86_64 0:1.0-1                                                                                                                 

完毕!
  • 完成了软件的安装,下面开始创建数据库
[root@yanshi opt]# /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database ORCLCDB.
--由于虚拟机没有分配太大内存,这里报了个错
--如果内存太小将在36%之后报错结束
[WARNING] [DBT-11209] 当前的可用内存低于创建数据库所需的可用内存 (2,313MB)。
   原因: 以下节点没有必需的可用内存:
 节点:yanshi            可用内存:1.8861GB (1977704.0KB)

准备执行数据库操作
已完成 8%
复制数据库文件
已完成 31%
正在创建并启动 Oracle 实例
已完成 32%
已完成 36%
已完成 40%
已完成 43%
已完成 46%
正在进行数据库创建
已完成 51%
已完成 54%
正在创建插接式数据库
已完成 58%
已完成 77%
执行配置后操作
已完成 100%
数据库创建完成。有关详细信息, 请查看以下位置的日志文件:
 /opt/oracle/cfgtoollogs/dbca/ORCLCDB。
数据库信息:
全局数据库名:ORCLCDB
系统标识符 (SID):ORCLCDB
有关详细信息, 请参阅日志文件 "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log"。

Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.
  • 给oracle用户创建密码
[root@yanshi data]$# passwd oracle
更改用户 oracle 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新
  • 将oracle用户加入到sudo群组中
[root@yanshi ~]# vi /etc/sudoers
--输入上面的命令后,打开sudoers文件进行编辑
--找到root ALL=(ALL) ALL这行,并且在底下再加入以下命令:
oracle ALL=(ALL) ALL
  • 关闭防火墙
关闭: 
 [root@yanshi ~]# systemctl stop firewalld

开机禁用  : 
 [root@yanshi ~]# systemctl disable firewalld
  • 修改hosts文件
[root@yanshi ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.31.128 yanshi
  • 配置环境变量
--切换到oracle用户
[root@yanshi ~]# su - oracle
[oracle@yanshi ~]$ vi /home/oracle/.bash_profile 
--加入下面内容
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"

--使配置文件生效
[oracle@yanshi ~]$ source /home/oracle/.bash_profile
  •  配置监听
  • 这里要注意19C中已经取消了监听设置密码的功能 
--编辑listener.ora文件
[oracle@yanshi oracle]$ vim /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
--把里面内容修改为:
LISTENER =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.31.128)(PORT = 1521))
  )

NCC =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.31.128)(PORT = 1521))
  )

SID_LIST_LISTENER=
(SID_LIST=
  (SID_DESC =
  (GLOBAL_DBNAME = NCC)
  (SID_NAME = ORCLCDB)
  )
  (SID_DESC =
  (GLOBAL_DBNAME = ORCLCDB)
  (SID_NAME = ORCLCDB)
  )
)

--修改tnsnames.ora
[oracle@yanshi oracle]$ vim /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora
--把内容修改为
ORCLCDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.31.128)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = ORCLCDB)
    )
  )

NCC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.31.128)(PORT = 1521))
    (CONNECT_DATA =
  (SERVER = DEDICATED)
      (SERVICE_NAME = ncc)
    )
  )

LISTENER_ORCLCDB =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.31.128)(PORT = 1521))
  • 启动监听
[oracle@yanshi ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 25-MAY-2020 11:34:19

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

Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/yanshi/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.31.128)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.31.128)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                25-MAY-2020 11:34:19
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/yanshi/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.31.128)(PORT=1521)))
Services Summary...
Service "NCC" has 1 instance(s).
  Instance "ORCLCDB", status UNKNOWN, has 1 handler(s) for this service...
Service "ORCLCDB" has 1 instance(s).
  Instance "ORCLCDB", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
  • 在本地尝试是否可以连接数据库
  • 这里注意连接字符串的变化。URL=jdbc:oracle:thin:@ip:port:SID 更改为 URL=jdbc:oracle:thin:@ip:port/SID
posted @ 2022-09-09 15:24  洋芋不是土豆  阅读(8179)  评论(0编辑  收藏  举报