CentOS 8 安装 oracle 23c CentOS9 Error deal

这篇具有很好参考价值的文章主要介绍了CentOS 8 安装 oracle 23c CentOS9 Error deal。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1.环境准备

软件准备
序号 软件 下载地址
1 VirtualBox

https://www.virtualbox.org/wiki/Downloads

2 CentOS Stream 8

https://mirrors.tuna.tsinghua.edu.cn/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-dvd1.iso

3 oracle-database-free-23c

# cd ~/Downloads
wget https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23c-1.0-1.el8.x86_64.rpm

4 oracle-database-preinstall-23c

wget https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/getPackage/oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm

5 rlwrap

wget https://github.com/hanslub42/rlwrap/releases/download/0.46.1/rlwrap-0.46.1.tar.gz

2.安装操作系统

操作系统使用virtualbox虚拟机安装的centos8服务器,该步骤省略,教程很多的。

该环境是有网的,所以不设置yum源,如果是没网的内网环境,自行挂载镜像包作为yum源。

服务器使用的是ubuntu 22.04 上 Oracle VM VirtualBox 虚拟机安装的 CentOS 8 ,基于windows和基于linux安装虚拟机没有影响。

服务器的规格是: 2C4G

CentOS 8 采用最小化安装

修改主机名和配置hosts
是要设置的主机名: centos8

是主机的 IP: 10.0.2.15

设置主机名

hostnamectl set-hostname centos8 # 设置
hostname # 查看
1
2
关闭防火墙与Selinux
防火墙和selinux按照需求关闭,我这是测试环境,索性关闭

关闭 selinux

sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
setenforce 0

输入 getenforce 返回 Permissive 则是临时关闭状态,

重启后是 Disabled ,完全关闭状态。

getenforce
sestatus

关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

查看是否关闭

systemctl status firewalld.service

3.安装数据库

下面的安装步骤是在 root 下执行的

执行预安装

dnf -y install oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm

安装的依赖具体内容如下:

bc
bind-libs
bind-libs-lite
bind-license
bind-utils
binutils
checkpolicy
compat-openssl10
fstrm
glibc-devel
glibc-headers
gssproxy
kernel-headers
keyutils
ksh
libICE
libSM
libX11
libX11-common
libX11-xcb
libXau
libXcomposite
libXext
libXi
libXinerama
libXmu
libXrandr
libXrender
libXt
libXtst
libXv
libXxf86dga
libXxf86misc
libXxf86vm
libdmx
libev
libmaxminddb
libnsl
libpkgconf
libverto-libev
libxcb
libxcrypt-devel
lm_sensors-libs
make
net-tools
nfs-utils
pkgconf
pkgconf-m4
pkgconf-pkg-config
policycoreutils-python-utils
protobuf-c
python3-audit
python3-bind
python3-libsemanage
python3-ply
python3-policycoreutils
python3-pyyaml
python3-setools
quota
quota-nls
rpcbind
smartmontools
sysstat
tar
unzip
xorg-x11-utils
xorg-x11-xauth
Installing
geolite2-city
geolite2-country

可以在 /var/log/oracle-database-preinstall-23c 目录下查看相关日志

安装Oracle 23c
使用安装命令:

dnf -y install oracle-database-free-23c-1.0-1.el8.x86_64.rpm

创建和配置Oracle数据库服务实例
运行脚本:

/etc/init.d/oracle-free-23c configure

输出:

[root@centos8 ~]# /etc/init.d/oracle-free-23c configure
Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:

Passwords do not match.  Enter the password:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database FREE.
Enter SYS user password:
**********
Enter SYSTEM user password:
**********
Enter PDBADMIN User Password:
************
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
33% complete
36% complete
39% complete
43% complete
Completing Database Creation
47% complete
49% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/FREE.
Database Information:
Global Database Name:FREE
System Identifier(SID):FREE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.

Connect to Oracle Database using one of the connect strings:
     Pluggable database: centos8/FREEPDB1
     Multitenant container database: centos8

4.设置oracle用户的环境配置

切换用户然后编辑 ~/.bash_profile

