CentOS rpm安装Oracle

CentOS下使用rpm安装Oracle19C

下载

下载database

到oracle官网下载地址下载最新的oracle,选择Linux x86-64中的RPM,点击下载(需登录),浏览器跳出下载后暂定下载,复制下载链接。

在服务器上下载

1
wget https://download.oracle.com/otn/linux/oracle19c/190000/oracle-database-ee-19c-1.0-1.x86_64.rpm?AuthParam=xxxx

上面的AuthParam需要更换为自己的

下载preinstall

下载地址搜索preinstall,下载最新版

1
wget https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm

安装

关闭防火墙和SELINUX

1
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config & setenforce 0&& systemctl disable firewalld.service && systemctl stop firewalld.service
1
2
3
4
5
6
7
[root@localhost src]# cat /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

* soft nproc 4096
root soft nproc unlimited

安装preinstall

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

安装database

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

查看实例端口和路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@localhost src]# cat /etc/sysconfig/oracledb_ORCLCDB-19c.conf
#This is a configuration file to setup the Oracle Database.
#It is used when running '/etc/init.d/oracledb_ORCLCDB configure'.
#Please use this file to modify the default listener port and the
#Oracle data location.

# LISTENER_PORT: Database listener
LISTENER_PORT=1521

# ORACLE_DATA_LOCATION: Database oradata location
ORACLE_DATA_LOCATION=/opt/oracle/oradata

# EM_EXPRESS_PORT: Oracle EM Express listener
EM_EXPRESS_PORT=5500

配置

创建数据库实例

1
/etc/init.d/oracledb_ORCLCDB-19c configure

过程很慢,静心等待

配置环境变量

1
vim /home/oracle/.bash_profile

添加如下内容:

1
2
3
4
5
6
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.UTF8

使修改立即生效:

1
source /home/oracle/.bash_profile

修改oracle密码

1
passwd oracle

登录数据库

1
2
su - oracle
sqlplus / as sysdba

sys默认密码:change_on_install
使用SQL Plus登录数据库时,system使用密码manager可直接登录。
但如果是sys用户,密码必须加上as sysdba,即完整密码为:change_on_install as sysdba

默认服务名:ORCLCDB

修改密码

1
SQL> password system

监听

1
2
3
lsnrctl status
lsnrctl stop
lsnrctl start

使用

创建用户

创建用户名为devops和密码为devops123的用户;

1
grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to devops123;

修改密码:

1
alter user devops identified by 123456; 

授权

1
grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to c#devops ;
作者

yhan219

发布于

2021-06-04

更新于

2021-06-04

许可协议