centos8安装oracle19C

centos8安装oracle19

1.准备

1.工具准备

centos8、oracle19安装包、MobaXtermPortable远程工具(或者xshell+xmanager。oracle官网是需要用x server)

2.虚拟机上安装jdk
#1.查看jdk版本
yum -y list java*
#2.安装jdk版本
yum -y install java-1.8.0-openjdk*
#3.校验jdk
java -version
3.创建Oracle用户和组
[root@localhost home]# /usr/sbin/groupadd -g 54321 oinstall
[root@localhost home]# /usr/sbin/groupadd -g 54322 dba
[root@localhost home]# /usr/sbin/groupadd -g 54323 oper
[root@localhost home]# /usr/sbin/useradd -u 54321 -g oinstall -G dba,oper oracle
4.修改密码
[root@localhost home]# passwd oracle
5.创建工作目录并赋予文件权限
[root@localhost home]# mkdir -p /u01/app/oracle/product/19.3.0/client_1
[root@localhost home]# chown -R oracle:oinstall /u01/
[root@localhost home]# chmod -R 775 /u01/
6.配置oracle环境变量
[root@localhost home]# su - oracle
[oracle@localhost ~]$ vim .bash_profile
#校验环境配置
[oracle@localhost ~]$ env | more

配置文件配置umask 022,Oracle官网配置,如需特殊配置,可参考网上大神
在这里插入图片描述

7.创建临时文件夹放置linux安装包并解压到工作目录

[root@localhost /]# mkdir -p /mount_point/tmp
[root@localhost /]# cd /mount_point/tmp/
[root@localhost tmp]# ll
总用量 2987996
-rw-r--r--. 1 root root 3059705302 12月 19 11:27 LINUX.X64_193000_db_home.zip
[root@localhost tmp]# su oracle
[oracle@localhost tmp]$ unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/client_1/

8.配置X端运行服务器

[oracle@localhost client_1]$ export DISPLAY=192.168.70.1:0.0
[oracle@localhost client_1]$ xhost +
access control disabled, clients can connect from any host
xhost:  must be on local machine to enable or disable access control.

在这里插入图片描述

​ 8.1连接时,需要支持x11-forwarding,开启方法

#尝试打开可视化图形页面,如果失败,则下载X认证包
[root@localhost ~]# xclock
-bash: xclock: 未找到命令
[root@localhost ~]# yum install xorg-x11-xauth
[root@localhost ~]# vi /etc/ssh/sshd_config
	修改:AllowTcpForwarding yes
		 X11Forwarding yes
#重启服务
[root@localhost ~]# service sshd restart

9.安装前期检查配置文件

[oracle@localhost client_1]$ ldd /u01/app/oracle/product/19.3.0/client_1/perl/bin/perl

在这里插入图片描述

​ 9.1 如果出现** libnsl.so.1 => not found**,则需要如下操作

[root@localhost client_1]# su
[root@localhost client_1]# dnf install libnsl

​ 安装后,再次检查在这里插入图片描述

10.如果是虚拟机安装数据库19C,则需要配置交换空间

#1.使用dd命令创建一个swap分区
[root@localhost ~]# dd if=/dev/zero of=/home/swap bs=1024 count=8192000
#2.格式化刚才创建的分区
[root@localhost ~]# mkswap /home/swap
mkswap: /home/swap:不安全的权限 0644,建议使用 0600。
正在设置交换空间版本 1,大小 = 7.8 GiB (8388603904  个字节)
无标签,UUID=c0cc0b1d-475c-4ece-abc2-211a12f1f278
[root@localhost ~]# chmod 0600 /home/swap
[root@localhost ~]# mkswap /home/swap
mkswap: /home/swap:警告,将擦除旧的 swap 签名。
正在设置交换空间版本 1,大小 = 7.8 GiB (8388603904  个字节)
无标签,UUID=9d98e80a-fcdc-420c-895c-329acf6b680c
#3.再使用swapon命令把这个文件分区变成swap分区
[root@localhost ~]# swapon /home/swapap
[root@localhost ~]# swapoff /home/swap
[root@localhost ~]# swapon /home/swap
#4.swap自动挂载,修改etc/fstab文件,在文件末尾加上 /home/swap swap swap defaults 0 0
[root@localhost ~]# vim /etc/fstab
#5.执行命令,防止重启失效
[root@localhost ~]# echo "swapon  /home/swap" >> /etc/inittab
#6.查看重启是否生效,vi /etc/inittab,最后一行是swapon  /home/swap即可