su - oracle
vi ~/.bash_profile
# oracle settings
export ORACLE_SID=FREE
export ORAENV_ASK=NO
export ORACLE_HOME=/opt/oracle/product/23c/dbhomeFree
export PATH=$ORACLE_HOME/bin:$PATH

刷新环境变量

source ~/.bash_profile

5.简单使用

启动数据库
1、启动监听

lsnrctl start

查看监听状态:

$ lsnrctl status
LSNRCTL for Linux: Version 23.0.0.0.0 - Developer-Release on 09-MAY-2023 10:02:25

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.2.15)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 23.0.0.0.0 - Developer-Release
Start Date                09-MAY-2023 00:27:46
Uptime                    0 days 9 hr. 34 min. 39 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           FREE
Listener Parameter File   /opt/oracle/product/23c/dbhomeFree/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/centos8/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.2.15)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "FREE" has 1 instance(s).
  Instance "FREE", status READY, has 1 handler(s) for this service...
Service "FREEXDB" has 1 instance(s).
  Instance "FREE", status READY, has 1 handler(s) for this service...
Service "faf3c4adb9132c47e0550a0027434e0c" has 1 instance(s).
  Instance "FREE", status READY, has 1 handler(s) for this service...
Service "freepdb1" has 1 instance(s).
  Instance "FREE", status READY, has 1 handler(s) for this service...
The command completed successfully

2、启动数据库

使用sqlplus连接数据库后输入startup

$ sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Tue May 9 10:06:07
2023 Version 23.2.0.0.0

Copyright © 1982, 2023, Oracle. All rights reserved.

Connected to: Oracle Database 23c Free, Release 23.0.0.0.0 -
Developer-Release Version 23.2.0.0.0

SQL> startup;

查询数据库信息
查看数据库版本信息:

SQL> SELECT BANNER_FULL FROM v$version;
BANNER_FULL
--------------------------------------------------------------------------------
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0

查询数据库和实例以及容器数据库信息

SQL> SELECT name, db_unique_name, log_mode, flashback_on, cdb FROM v$database;
> NAME      DB_UNIQUE_NAME                 LOG_MODE     FLASHBACK_ON    
> CDB
> --------- ------------------------------ ------------ ------------------ --- FREE      FREE                           NOARCHIVELOG NO                 YES
> 
> SQL> SELECT instance_name, version, status, database_status FROM
> v$instance;
> 
> INSTANCE_NAME    VERSION           STATUS       DATABASE_STATUS
> ---------------- ----------------- ------------ ----------------- FREE             23.0.0.0.0        OPEN         ACTIVE

查看sga信息

SQL> SELECT * FROM v$sgainfo;
NAME                                  BYTES RES     CON_ID
-------------------------------- ---------- --- ----------
Fixed SGA Size                     10042432 No           0
Redo Buffers                        4530176 No           0
Buffer Cache Size                 436207616 Yes          0
In-Memory Area Size                       0 No           0
Shared Pool Size                  671088640 Yes          0
Large Pool Size                    16777216 Yes          0
Java Pool Size                            0 Yes          0
Streams Pool Size                         0 Yes          0
Shared IO Pool Size                67108864 Yes          0
Data Transfer Cache Size                  0 Yes          0
Granule Size                       16777216 No           0

NAME                                  BYTES RES     CON_ID
-------------------------------- ---------- --- ----------
Maximum SGA Size                 1155423296 No           0
Startup overhead in Shared Pool   235549832 No           0
Free SGA Memory Available          16777216              0

14 rows selected.

创建测试用户和表
1、 查看当前连接

SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT

2、查看有哪些可拔插数据库

SQL> show pdbs
CON_ID CON_NAME                       OPEN MODE  RESTRICTED

     2 PDB$SEED                       READ ONLY  NO
     3 FREEPDB1                       READ WRITE NO

3、 进入可拔插数据库

SQL> alter session set container=FREEPDB1;

Session altered.

SQL> show con_name

CON_NAME
------------------------------ FREEPDB1

4、 查看插拔数据库中有哪些表空间及其数据文件

SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024 MB FROM DBA_DATA_FILES;

5、创建测试用户

SQL> create user testuser identified by 123456 default tablespace users;

User created.

SQL> GRANT connect, resource, unlimited tablespace to testuser;

Grant succeeded.

