欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

CentOS7下Oracle19c rpm安装过程

程序员文章站 2022-06-18 07:56:52
软件 下载地址 centos-7-x86_64-minimal-2009.iso ht...

软件 下载地址
centos-7-x86_64-minimal-2009.iso http://mirrors.163.com/centos/7.9.2009/isos/x86_64/centos-7-x86_64-minimal-2009.iso
oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm https://www.aliyundrive.com/s/f9zimb6npbp
oracle-database-ee-19c-1.0-1.x86_64.rpm https://www.aliyundrive.com/s/e6m5e8ccgq2

一. 环境配置

​虚拟机安装建议分2g内存,30g硬盘。

关闭防火墙(或放行相关端口)

systemctl stop firewalld
systemctl disable firewalld

关闭selinux

修改selinux=disabled

vi /etc/selinux/config

# this file controls the state of selinux on the system.
# selinux= can take one of these three values:
#     enforcing - selinux security policy is enforced.
#     permissive - selinux prints warnings instead of enforcing.
#     disabled - no selinux policy is loaded.
selinux=disabled
# selinuxtype= can take one of three values:
#     targeted - targeted processes are protected,
#     minimum - modification of targeted policy. only selected processes are protected.
#     mls - multi level security protection.
selinuxtype=targeted

重启

reboot

oracle-database-ee-19c-1.0-1.x86_64.rpmoracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm上传到/opt

二. 依赖安装

安装oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

yum -y localinstall /opt/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

CentOS7下Oracle19c rpm安装过程

三. 安装配置oracle 19c

安装oracle 19c

yum -y localinstall /opt/oracle-database-ee-19c-1.0-1.x86_64.rpm

CentOS7下Oracle19c rpm安装过程

初始化oracle数据库(时间较长)

/etc/init.d/oracledb_orclcdb-19c configure

CentOS7下Oracle19c rpm安装过程

配置环境变量

却换到oracle用户

su - oracle

添加环境变量

vi /home/oracle/.bash_profile

# .bash_profile

# get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# user specific environment and startup programs

path=$path:$home/.local/bin:$home/bin

export path

export oracle_home=/opt/oracle/product/19c/dbhome_1
export path=$path:/opt/oracle/product/19c/dbhome_1/bin
export oracle_sid=orclcdb

使环境变量生效

source /home/oracle/.bash_profile

登陆数据库

sqlplus / as sysdba

CentOS7下Oracle19c rpm安装过程

修改system密码为123456

alter user system identified by 123456;

退出数据库

exit;

四. 设置数据库监听自启动

修改/etc/oratab文件ny

vi /etc/oratab

# this file is used by oracle utilities.  it is created by root.sh
# and updated by either database configuration assistant while creating
# a database or asm configuration assistant while creating asm instance.

# a colon, ':', is used as the field terminator.  a new line terminates
# the entry.  lines beginning with a pound sign, '#', are comments.
#
# entries are of the form:
#   $oracle_sid:$oracle_home:<n|y>:
#
# the first and second fields are the system identifier and home
# directory of the database respectively.  the third field indicates
# to the dbstart utility that the database should , "y", or should not,
# "n", be brought up at system boot time.
#
# multiple entries with the same $oracle_sid are not allowed.
#
#
orclcdb:/opt/oracle/product/19c/dbhome_1:y

/etc/rc.local中添加需执行的命令

su root # 却换为root用户
vi /etc/rc.local

#!/bin/bash
# this file is added for compatibility purposes
#
# it is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# in contrast to previous versions due to parallel execution during boot
# this script will not be run after all other services.
#
# please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local

su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'

修改$oracle_home/bin/dbstart文件,修改oracle_home_listner=$oracle_home

vi $oracle_home/bin/dbstart

$oracle_home/bin/dbstart 文件局部

...
#####################################

logmsg="logger -puser.alert -s "

trap 'exit' 1 2 3

# for script tracing
case $oracle_trace in
  t) set -x ;;
esac

# set path if path not set (if called from /etc/rc)
save_path=/bin:/usr/bin:/etc:${path} ; export path
save_llp=$ld_library_path

# first argument is used to bring up oracle net listener
oracle_home_listner=$oracle_home
if [ ! $oracle_home_listner ]; then
  echo "since oracle_home is not set, cannot auto-start oracle net listener."
  echo "usage: $0 oracle_home"
else
...

设置centos7,8开机执行/etc/rc.local文件(centos7,8开机不执行/etc/rc.local文件)

/etc/rc.d/rc.local 添加 可执行权限

chmod a+x /etc/rc.d/rc.local

将 rc-local 服务设置成开机启动(默认状态是 static,会被其他service服务调用执行。不过还是修改一下,以防那个服务被停用就牵连了)

systemctl enable rc-local

重启,用sqldeveloper链接,验证是否成功

reboot

CentOS7下Oracle19c rpm安装过程

删除/optoracle-database-ee-19c-1.0-1.x86_64.rpmoracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

rm /opt/oracle-database-ee-19c-1.0-1.x86_64.rpm /opt/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

到此这篇关于centos7下oracle19c rpm安装过程的文章就介绍到这了,更多相关oracle19c rpm安装内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!