Centos7使用RPM包安装Oracle21c数据库(EE)
官方下载链接
-
21c标准版
安装包信息:
文件名:LINUX.X64_213000_db_home.zip
(64-bit) (3,109,225,519 bytes) (sha256sum - c05d5c32a72b9bf84ab6babb49aee99cbb403930406aabe3cf2f94f1d35e0916) -
安装包信息:
文件名:oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
(2,339,651,768 bytes - September 08, 2021)
[Sha256sum: f8357b432de33478549a76557e8c5220ec243710ed86115c65b0c2bc00a848db]
安装文档
部署环境
-
系统:CentOS Linux release 7.9.2009 (Core)
-
数据库:Oracle 21.3
1. 修改hosts文件
1.1 查询主机名和IP地址
[root@host01 ~]# hostname
host01
1.2 修改/etc/hosts文件如下
[root@host01 ~]# cat /etc/hosts
127.0.0.1 localhost
192.168.198.171 host01
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
2. 将软件包上传到系统上,目录位置自定义
2.1 上传软件包
[root@host01 soft]# pwd
/soft
[root@host01 soft]# ll
总用量 2689460
-rw-r--r--. 1 root root 2753974424 8月 19 10:37 oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm
-rw-r--r--. 1 root root 26264 8月 19 10:36 oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
2.2 软件包下载地址
软件下载地址
1.软件oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/index.html
2.软件oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm下载地址
https://www.oracle.com/database/technologies/oracle21c-linux-downloads.html
3. 安装预安装包
3.1 安装预安装包
[root@host01 soft]# rpm -ivh oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
警告:oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
错误:依赖检测失败:
bc 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
bind-utils 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
ksh 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
net-tools 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
nfs-utils 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
policycoreutils-python 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
psmisc 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
smartmontools 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
sysstat 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
xorg-x11-utils 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
xorg-x11-xauth 被 oracle-database-preinstall-21c-1.0-1.el7.x86_64 需要
3.2 安装依赖包
根据以上提示安装缺少的依赖包
sudo yum install ksh policycoreutils-python smartmontools sysstat xorg-x11-utils xorg-x11-xauth -y
sudo yum install bc bind-utils net-tools nfs-utils psmisc -y
3.3.再次安装依赖包
没有提示报错,说明环境满足安装oracle21c
[root@host01 soft]# rpm -ivh oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
警告:oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:oracle-database-preinstall-21c-1.################################# [100%]
4. 安装oracle软件
[root@host01 soft]# rpm -ivh oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm
警告:oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:oracle-database-ee-21c-1.0-1 ################################# [100%]
[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-21c configure
根据日志输出接下来需要使用root用户执行/etc/init.d/oracledb_ORCLCDB-21c configure
5. 创建数据库
/etc/init.d/oracledb_ORCLCDB-21c 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.
6. 设置oracle用户环境变量
通过rpm包安装oracle
数据目录是:/opt/oracle/oradata/ORCLCDB
home目录是:/opt/oracle/product/21c/dbhome_1
su - oracle
vim .bashrc
export ORACLE_HOME=/opt/oracle/product/21c/dbhome_1
export ORACLE_SID=ORCLCDB
export CHARSET=AL32UTF8
export PATH=$PATH:$ORACLE_HOME/bin
source .bashrc
7. 连接数据库
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Mon Apr 3 17:08:45 2023
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
8. 查数据库信息
查询当前可插拔数据库以及状态
SQL> col name for a30
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 ORCLPDB1 READ WRITE
切换到可插拔数据库
SQL> alter session set container=ORCLPDB1;
Session altered.
查询可插拔数据库状态
SQL> col name for a30
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
3 ORCLPDB1 READ WRITE
关闭pdb数据库
SQL> alter pluggable database close;
Pluggable database altered.
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
3 ORCLPDB1 MOUNTED
启动pdb数据库
SQL> alter pluggable database open;
Pluggable database altered.
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
3 ORCLPDB1 READ WRITE
9. 安装问题
详见“Oracle21c数据库安装问题记录”。
标签:1.0,x86,database,EE,Centos7,64,21c,oracle,RPM From: https://www.cnblogs.com/zreo2home/p/18367915