SQL>

6、使用新建的测试用户连接可拔插数据库

$ sqlplus testuser/123456@10.0.2.15:1521/FREEPDB1

SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Tue May 9 11:20:07
2023 Version 23.2.0.0.0

Copyright © 1982, 2023, Oracle. All rights reserved.

Connected to: Oracle Database 23c Free, Release 23.0.0.0.0 -
Developer-Release Version 23.2.0.0.0

SQL>

7、创建测试表

SQL> CREATE TABLE personnel (id NUMBER(2) CONSTRAINT PK_EMP PRIMARY KEY, name VARCHAR2(20), age NUMBER(2));

Table created.

8、增删改查数据

SQL> INSERT INTO personnel(id, name, age) VALUES(1, 'test1', 18);

1 row created.

SQL> INSERT INTO personnel(id, name, age) VALUES(2, 'test2', 19);

1 row created.

SQL> INSERT INTO personnel(id, name, age) VALUES(3, 'test3', 20);

1 row created.

SQL> INSERT INTO personnel(id, name, age) VALUES(4, 'test4', 21);

1 row created.

SQL> SELECT * FROM personnel;
    ID NAME                        AGE

     1 test1                        18
     2 test2                        19
     3 test3                        20
     4 test4                        21
SQL> DELETE FROM personnel WHERE id = 2;

1 row deleted.

SQL> SELECT * FROM personnel;
    ID NAME                        AGE

     1 test1                        18
     3 test3                        20
     4 test4                        21
SQL> UPDATE personnel SET name = 'testname' WHERE id = 3;

1 row updated.

SQL> SELECT * FROM personnel;
    ID NAME                        AGE

     1 test1                        18
     3 testname                     20
     4 test4                        21
SQL> truncate table personnel;

Table truncated.

SQL> SELECT * FROM personnel;

no rows selected

9、删除表

SQL> drop table personnel;

Table dropped.

10、删除用户

删除用户时,该用户必须没有连接,且用dba用户在创建用户的可拔插数据库下删除。

SQL>  drop user testuser;

User dropped.

停止数据库
sqlplus连接数据库并停止

SQL> shutdown

Database closed.
Database dismounted.
ORACLE instance shut down.

sqlplus优化

使用历史命令
在使用默认sqlplus时,使用方向键上下左右时会报乱码。可使用readline和rlwrap解决。

下载安装readline

dnf -y install readline readline-devel

下载安装rlwrap

wget https://github.com/hanslub42/rlwrap/releases/download/0.46.1/rlwrap-0.46.1.tar.gz
tar -zxvf rlwrap-0.46.1.tar.gz
cd rlwrap-0.46.1
./configure
make
make install

若缺少gcc、make之类的依赖自己安装一下即可。

使用:

rlwrap sqlplus / as sysdba

如果嫌弃这样麻烦,可以使用 alias 做重命名一下。把 alias 添加到.bash_profile 文件中。

su - oracle
echo "alias sqlplus='rlwrap sqlplus'" >> .bash_profile
source .bash_profile

设置行列宽度
pagesize 默认是14,linesize 默认是80 。 为了 美观,我们一般根据自己的屏幕分辨率来设置。

SQL> show pagesize;
pagesize 14
SQL> show linesize;
linesize 80
SQL> set pagesize 40;
SQL> set linesize 200;
SQL> show pagesize;
pagesize 40
SQL> show linesize;
linesize 200

卸载基于RPM安装的Oracle数据库

1、以安装所有者登录

su - oracle

2、删除关联库

cd $ORACLE_HOME/bin 
./dbca

3、删除关联侦听器

cd $ORACLE_HOME/bin 
./netca

4、切换到 root,然后删除数据库文章来源地址https://www.toymoban.com/news/detail-650654.html

dnf -y remove oracle-database-free-23c
dnf -y remove oracle-database-preinstall-23c

