打开地址:https://yum.oracle.com/’
# 其实就是这一段
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
懒得找就点这里:https://yum.oracle.com/getting-started.html#installing-software-from-oracle-linux-yum-server
# 查询一下能否找到预装包
yum search oracle-database-preinstall
# 直接安装
yum install oracle-database-preinstall-19c.x86_64 -y
# 需要在其他机器上安装的可以先下载一下依赖,方便拷贝到内外机器上安装
yum install --downloadonly --downloaddir=/opt/rpm/ oracle-database-preinstall-19c.x86_64
注意:rpm包安装oracle默认是安装在/opt/oracle下面,请确认目录空间是否足够,至少有10G空余
# 安装好oracle-database-preinstall-19c.x86_64后再安装oracle-database-ee-19c-1.0-1.x86_64,要是全都下载好也可以一起安装
rpm -ivh oracle-database-ee-19c-1.0-1.x86_64.rpm
我的全部已经下载好了,直接一起安装,每个人的系统情况不一样,这里的依赖包可能有多有少,不必强求一直
重要!!!!
rpm -ql oracle-database-ee-19c.x86_64 | less
这里可以看到两个文件
# 脚本
/etc/init.d/oracledb_ORCLCDB-19c
# 该文件中有sid、编码等配置信息,需要自定义的不要忘记修改
# 配置文件
/etc/sysconfig/oracledb_ORCLCDB-19c.conf
# 该文件中有端口号、data文件存放位置等配置信息,可在此出修改
# 注意,如果你在oracledb_ORCLCDB-19c文件中修改了sid,你必须修改配置文件名称为oracledb_你的sid-19c.conf,否则会失败
[root@localhost oracle]# cp /etc/init.d/oracledb_ORCLCDB-19c /etc/init.d/oracledb_ORCLCDB-19c.bak
[root@localhost oracle]# vim /etc/init.d/oracledb_ORCLCDB-19c
# 修改前建议先备份!!!!
export ORACLE_VERSION=19c
export ORACLE_SID=ORCLCDB
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8 #问一下开发,要什么字符集就设置什么字符集
export PDB_NAME=ORCLPDB1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true
[root@localhost init.d]# sh /etc/init.d/oracledb_ORCLCDB-19c
Usage: oracledb_ORCLCDB-19c {start|stop|restart|configure|delete}
[root@localhost init.d]# sh 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.
到此配置结束
# 必须先停止oracle服务,否则会提示占用
sh /etc/init.d/oracledb_ORCLCDB-19c stop
mkdir /home/oracle
cp /etc/skel/.bash_profile /home/oracle/
cp /etc/skel/.bashrc /home/oracle/
chown oracle:oinstall -R /home/oracle
usermod -d /home/oracle oracle
sh /etc/init.d/oracledb_ORCLCDB-19c start
su - oracle
vim .bash_profile
# 在末尾加上
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export ORACLE_SID=ORCLCDB #根据你自己的来定
#链接上oracle
sqlplus / as sysdba
#修改sys密码
alter user sys identified by '你的新密码';
#修改system密码
alter user system identified by '你的新密码';
# 启动监听
lsnrctl start
# 检查监听状态
lsnrctl status
能链接成功就ok了,要是不能链接成功,检查一下你的linux防火墙、网络环境中的防火墙策略是否正常