oracle-database-preinstall-19c-1.0-1.el7.x86_64、oracle-database-preinstall-19c-1.0-1.el7.x86_64 这 2 个包百度一下都能搜到,其余用到的依赖安装包右边百度网盘免费下载,下面是安装的具体步骤,亲测有效!下面是安装成功截图
虚拟机中 DNS
# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 114.114.114.114
1、防火墙是一定要一定要关闭的
#systemctl stop firewalld.service
关闭操作系统自启动
#systemctl disable firewalld.service
检查关闭情况
systemctl status firewalld.service
2、关闭 selinux
编辑 /etc/selinux/config 文件
3、上传 oracle19c 依赖并安装
rpm -ivh *.rpm –force –nodeps
4、进行预安装
yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
5、进行安装
yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
6、修改配置脚本(sid 和 pdb 名称)或者 cp /etc/init.d/oracledb_ORCLCDB-19c /etc/init.d/oracledb_rrm-19c
vi /etc/init.d/oracledb_ORCLCDB-19c(可以修改 ORCLCDB)
#修改配置脚本
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_VERSION=19c
#此处是数据库实例名,应与前述配置一致
export ORACLE_SID=ORCLCDB(可以修改)
export TEMPLATE_NAME=General_Purpose.dbc
#此处是数据库字符集,根据自己情况配置。中国一般使用 ZHS16GBK。不过我使用的默认字符集 AL32UTF8。虽然占用空间变大,但是兼容更多语言。
export CHARSET=AL32UTF8
export PDB_NAME=ORCLPDB1(可以修改)
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
#是否创建 CDB 数据库,cdb 数据库指容器数据库,是 12c 以后才有的特定,可以选择 false。直接创建 pdb 数据库,如此用法将与 11c 一致。此处我本来就是为了学习新版本,所以选默认方式。
export CREATE_AS_CDB=true
7、修改配置文件
cp /etc/sysconfig/oracledb_ORCLCDB-19c.conf /etc/sysconfig/oracledb_rrm-19c.conf(ORCLCDB 改为修改后的)
8、初始化数据实例 (等待 10 分钟左右)
/etc/init.d/oracledb_ORCLCDB-19c configure
/etc/init.d/oracledb_rrm-19c configure(ORCLCDB 改为修改后的)
9、用 oracle 账号登陆,并配置环境变量(修改 ORACLE_SID = ORCLCDB 可以为其他 sid)
vi .bash_profile
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:/opt/oracle/product/19c/dbhome_1/bin
export ORACLE_SID=rrm
export NLS_LANG=AMERICAN_AMERICA.UTF8
source .bash_profile
10、更改用户名为 system 的密码为 123456,
alter user system identified by 123456;
11、创建表空间及用户和授权
sqlplus / as sysdba;
alter session set container=RRMDATA;(务必进行切换,默认进入的是 cdb)
drop tablespace ES including contents and datafiles
create tablespace ES logging datafile ‘/opt/oracle/oradata/RRM/RRMDATA/ES.dbf’ size 50m autoextend on next 50m maxsize 20480m extent management local;
create user ES identified by ES default tablespace YS temporary tablespace temp;
grant connect,resource,dba to ES;
drop user tssh cascade;
12、配置自启动(root 账户下操作)
# 为防止系统重启后,数据库不能使用,现设置开机自启动。
vi /etc/oratab
#修改 N 变为 Y
ORCLCDB:/opt/oracle/product/19c/dbhome_1:Y
# 新增启动脚本
vim /usr/bin/oracle.sh
#内容如下
#! /bin/bash
/opt/oracle/product/19c/dbhome_1/bin/lsnrctl start
/opt/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1
# 创建 oracle 服务
chmod 777 /usr/bin/oracle.sh
#新增服务配置
vi /etc/systemd/system/oracle19c.service
#内容如下
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment=”ORACLE_HOME=/opt/oracle/product/19c/dbhome_1″
ExecStart=/usr/bin/oracle.sh
[Install]
#设置开机自启动
systemctl enable oracle19c
其他常用命令:
systemctl enable oracle19c;
lsnrctl status;
show pdbs;
alter pluggable database pdb1 open;
navcat 连接 ora-48040 错误
vim /opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.ora 追加
SQLNET.ALLOWED_LOGON_VERSION=8
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8