到了这里,关于CentOS 8 安装 oracle 23c CentOS9 Error deal的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • mac m1安装Centos9

    先看结果(在mac M1 安装centos8 安装不成功的原因大部分是没有找到正确的系统) 由于Cnetos8 停服,现有mac m1 上能够按照的Centos8 并非由官方发布,因此寻找官方发布的能够在mac m1上安装的centos版本。 在YouTuBe上找到一个视频Install CentOS on MacBook M1 Chip - YouTube 视屏中有虚拟机和

    2024年02月15日
    浏览(50)
  • vmware16安装centos9stream

    此次下载的是centos9 stream ,使用vmware16。因为centos9stream版本比较新,所以vmware16无法识别此系统,不过无伤大雅。但是可能会导致兼容性问题,比如开机关机会很慢,建议还是用vmware17! 下载镜像文件:https://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-

    2024年02月01日
    浏览(50)
  • centos9 redis安装报错(实在无解使用方法)

    报错如下 使用的解决命令 原过程

    2023年04月19日
    浏览(36)
  • macOS Sonoma 14.2RC(23C63)发布

    系统介绍 黑果魏叔12 月 6 日消息,苹果今日向 Mac 电脑用户推送了 macOS 14.2 RC更新(内部版本号:2323C633),本次更新距离上次发布隔了 49 天。 预计正式版会在下周到来。届时用户可以打开“设置”-“通用”-“软件更新”路径进行更新。 需要注意的是,因苹果各区域节点服

    2024年02月04日
    浏览(56)
  • 阿里云centos9stream安装宝塔+vscode(code-server)集成云端开发环境

    官网 https://www.bt.cn/new/download.htm 题外话:虽然感觉现在宝塔没以前好用了,而且有centos7、8 mysql编译导致OOM服务器挂掉无法ssh登录的情况,但他还是远程管理服务器的好选择,提示 宝塔只支持最新的centos9stream,重要数据一定要备份,最好是全新的系统,而且需要与vscode相辅相

    2024年02月10日
    浏览(48)
  • macOS Sonoma 14.2 (23C64) 正式版 Boot ISO 原版可引导镜像下载

    macOS Sonoma 14.2 (23C64) 正式版 Boot ISO 原版可引导镜像下载 本站下载的 macOS 软件包,既可以拖拽到 Applications(应用程序)下直接安装,也可以制作启动 U 盘安装,或者在虚拟机中启动安装。另外也支持在 Windows 和 Linux 中创建可引导介质。 请访问原文链接:https://sysin.org/blog/ma

    2024年01月17日
    浏览(53)
  • macOS Sonoma 14.2.1 (23C71) 正式版发布,ISO、IPSW、PKG 下载 (安全更新)

    macOS Sonoma 14.2.1 (23C71) 正式版发布,ISO、IPSW、PKG 下载 (安全更新) 本站下载的 macOS 软件包,既可以拖拽到 Applications(应用程序)下直接安装,也可以制作启动 U 盘安装,或者在虚拟机中启动安装。另外也支持在 Windows 和 Linux 中创建可引导介质。 请访问原文链接:https://sysin

    2024年02月02日
    浏览(55)
  • CentOS升级内核-- CentOS9 Stream/CentOS8 Stream/CentOS7

    官方文档在此 当我们安装一些软件(对,我说的就是Kubernetes),可能需要新内核的支持,而CentOS又比较保守,不太升级,所以需要我们手工升级. # 看下目前是什么版本内核 uname -a # 安装公钥 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org # 添加仓库,如果不执行该指令后面无法找到elrep

    2023年04月22日
    浏览(41)
  • Redhat centos9 配置国内和本地镜像源

    文章目录 概要 介绍Redhat centos9 整体架构流程 技术名词解释 技术细节 注意事项 小结 在 Red Hat 和 CentOS 中,配置国内镜像源和本地镜像源的主要作用是为了提高软件包的下载速度以及解决可能出现的网络连接问题。 Red Hat CentOS 9,也称为CentOS Stream 9,是由红帽公司推出的一个

    2024年04月17日
    浏览(35)
  • centos9怎么从普通用户切换到root模式

    在用pd18安装和配置好centos9后,我发现默认的终端是普通用户而不是root,导致 比如我想下东西比如git,输入 yum install git 命令,会提示没有权限操作。 怎么进入root管理员用户,方法如下 1.在命令行中输入: su 2.按下回车,输入用户登录的密码,即可进入到root权限用户模式下

    2024年02月13日
    浏览(39)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包