<Oracle>《(史上最完整)Linux 下安装Oracle数据库 - Oracle 19C By CentOS 8 》

news2024/12/24 8:24:30

《Linux 下安装Oracle数据库 - Oracle 19C By CentOS 8 》

  • 1 说明
    • 1.1 前言
    • 1.2 资源下载
  • 2 安装步骤
    • 2.1 上传安装包
    • 2.2 下载数据库预安装包
    • 2.3 安装数据库预安装包
    • 2.4 安装Oracle数据库
      • 2.4.1 第一次安装报错
      • 2.4.2 解决安装报错
      • 第一步:安装libnsl.so.1
      • 第二步:删除原来安装的 /opt/oracle/*
      • 第三步:卸载已安装的Oracle
      • 第四步:重新执行一次安装。
    • 2.5 配置环境变量
      • 2.5.1 修改centos主机名
      • 2.5.2 修改用户参数
      • 2.5.3 配置时钟同步
    • 2.6 创建数据库
  • 3 数据库使用
    • 3.1 启动数据库
    • 3.2 登录数据库时报错处理
    • 3.3 查询数据库

1 说明

1.1 前言

本文是Linux系统命令行模式安装Oracle数据库的学习实验记录,根据真实环境操作进行记录。具备较强的可操作性、可重复性。

本次实验在虚拟机环境中完成,Oracle数据库通过在Linux命令行方式安装

本文主要用实操实验方式探究Linux命令行安装Oracle数据库过程。对虚拟机软件安装、虚拟机下Linux环境搭建不做详细展开。

1.2 资源下载

1、虚拟机软件版本:本文使用VMware Workstation 17 Pro
在这里插入图片描述

2、操作系统版本:一键下载

[root@localhost proc]# cat /etc/redhat-release 
CentOS Linux release 8.5.2111

3、数据库版本:一键下载

本文使用Oracle 19C,具体版本为
19.3 - Enterprise Edition (also includes Standard Edition 2)

4、预安装包下载:参考2.2章节

5、本文相关资料已上传站内,可通过百度网盘下载全部内容。
点击跳转下载页面:感谢大家支持!

2 安装步骤

2.1 上传安装包

创建目录,通过SecureFX将数据库安装包上传至服务器。

大家如果遇到上传相关问题,可留言咨询。看到必回。

//创建目录
[root@localhost proc]# mkdir -p /oracle/install
//对目录赋权
[root@localhost proc]# chmod -R 777 /oracle/install
--说明:此时可将文件上传至/Oracle/install目录。

在这里插入图片描述
遗留问题:虚拟网卡传输速度为何限制为100M?

2.2 下载数据库预安装包

命令:

wget http://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

实际操作:

[root@localhost install]# pwd
/oracle/install
[root@localhost install]# ls
oracle-database-ee-19c-1.0-1.x86_64.rpm
[root@localhost install]# wget http://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
--2023-06-24 08:45:51--  http://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
Resolving yum.oracle.com (yum.oracle.com)... 2a02:26f0:2500:1bd::2a7d, 2a02:26f0:2500:1af::2a7d, 2.18.169.81
Connecting to yum.oracle.com (yum.oracle.com)|2a02:26f0:2500:1bd::2a7d|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm [following]
--2023-06-24 08:45:51--  https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
Connecting to yum.oracle.com (yum.oracle.com)|2a02:26f0:2500:1bd::2a7d|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18204 (18K) [application/x-rpm]
Saving to: ‘oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm’

oracle-database-preinsta 100%[==================================>]  17.78K   106KB/s    in 0.2s    

2023-06-24 08:45:52 (106 KB/s) - ‘oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm’ saved [18204/18204]

[root@localhost install]# ls
oracle-database-ee-19c-1.0-1.x86_64.rpm  oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

2.3 安装数据库预安装包

1、安装命令:

yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

2、第一次安装报错:

[root@localhost install]# yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm 
CentOS Linux 8 - AppStream                                           62  B/s |  38  B     00:00    
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

3、解决第一次报错,参考:点击跳转。主要操作步骤如下:

//进入yum的repos目录
cd /etc/yum.repos.d/

//修改 centos 文件内容
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

//生成缓存更新
yum makecache

//运行yum update(该步骤较慢)
yum update -y

//返回安装目录重新执行命令
[root@localhost yum.repos.d]# cd /oracle/install/
[root@localhost install]# ls
oracle-database-ee-19c-1.0-1.x86_64.rpm  oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
[root@localhost install]# yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm 

4、再次执行,出现第二次报错:

[root@localhost install]# yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm 
Last metadata expiration check: 0:06:14 ago on Sat 24 Jun 2023 08:58:15 AM PDT.
Error: 
 Problem: conflicting requests
  - nothing provides compat-libcap1 needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
  - nothing provides compat-libstdc++-33 needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

5、解决第二次报错:参考文章跳转

//尝试忽略,但是安装未成功。
[root@localhost install]# yum install --skip-broken oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
Last metadata expiration check: 0:04:39 ago on Sat 24 Jun 2023 09:08:19 AM PDT.
Dependencies resolved.
Nothing to do.
Complete!

//根据参考文章执行命令
[root@localhost install]# sudo rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
warning: oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
        compat-libcap1 is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
        compat-libstdc++-33 is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
        ksh is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
        libaio-devel is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
        libstdc++-devel is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
        sysstat is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
        xorg-x11-utils is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64

//果然如文章所言存在异常,先执行这个,在执行上面步骤
curl -o compat-libcap1-1.10-7.el7.x86_64.rpm http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm
//并没有用。


sudo rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm --force --nodeps

6、解决过程存在问题。参考下面文章解决:点击跳转。将命令进行修改,执行成功。
正确命令如下

[root@localhost install]# sudo rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm --force --nodeps
warning: oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-database-preinstall-19c-1.################################# [100%]

7、进行验证,如下为成功:

[root@localhost install]# id oracle
uid=65535(oracle) gid=65535(oinstall) groups=65535(oinstall),65541(racdba),65536(dba),65537(oper),65538(backupdba),65539(dgdba),65540(kmdba)
[root@localhost install]# 

2.4 安装Oracle数据库

操作用户: root
操作目录: 安装包目录
大致时长: 5分钟

执行过程会执行进度条,如下:

  Installing       : oracle-database-ee-19c-1.0-1.x86_64 [=======================             ] 1/1

2.4.1 第一次安装报错

1、第一次安装出现报错。操作过程详细:

[root@localhost install]# pwd
/oracle/install
[root@localhost install]# ls 
compat-libcap1-1.10-7.el7.x86_64.rpm     oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
oracle-database-ee-19c-1.0-1.x86_64.rpm
[root@localhost install]# 
[root@localhost install]# yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm 
Last metadata expiration check: 1 day, 23:06:39 ago on Sat 24 Jun 2023 09:08:19 AM PDT.
Dependencies resolved.
====================================================================================================
 Package                           Architecture      Version          Repository               Size
====================================================================================================
Installing:
 oracle-database-ee-19c            x86_64            1.0-1            @commandline            2.5 G

Transaction Summary
====================================================================================================
Install  1 Package

Total size: 2.5 G
Installed size: 6.9 G
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
ewTransaction test succeeded.
Running transaction
  Preparing        :                                                                            1/1 
  Running scriptlet: oracle-database-ee-19c-1.0-1.x86_64                                        1/1 
  Installing       : oracle-database-ee-19c-1.0-1.x86_64                                        1/1 
  Running scriptlet: oracle-database-ee-19c-1.0-1.x86_64                                        1/1 
Exception java.lang.UnsatisfiedLinkError: /opt/oracle/product/19c/dbhome_1/oui/lib/linux64/liboraInstaller.so: libnsl.so.1: cannot open shared object file: No such file or directory occurred..
java.lang.UnsatisfiedLinkError: /opt/oracle/product/19c/dbhome_1/oui/lib/linux64/liboraInstaller.so: libnsl.so.1: cannot open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
        at java.lang.Runtime.loadLibrary0(Runtime.java:870)
        at java.lang.System.loadLibrary(System.java:1122)
        at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.loadNativeLib(OiipuUnixOps.java:388)
        at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.<clinit>(OiipuUnixOps.java:130)
        at oracle.sysman.oii.oiip.oiipg.OiipgEnvironment.getEnv(OiipgEnvironment.java:201)
        at oracle.sysman.oii.oiix.OiixIniPair.instantiateEnvVars(OiixIniPair.java:299)
        at oracle.sysman.oii.oiix.OiixIniPair.updateValue(OiixIniPair.java:230)
        at oracle.sysman.oii.oiix.OiixIniPair.<init>(OiixIniPair.java:148)
        at oracle.sysman.oii.oiix.OiixIniFile.readFile(OiixIniFile.java:809)
        at oracle.sysman.oii.oiix.OiixIniFile.readIniFile(OiixIniFile.java:978)
        at oracle.sysman.oii.oiix.OiixIniFile.getProfileString(OiixIniFile.java:385)
        at oracle.sysman.oii.oiix.OiixOraparam.getOraparamProfileString(OiixOraparam.java:338)
        at oracle.sysman.oii.oiix.OiixOraparam.getOraparamProfileString(OiixOraparam.java:296)
        at oracle.sysman.oii.oiix.OiixOraparam.usePrereqChecker(OiixOraparam.java:416)
        at oracle.sysman.oii.oiic.OiicSessionContext.setVariables(OiicSessionContext.java:1325)
        at oracle.sysman.oii.oiic.OiicBaseInventoryApp.execute(OiicBaseInventoryApp.java:771)
        at oracle.sysman.oii.oiic.OiicBaseInventoryApp.main_helper(OiicBaseInventoryApp.java:690)
        at oracle.sysman.oii.oiic.OiicDetachHome.main(OiicDetachHome.java:420)
'DetachHome' failed.
Exception in thread "main" java.lang.NullPointerException
        at oracle.sysman.oii.oiic.OiicBaseInventoryApp.main_helper(OiicBaseInventoryApp.java:706)
        at oracle.sysman.oii.oiic.OiicDetachHome.main(OiicDetachHome.java:420)
Exception java.lang.NoClassDefFoundError: Could not initialize class oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps occurred..
java.lang.NoClassDefFoundError: Could not initialize class oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps
        at oracle.sysman.oii.oiip.oiipg.OiipgEnvironment.getEnv(OiipgEnvironment.java:201)
        at oracle.sysman.oii.oiix.OiixIniPair.instantiateEnvVars(OiixIniPair.java:299)
        at oracle.sysman.oii.oiix.OiixIniPair.updateValue(OiixIniPair.java:230)
        at oracle.sysman.oii.oiix.OiixIniPair.<init>(OiixIniPair.java:148)
        at oracle.sysman.oii.oiix.OiixIniFile.readFile(OiixIniFile.java:809)
        at oracle.sysman.oii.oiix.OiixIniFile.readIniFile(OiixIniFile.java:978)
        at oracle.sysman.oii.oiix.OiixIniFile.getProfileString(OiixIniFile.java:385)
        at oracle.sysman.oii.oiix.OiixOraparam.getOraparamProfileString(OiixOraparam.java:338)
        at oracle.sysman.oii.oiix.OiixOraparam.getOraparamProfileString(OiixOraparam.java:296)
        at oracle.sysman.oii.oiix.OiixOraparam.usePrereqChecker(OiixOraparam.java:416)
        at oracle.sysman.oii.oiic.OiicSessionContext.setVariables(OiicSessionContext.java:1325)
        at oracle.sysman.oii.oiic.OiicBaseInventoryApp.execute(OiicBaseInventoryApp.java:771)
        at oracle.sysman.oii.oiic.OiicBaseInventoryApp.main_helper(OiicBaseInventoryApp.java:690)
        at oracle.sysman.oii.oiic.OiicAttachHome.main(OiicAttachHome.java:696)
'AttachHome' failed.
Exception in thread "main" java.lang.NullPointerException
        at oracle.sysman.oii.oiic.OiicBaseInventoryApp.main_helper(OiicBaseInventoryApp.java:706)
        at oracle.sysman.oii.oiic.OiicAttachHome.main(OiicAttachHome.java:696)
[SEVERE] An error occurred while registering the Oracle home. Verify logs in /var/log/oracle-database-ee-19c/results/oraInstall.log and /opt/oracle/oraInventory for more details and try again.
warning: %post(oracle-database-ee-19c-1.0-1.x86_64) scriptlet failed, exit status 1

Error in POSTIN scriptlet in rpm package oracle-database-ee-19c
  Verifying        : oracle-database-ee-19c-1.0-1.x86_64                                        1/1 

Installed:
  oracle-database-ee-19c-1.0-1.x86_64                                                               

Complete!

2.4.2 解决安装报错

2、参考文章解决:点击跳转

第一步:安装libnsl.so.1

第一步:安装libnsl.so.1 ,操作过程如下:

[root@localhost install]# yum -y install /lib64/libnsl.so.1
Last metadata expiration check: 1 day, 23:21:45 ago on Sat 24 Jun 2023 09:08:19 AM PDT.
Dependencies resolved.
===============================================================================================================================================================================================================
 Package                                         Architecture                                    Version                                                 Repository                                       Size
===============================================================================================================================================================================================================
Installing:
 libnsl                                          x86_64                                          2.28-164.el8                                            baseos                                          103 k

Transaction Summary
===============================================================================================================================================================================================================
Install  1 Package

Total download size: 103 k
Installed size: 160 k
Downloading Packages:
libnsl-2.28-164.el8.x86_64.rpm                                                                                                                                                  96 kB/s | 103 kB     00:01    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                           95 kB/s | 103 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                       1/1 
  Installing       : libnsl-2.28-164.el8.x86_64                                                                                                                                                            1/1 
  Running scriptlet: libnsl-2.28-164.el8.x86_64                                                                                                                                                            1/1 
  Verifying        : libnsl-2.28-164.el8.x86_64                                                                                                                                                            1/1 

Installed:
  libnsl-2.28-164.el8.x86_64                                                                                                                                                                                   

Complete!

第二步:删除原来安装的 /opt/oracle/*

[root@localhost install]# cd /opt/oracle/
[root@localhost oracle]# ls -l
total 0
drwxrwx---. 3 oracle oinstall 18 Jun 26 08:20 oraInventory
drwxr-xr-x. 3 oracle oinstall 17 Jun 26 08:15 product
[root@localhost oracle]# rm -rf *
[root@localhost oracle]# ls
[root@localhost oracle]# ^C

第三步:卸载已安装的Oracle

[root@localhost oracle]# yum -y remove oracle-database-ee-19c
---
//中间很多行,此处略。
---
  Running scriptlet: oracle-database-ee-19c-1.0-1.x86_64                                                                                                                                                   1/1 
  Verifying        : oracle-database-ee-19c-1.0-1.x86_64                                                                                                                                                   1/1 

Removed:
  oracle-database-ee-19c-1.0-1.x86_64                                                                                                                                                                          

Complete

第四步:重新执行一次安装。

[root@localhost install]# yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm 
Last metadata expiration check: 1 day, 23:28:46 ago on Sat 24 Jun 2023 09:08:19 AM PDT.
Dependencies resolved.
===============================================================================================================================================================================================================
 Package                                                     Architecture                                Version                                       Repository                                         Size
===============================================================================================================================================================================================================
Installing:
 oracle-database-ee-19c                                      x86_64                                      1.0-1                                         @commandline                                      2.5 G

Transaction Summary
===============================================================================================================================================================================================================
Install  1 Package

Total size: 2.5 G
Installed size: 6.9 G
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                       1/1 
  Running scriptlet: oracle-database-ee-19c-1.0-1.x86_64                                                                                                                                                   1/1 
  Installing       : oracle-database-ee-19c-1.0-1.x86_64                                                                                                                                                   1/1 
  Running scriptlet: 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

  Verifying        : oracle-database-ee-19c-1.0-1.x86_64                                                                                                                                                   1/1 

Installed:
  oracle-database-ee-19c-1.0-1.x86_64                                                                                                                                                                          

Complete!

2.5 配置环境变量

2.5.1 修改centos主机名

类型英文解释
静态Static hostname内核主机名,是系统在启动时从/etc/hostname自动初始化的主机名。
瞬态Tansient hostname系统运行时临时分配的主机名,例如,通过DHCP或mDNS服务器分配。
灵活Pretty hostname有人叫做“别名”主机名,允许使用自由形式(包括特殊/空白字符)的主机名,以展示给终端用户(如xh01@f5)。

说明:“静态”主机名和“瞬态”主机名都遵从作为互联网域名同样的字符限制规则。

//查看主机名
[else@localhost ~]$ hostnamectl status
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: d611b318554e4318b18f552cbc04e60b
           Boot ID: bd4118580e4c4248a9186f8a49652f5d
    Virtualization: vmware
  Operating System: CentOS Linux 8
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-348.el8.x86_64
      Architecture: x86-64
//查看主机名2
[else@localhost ~]$ hostname
oracent

--只查看静态主机名
hosnamectl --static
--只查看瞬态主机名
hostnamectl --transient
-只查看灵活主机名
hostnamectl --pretty


//修改主机名
--临时修改
hostname oracent
--永久修改三个主机名
hostnamectl set-hostname oracent
--手动修改
vim /etc/hostname

参考文章:添加链接描述

2.5.2 修改用户参数

操作用户:Oracle

#注意:配置的是oracle用户的环境变量,因为以后所有操作都是在oracle用户下操作,并不是root用户
#所以下面修改的是oracle/.bash_profile
vim /home/oracle/.bash_profile

#添加如下内容:
export ORACLE_HOSTNAME=oracent      --- linux服务器主机名,就是你的主机名,可以利用hostname命令查看
export ORACLE_UNQNAME=ORCLCDB      --- 设置成数据库实例名(根据建立的数据库修改)
export ORACLE_SID=ORCLCDB      --- 数据库实例名(根据建立的数据库修改,建议就用这个)
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export ORACLE_INVENTORY=$ORACLE_BASE/oraInventory
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8    --- sqlplus 操作需要用到的编码,要和数据库编码一致

# 下面三个是为了解决sqlplus下方向键和回退键不能使用的问题,必须安装 rlwrap 后面会提到
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias ggsci='rlwrap ggsci'

2.5.3 配置时钟同步

[root@oracent ~]# yum -y install chrony
Last metadata expiration check: 0:06:11 ago on Wed 28 Jun 2023 09:14:48 AM PDT.
Package chrony-4.1-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

//修改时区为东八区,恢复正常。
[root@oracent ~]# timedatectl set-timezone Asia/Shanghai

//配置/etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#pool 2.centos.pool.ntp.org iburst
server 0.time1.aliyun.com iburst
# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 192.168.3.0/24

//相关命令
systemctl start chronyd      --启动
systemctl enable chronyd     --开机自启动
systemctl restart chronyd    --重启
systemctl enable chronyd     --查看状态
chronyc sources              --使生效

参考文章:Linux时间同步:chrony

2.6 创建数据库

[root@oracent ~]# /etc/init.d/oracledb_ORCLCDB-19c configure 
Configuring Oracle Database ORCLCDB.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.

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.

3 数据库使用

3.1 启动数据库

第一次启动失败。报错为:

Since ORACLE_HOME is not set, cannot auto-start Oracle Net Listener.

操作如下:

[oracle@oracent ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-JUN-2023 23:25:33

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

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@oracent ~]$ dbstart
Since ORACLE_HOME is not set, cannot auto-start Oracle Net Listener.
Usage: /opt/oracle/product/19c/dbhome_1/bin/dbstart ORACLE_HOME

解决方法,修改环境变量:

//分别修改以下两个文件
[oracle@oracent bin]$ vim $ORACLE_HOME/bin/dbstart
[oracle@oracent bin]$ vim $ORACLE_HOME/bin/dbshut
//修改如下段落
--将ORACLE_HOME=$1  修改为 ORACLE_HOME=$ORACLE_HOME 
--将ORACLE_HOME_LISTNER=$1 修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME 
# This is to bring down Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
if [ ! $ORACLE_HOME_LISTNER ] ; then
  echo "Since ORACLE_HOME is not set, cannot auto-stop Oracle Net Listener"
  echo "Usage: $0 ORACLE_HOME"
else
  # Set the ORACLE_HOME for the Oracle Net Listener, it gets reset to
  # a different ORACLE_HOME for each entry in the oratab.
  ORACLE_HOME=$ORACLE_HOME; export ORACLE_HOME
//保存后再次启动,不再报错。
[oracle@oracent bin]$ dbstart
[oracle@oracent bin]$ 

3.2 登录数据库时报错处理

第一次连接数据库报错,如下:

[oracle@oracent bin]$ sqlplus / as sysdba
bash: rlwrap: command not found...

资源下载:rlwrap-0.46.1.tar.gz

//上传文件后解压
[root@oracent rlwrap-0.46.1]# tar -xvzf rlwrap-0.46.1.tar.gz
[root@oracent oracle]# ls -l
total 340
drwxrwxr-x. 8 else else   4096 Jun 29 23:55 rlwrap-0.46.1
-rw-rw-r--. 1 else else 340033 Jun 29 23:49 rlwrap-0.46.1.tar.gz

//进入目录,进行安装
[root@oracent oracle]# cd rlwrap-0.46.1
[root@oracent oracle]# ./configure 

//第一次安装报错:
configure: error: 
You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build
// 安装依赖
[root@oracent oracle]# 
[root@oracent oracle]# yum install readline-devel
Last metadata expiration check: 0:08:57 ago on Thu 29 Jun 2023 11:48:43 PM CST.
Dependencies resolved.
====================================================================================================
 Package                    Architecture     Version                         Repository        Size
====================================================================================================
Installing:
 readline-devel             x86_64           7.0-10.el8                      baseos           204 k
Installing dependencies:
 ncurses-c++-libs           x86_64           6.1-9.20180224.el8              baseos            58 k
 ncurses-devel              x86_64           6.1-9.20180224.el8              baseos           528 k

Transaction Summary
====================================================================================================
Install  3 Packages

Total download size: 790 k
Installed size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): ncurses-c++-libs-6.1-9.20180224.el8.x86_64.rpm                34 kB/s |  58 kB     00:01    
(2/3): readline-devel-7.0-10.el8.x86_64.rpm                         111 kB/s | 204 kB     00:01    
(3/3): ncurses-devel-6.1-9.20180224.el8.x86_64.rpm                  270 kB/s | 528 kB     00:01    
----------------------------------------------------------------------------------------------------
Total                                                               402 kB/s | 790 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                            1/1 
  Installing       : ncurses-c++-libs-6.1-9.20180224.el8.x86_64                                 1/3 
  Installing       : ncurses-devel-6.1-9.20180224.el8.x86_64                                    2/3 
  Installing       : readline-devel-7.0-10.el8.x86_64                                           3/3 
  Running scriptlet: readline-devel-7.0-10.el8.x86_64                                           3/3 
  Verifying        : ncurses-c++-libs-6.1-9.20180224.el8.x86_64                                 1/3 
  Verifying        : ncurses-devel-6.1-9.20180224.el8.x86_64                                    2/3 
  Verifying        : readline-devel-7.0-10.el8.x86_64                                           3/3 

Installed:
  ncurses-c++-libs-6.1-9.20180224.el8.x86_64         ncurses-devel-6.1-9.20180224.el8.x86_64        
  readline-devel-7.0-10.el8.x86_64                  

Complete!

编译安装

[root@oracent rlwrap-0.46.1]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make sets $(MAKE)... (cached) yes
checking whether build environment is sane... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking for perl... /usr/bin/perl
checking for strip... strip
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for errno.h... yes
checking for fcntl.h... yes
checking for libgen.h... yes
checking for libutil.h... no
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for sched.h... yes
checking for sys/file.h... yes
checking for sys/ioctl.h... yes
checking for sys/wait.h... (cached) yes
checking for sys/resource.h... yes
checking for stddef.h... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking for stdint.h... (cached) yes
checking for time.h... yes
checking for sys/time.h... yes
checking for getopt.h... yes
checking for regex.h... yes
checking for curses.h... yes
checking for stropts.h... no
checking for termcap.h... yes
checking for util.h... no
checking for term.h... yes
checking for ncurses/term.h... yes
checking for gcc options needed to detect all undeclared functions... none needed
checking whether PROC_PIDVNODEPATHINFO is declared... no
checking whether procstat_open_sysctl is declared... no
checking whether procstat_getprocs is declared... no
checking whether procstat_getfiles is declared... no
checking whether STAILQ_FOREACH is declared... no
checking argument type of tputs putc function... int
checking for an ANSI C-conforming const... yes
checking for pid_t... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether gcc needs -traditional... no
checking for getopt_long... yes
checking for basename... yes
checking for dirname... yes
checking for flock... yes
checking for getopt_long... (cached) yes
checking for isastream... yes
checking for mkstemps... yes
checking for pselect... yes
checking for putenv... yes
checking for readlink... yes
checking for sched_yield... yes
checking for setenv... yes
checking for setitimer... yes
checking for setsid... yes
checking for setrlimit... yes
checking for sigaction... yes
checking for snprintf... yes
checking for strlcpy... no
checking for strlcat... no
checking for strnlen... yes
checking for system... yes
checking for openpty in -lutil... yes
checking for openpty... yes
checking for getpty... no
checking for grantpt... yes
checking for unlockpt... yes
checking for getpt... 
checking for pty/tty type... checking for pty.h... yes
OPENPTY
configure: checking for pty ranges
checking for tgetent... no
checking for tgetent in -ltinfo... yes
checking for readline in -lreadline... yes
checking for tigetnum... yes
checking for readline/readline.h... yes
checking whether your readline headers and library know about rl_set_screen_size... yes
checking whether your readline headers and library know about rl_basic_quote_characters... yes
checking whether your readline headers and library know about rl_variable_value... yes
checking whether your readline headers and library know about rl_readline_version... yes
checking whether your readline headers and library know about rl_executing_keyseq... yes
checking whether the private symbol _rl_horizontal_scroll_mode is visble in your readline libs... yes
Will rlwrap find command's working directory under /proc/<commands pid>/cwd? let's see...
checking for /proc/13315/cwd/configure.ac... yes
checking whether we can find command line under <opt_proc_mountpoint>/<pid>/cmdline and mirror it by overwriting our own *argv (this may take a few secs)... yes


checking that generated files are newer than configure... done
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating filters/Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating doc/rlwrap.man
config.status: creating config.h
config.status: executing depfiles commands

Now do:
    make (or gmake)  to build rlwrap
    make check       for instructions how to test it
    make install     to install it

[root@oracent rlwrap-0.46.1]# make
make  all-recursive
make[1]: Entering directory '/home/oracle/rlwrap-0.46.1'
Making all in doc
make[2]: Entering directory '/home/oracle/rlwrap-0.46.1/doc'
sed -e 's#@DATADIR@#/usr/local/share#'  rlwrap.man > rlwrap.1
make[2]: Leaving directory '/home/oracle/rlwrap-0.46.1/doc'
Making all in src
make[2]: Entering directory '/home/oracle/rlwrap-0.46.1/src'
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
mv -f .deps/main.Tpo .deps/main.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT signals.o -MD -MP -MF .deps/signals.Tpo -c -o signals.o signals.c
mv -f .deps/signals.Tpo .deps/signals.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT readline.o -MD -MP -MF .deps/readline.Tpo -c -o readline.o readline.c
mv -f .deps/readline.Tpo .deps/readline.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT pty.o -MD -MP -MF .deps/pty.Tpo -c -o pty.o pty.c
mv -f .deps/pty.Tpo .deps/pty.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT completion.o -MD -MP -MF .deps/completion.Tpo -c -o completion.o completion.c
mv -f .deps/completion.Tpo .deps/completion.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT term.o -MD -MP -MF .deps/term.Tpo -c -o term.o term.c
mv -f .deps/term.Tpo .deps/term.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT ptytty.o -MD -MP -MF .deps/ptytty.Tpo -c -o ptytty.o ptytty.c
ptytty.c: In function ‘ptytty_control_tty’:
ptytty.c:257:9: warning: implicit declaration of function ‘isastream’; did you mean ‘system’? [-Wimplicit-function-declaration]
     if (isastream(fd_tty) == 1) {
         ^~~~~~~~~
         system
mv -f .deps/ptytty.Tpo .deps/ptytty.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c
mv -f .deps/utils.Tpo .deps/utils.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT string_utils.o -MD -MP -MF .deps/string_utils.Tpo -c -o string_utils.o string_utils.c
mv -f .deps/string_utils.Tpo .deps/string_utils.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT malloc_debug.o -MD -MP -MF .deps/malloc_debug.Tpo -c -o malloc_debug.o malloc_debug.c
mv -f .deps/malloc_debug.Tpo .deps/malloc_debug.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT multibyte.o -MD -MP -MF .deps/multibyte.Tpo -c -o multibyte.o multibyte.c
mv -f .deps/multibyte.Tpo .deps/multibyte.Po
gcc -DHAVE_CONFIG_H -I. -I..    -DDATADIR=\"/usr/local/share\"  -g -O2 -MT filter.o -MD -MP -MF .deps/filter.Tpo -c -o filter.o filter.c
mv -f .deps/filter.Tpo .deps/filter.Po
gcc -DDATADIR=\"/usr/local/share\"  -g -O2   -o rlwrap main.o signals.o readline.o pty.o completion.o term.o ptytty.o utils.o string_utils.o malloc_debug.o multibyte.o filter.o  -lutil   -lreadline -ltinfo
make[2]: Leaving directory '/home/oracle/rlwrap-0.46.1/src'
Making all in filters
make[2]: Entering directory '/home/oracle/rlwrap-0.46.1/filters'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/oracle/rlwrap-0.46.1/filters'
make[2]: Entering directory '/home/oracle/rlwrap-0.46.1'
make[2]: Leaving directory '/home/oracle/rlwrap-0.46.1'
make[1]: Leaving directory '/home/oracle/rlwrap-0.46.1'

该报错,退出重连可能就好了。

3.3 查询数据库

[oracle@oracent ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 3 00:10:50 2023
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> SQL> select count(1) from v$database ;

  COUNT(1)
----------
         1

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracent ~]$ 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/711281.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

MATLAB 层次分析法

✅作者简介&#xff1a;人工智能专业本科在读&#xff0c;喜欢计算机与编程&#xff0c;写博客记录自己的学习历程。 &#x1f34e;个人主页&#xff1a;小嗷犬的个人主页 &#x1f34a;个人网站&#xff1a;小嗷犬的技术小站 &#x1f96d;个人信条&#xff1a;为天地立心&…

文件上传靶场upload-labs通关

文章目录 前言Pass-01&#xff08;JavaScript绕过&#xff09;Step1、分析源码Step2、修改webshell文件后缀名Step3、修改报文重新发送Step4、使用webshell程序测试是否能连接 Pass-02&#xff08;MIME-Type绕过&#xff09;Step1、分析源码Step2、burp抓包&#xff0c;修改数据…

docker启动springboot项目构建的镜像 并通过Nginx配置反向代理

1.首先准备好springboot项目构建的docker镜像 如果不会的去看我另一篇博客 docker构建springboot项目镜像 docker image list |grep alice2.通过命令启动镜像 注意: -p后面的端口号 前面可以随便写:后面必须是你springboot项目中application.yml的端口,不然 你启动起来 访问…

进阶(组件通讯)/react生命周期

如果是数值就在外面加{} 给组件传递任意类型数据 父子组件数据传递 兄弟组件传递 context的使用(多级嵌套) children属性 props校验 默认值 生命周期

通用分页详解【下】

目录 前言 一、通用分页的核心思想 二、PageBean的分页要素及优化 三、SQL的通用 1.获取总记录数 2.获取分页语句 四、PageTag的核心逻辑见解 五、运行流程 案例运用 注意&#xff1a; 1.pageBean优化 2.tld文件 3.分页标签助手类 4.Servlet层 5.jsp页面 6.结果输…

一款IP合并和分解工具(二)

本文是对上一篇文章的补充&#xff0c;看过《一款IP合并和分解工具&#xff08;一&#xff09;》的知道&#xff0c;cidr-merger工具在windows上使用需要用命令行&#xff0c;不是很方便&#xff0c;在这通过python的tkinter进行二次开发&#xff0c;写一个可视化的界面 目录 …

2bit反射型超表面设计

1.单patch扫参 1&#xff09;确定单元周期&#xff08;最好0.3波长到0.5波长&#xff09; 2&#xff09;确定介质介电常数。&#xff08;小一点比较好&#xff0c;带比较宽&#xff0c;一般选F4B2.65&#xff09; 3&#xff09;确定介质板厚度。厚一点好&#xff0c;最大3mm&a…

乱七八糟随便记录

建立Statement对象的作用是&#xff1f; 正确答案: C 你的答案: C (正确) A.连接数据库 B.声明数据库 C.执行SQL语句 D.保存查询结果 解释&#xff1a; 1、Statement对象用于执行不带参数的简单SQL语句。 2、Prepared Statement 对象用于执行预编译SQL语句。 3、Callable Sta…

react总结

一、React 入门 1.1 特点 高性能、声明式、组件化、单向响应的数据流、JSX扩展、灵活 1.2 React初体验 <head><meta charset"UTF-8"><meta http-equiv"X-UA-Compatible" content"IEedge"><meta name"viewport&quo…

软件测试缺陷

缺陷的定义 产品的定义不满足用户需求测试执行时&#xff0c;实际结果与预期结果不一致 缺陷产生的根本原因 需求变更沟通不畅&#xff0c;信息不同步软件复杂进度压力需求文档存在错误非根本设计存在错误非根本 缺陷的基本要素 ID编号&#xff1a;唯一模块&#xff1a;根据…

THREEJS 地图可视化案例分享

效果预览 git代码地址 threejs_map: threejs 地图可视化案例

能说会画 VisCPM:SOTA 开源中文多模态大模型

最近&#xff0c; 清华大学 NLP实验室、面壁智能、知乎联合在 OpenBMB 开源多模态大模型系列VisCPM &#xff0c;评测显示&#xff0c; VisCPM 在中文多模态开源模型中达到最佳水平。 VisCPM 是一个开源的多模态大模型系列&#xff0c;支持中英双语的多模态对话能力&#xff08…

全志科技T3国产工业核心板规格书(四核ARM Cortex-A7,主频1.2GHz)

1 核心板简介 创龙科技SOM-TLT3是一款基于全志科技T3处理器设计的4核ARM Cortex-A7国产工业核心板&#xff0c;每核主频高达1.2GHz。 核心板通过邮票孔连接方式引出CSI、TVIN、MIPI DSI、TVOUT、RGB DISPLAY、LVDS DISPLAY、GMAC、EMAC、USB、SATA、SDIO、UART、TSC、SPI、TW…

《PyTorch深度学习实践》第十讲 卷积神经网络(基础篇 + 高级篇)

b站刘二大人《PyTorch深度学习实践》课程第十讲卷积神经网络&#xff08;基础篇 高级篇&#xff09;笔记与代码&#xff1a; https://www.bilibili.com/video/BV1Y7411d7Ys?p10&vd_sourceb17f113d28933824d753a0915d5e3a90 https://www.bilibili.com/video/BV1Y7411d7Ys?…

数据结构--特殊矩阵的压缩存储

数据结构–特殊矩阵的压缩存储 一维数组的存储结构 ElemType a[10]; //ElemType型一维数组各数组元素大小相同&#xff0c;且物理上连续存放。 数组元素a[i]的存放地址 LOC i * sizeof(ElemType) ( 0 ≤ i < 10 ) (0\le i < 10) (0≤i<10) 注:除非题目特别说明&…

Win10不香了吗?微软 Win11 份额涨至 35.75% 创新高

根据 Valve 公司的最新调查结果&#xff0c;Windows 11 在 Steam 平台上的用户数量正稳步增长&#xff0c;预计将超过36%的比例。Steam定期进行用户软硬件情况调查&#xff0c;旨在提供可靠的数据支持供公司和游戏开发者用于未来的决策制定。此调查选择参与用户的方式是随机的&…

树莓派学习笔记12-安装使用PyZbar

树莓派学习笔记12-安装使用PyZbar 前言 通过树莓派外接USB摄像头&#xff0c;实现条形码的识别&#xff0c;并串口&#xff08;USB串口&#xff09;打印条形码的内容。 前期准备 硬件&#xff1a;树莓派4B 系统&#xff1a;Raspios-2021-03-04 编译器&#xff1a;Thonny 视…

如何基于GeoToolKit/INT实现矢量流线的聚集动画效果示例

继续在上一篇文章的基础上&#xff0c;利用相同的数据处理方法统一了不同年代地层的数据格式&#xff08;目前js解析支持的格式有ZMap、TS、XYZ和XYZA等&#xff09;&#xff0c;本文主要基于GeoToolKit/INT组件&#xff0c;针对地质研究经常在二维等值线基础上模拟计算地层中物…

【C++3】crontab,ftp

文章目录 1.生成数据&#xff1a;crontab2.ftp&#xff1a;ftp是tcp/ip协议族中一员&#xff0c;分客户端和服务端2.1 安装&#xff1a;linux操作系统的用户也是ftp的用户&#xff0c;可以配置专用的ftp用户&#xff0c;专用的ftp用户只能用于ftp&#xff0c;不能登录操作系统2…

ROS2移动机器人导航仿真

环境&#xff1a;Ubuntu 18.04 ros2 eloquent wget http://fishros.com/install -O fishros && . fishros1.安装turtlebot3相关功能包 sudo apt install ros-eloquent-turtlebot3* ref&#xff1a; https://docs.ros.org/ ROS2导航SLAM建图探索_鱼香ROS的博客-CSD…