11安装Oracle

11.1.先执行,可能会因为版本不兼容导致无法安装CV_ASSUME_DISTID=‘操作系统版本号’,如果不设置,可能会出现这种情况

在这里插入图片描述

[oracle@localhost client_1]$ export CV_ASSUME_DISTID=CENTOS8

11.2.启动

[oracle@localhost client_1]$ LANG=en_US ./runInstaller

图形化界面安装

11.2.1选择数据库安装类型,第一次安装,建议选择第一个
在这里插入图片描述

11.2.2.系统选择桌面还是服务器类,根据自己需要。

在这里插入图片描述

11.2.3.一直next到,典型安装处,取消勾选 Create as Container database

在这里插入图片描述

11.2.4.继续next,到口令设置,设置口令

在这里插入图片描述

11.2.5.继续next,开始安装

在这里插入图片描述

11.2.6.安装过程中,会弹窗提示,使用root执行弹窗的命令,执行后,点击弹窗OK即可,静等安装完成。

在这里插入图片描述

[root@localhost ~]# /u01/app/oraInventory/orainstRoot.sh
Performing root user operation.

The following environment variables are set as:
······
[root@localhost ~]# /u01/app/oracle/product/19.3.0/client_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.3.0/client_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Creating oraenv directory...
   Copying dbhome to oraenv ...
   Copying oraenv to oraenv ...
   Copying coraenv to oraenv ...

二、oracle环境配置及创建用户

1.配置oracle环境变量,如果不配置,则sqlplus提示找不到该命令,配置后,重启服务器

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/client_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

2.查看和启动oracle监听

#查看命令
[oracle@localhost ~]$ lsnrctl status
#启动
[oracle@localhost ~]$ lsnrctl start

未启动的监听

在这里插入图片描述

启动后的监听
在这里插入图片描述

此处可能的问题,启动监听,没有监听,显示The listener supports no services,在“/u01/app/oracle/product/19.3.0/client_1/network/admin”下的listener配置如下信息

SID_LIST_LISTENER =  
(SID_LIST =  
  (SID_DESC =  
  (GLOBAL_DBNAME = orcl)
  (SID_NAME = orcl)
  )
)

3.启动oracle

#1.连接Oracle
[oracle@localhost ~]$ sqlplus / as sysdba
#2.启动
SQL> startup;

启动成功
在这里插入图片描述

4.创建用户

4.1如果需要给用户分配表空间,需要先创建表空间

SQL> create tablespace TS_TAB_BASE datafile '/u01/app/oracle/oradata/ORCL/TS_TAB_BASE.DBF' size 2048m autoextend on next 100m maxsize 5120m permanent extent management local;

4.2表空间创建成功,创建用户并使用创建的表空间

SQL> create user CM identified by 123456 default tablespace TS_TAB_BASE temporary tablespace temp quota unlimited on TS_TAB_BASE;

4.3 赋予角色权限,根据实际需要赋予权限,因我需要使用比较大的权限,赋予权限比较多

SQL> GRANT create session,create table , create view , create sequence , create procedur TO CM;

5.使用远程连接,有以下两种方法,均可连接。

(1)直接关闭防火墙、selinux即可

[oracle@localhost ~]# stop firewalld.service
[oracle@localhost ~]# disable firewalld.service
[oracle@localhost ~]# vi /etc/selinux/config
#将文件中的"enforcing"修改为"SELINUX=disabled"

(2)在防火墙中开放端口1521,也可以达到远程连接

#1.设置1521端口开放
[oracle@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 1521 -j ACCEPT
#2.重启
[oracle@localhost ~]# /etc/rc.d/init.d/iptables restart

以下为本地连接并能使用例图
在这里插入图片描述

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值