软件包下载地址
一共需要两个软件包
# oracle数据库企业版
oracle-database-ee-19c-1.0-1.x86_64.rpm
# Oracle Database 19c的预安装RPM包,它主要用于在正式安装Oracle数据库之前准备系统环境
oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm
https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/index.html
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
安装Oracle
hostnamectl set-hostname oracle
echo '192.168.207.131 oralce' >> /etc/hosts
yum -y localinstall oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm
yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
/etc/init.d/oracledb_ORCLCDB-19c configure
[root@oracle ~]# /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/ORCLCDB1.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.
常用命令
/etc/init.d/oracledb_oradb-19c start 开启db
/etc/init.d/oracledb_oradb-19c stop 停止db
/etc/init.d/oracledb_oradb-19c restart 重启db
/etc/init.d/oracledb_oradb-19c delete 删除
/etc/init.d/oracledb_oradb-19c configure 配置创建db
/etc/sysconfig/oracledb_ORCLCDB-19c.conf 配置文件
lsnrctl start 启动监听器命令
lsnrctl stop 停止监听器命令
lsnrctl status 查看监听器命令
配置环境变量
cat >> /etc/profile << 'EOF'
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export ORACLE_SID=ORCLCDB
EOF
source /etc/profile
登录数据库
本地登录
# 切换用户
su - oracle
# 登录数据库
sqlplus / as sysdba
[root@oracle ~]# su - oracle
Last login: Sat Aug 10 02:26:14 EDT 2024 on pts/2
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 10 02:44:04 2024
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> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle ~]$
远程登录
// 修改system用户的密码为system
alter user system identified by system;
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 10 02:46:21 2024
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> alter user system identified by system;
User altered.
SQL>
设置开机自启动
chkconfig --add oracledb_ORCLCDB-19c
systemctl enable oracledb_ORCLCDB-19c