CentOS7安装Oracle XE记录

2023-10-18 17:34:16 浏览数 (1)

本文仅是CentOS7安装Oracle XE记录,供参考

1、下载安装包

oracle-xe-11.2.0-1.0.x86_64.rpm.zip

2、安装

(1)第一次安装

代码语言:javascript复制
[root@node1 opt]# cd Disk1/
[root@node1 Disk1]# ll
总用量 309884
-rw-r--r-- 1 root root 317320273 9月  28 09:41 oracle-xe-11.2.0-1.0.x86_64.rpm
drwxr-xr-x 2 root root        20 9月  28 09:41 response
drwxr-xr-x 2 root root        26 9月  28 09:41 upgrade 
[root@node1 Disk1]# ll
总用量 309884
-rw-r--r-- 1 root root 317320273 6月  28 04:43 oracle-xe-11.2.0-1.0.x86_64.rpm
drwxr-xr-x 2 root root        20 6月  28 04:43 response
drwxr-xr-x 2 root root        26 6月  28 04:43 upgrade
[root@node1 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
准备中...                          ################################# [100%]

This system does not meet the minimum requirements for swap space.  Based on
the amount of physical memory available on the system, Oracle Database 11g
Express Edition requires 2048 MB of swap space. This system has 0 MB
of swap space.  Configure more swap space on the system and retry the 
installation.

错误:%pre(oracle-xe-11.2.0-1.0.x86_64) 脚本执行失败,退出状态码为 1
错误:oracle-xe-11.2.0-1.0.x86_64: 安裝 已失败
[root@node1 Disk1]# 

(2)安装失败,需要开启交互空间

代码语言:javascript复制
[root@node1 Disk1]# swapon -a
[root@node1 Disk1]# vi /etc/fstab
/dev/mapper/centos-swap swap                    swap    defaults        0 0
[root@node1 Disk1]# dd  if=/dev/zero  of=/var/swaptest  bs=1024  count=2097152
记录了2097152 0 的读入
记录了2097152 0 的写出
2147483648字节(2.1 GB)已复制,12.1322 秒,177 MB/秒
[root@node1 Disk1]#
 [root@node1 Disk1]# free -h
              total        used        free      shared  buff/cache   available
Mem:           3.7G        249M        783M         11M        2.7G        3.2G
Swap:          2.0G          0B        2.0G
[root@node1 Disk1]# 

(3)重新安装

代码语言:javascript复制
[root@node1 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
准备中...                          ################################# [100%]
/var/tmp/rpm-tmp.KkJJh3: 第 257 行:[: 18446744073692774399: 期待整数表达式
/var/tmp/rpm-tmp.KkJJh3: 第 271 行:[: 18446744073692774399: 期待整数表达式
正在升级/安装...
   1:oracle-xe-11.2.0-1.0             ################################# [100%]
Executing post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

[root@node1 Disk1]#

(4)配置

代码语言:javascript复制
[root@node1 Disk1]# /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press <Enter> to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:

Specify a port that will be used for the database listener [1521]:

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
[root@node1 Disk1]# 

(5)环境变量临时生效

代码语言:javascript复制
[root@node1 Disk1]# cd /u01/app/oracle/product/11.2.0/xe/bin
[root@node1 bin]# source ./oracle_env.sh
[root@node1 bin]# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on 星期三 6月 28 05:13:59 2023

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> 

(6)环境变量永久生效

代码语言:javascript复制
[root@node1 bin]# cp oracle_env.csh /etc/profile.d/
[root@node1 bin]# cp oracle_env.sh /etc/profile.d/
[root@node1 bin]# source /etc/profile
[root@node1 bin]# cd
[root@node1 ~]# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on 星期三 6月 28 05:15:56 2023

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> 

(7)配置Oracle XE远程访问

代码语言:javascript复制
SQL> conn sys / as sysdba;
输入口令: 
已连接。
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

PL/SQL 过程已成功完成。

SQL> 
3、数据库工具远程登录Oracle

需要添加Oracle的驱动程序包

4、卸载
代码语言:javascript复制
[root@node1 ~]# ps -ef | grep ora_
root     28817 20226  0 01:00 pts/4    00:00:00 grep --color=auto ora_
[root@node1 ~]# systemctl stop oracle-xe
[root@node1 ~]# yum remove oracle-xe
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 oracle-xe.x86_64.0.11.2.0-1.0 将被 删除
--> 解决依赖关系完成

依赖关系解决

==========================================================================================================================================================
 Package                              架构                              版本                                   源                                    大小
==========================================================================================================================================================
正在删除:
 oracle-xe                            x86_64                            11.2.0-1.0                             installed                            564 M

事务概要
==========================================================================================================================================================
移除  1 软件包

安装大小:564 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
  正在删除    : oracle-xe-11.2.0-1.0.x86_64                                                                                                           1/1 
警告:文件 /u01/app/oracle/product/11.2.0/xe/config/seeddb/express.dfb: 移除失败: 没有那个文件或目录
警告:文件 /u01/app/oracle/product/11.2.0/xe/config/seeddb: 移除失败: 没有那个文件或目录
警告:文件 /etc/init.d/oracle-xe: 移除失败: 没有那个文件或目录
  验证中      : oracle-xe-11.2.0-1.0.x86_64                                                                                                           1/1 

删除:
  oracle-xe.x86_64 0:11.2.0-1.0                                                                                                                           

完毕!
[root@node1 ~]#
代码语言:javascript复制
[root@node1 ~]# rm -rf /u01/app/oracle/
[root@node1 ~]# userdel oracle
[root@node1 ~]# groupdel oinstall
groupdel:“oinstall”组不存在
[root@node1 ~]# groupdel dba
[root@node1 ~]# groupdel nobody
groupdel:不能移除用户“nobody”的主组
[root@node1 ~]# 

然后重新安装

代码语言:javascript复制
[root@node1 oracle-xe]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
准备中...                          ################################# [100%]
/var/tmp/rpm-tmp.wcLByw: 第 257 行:[: 18446744073692774399: 期待整数表达式
/var/tmp/rpm-tmp.wcLByw: 第 271 行:[: 18446744073692774399: 期待整数表达式
正在升级/安装...
   1:oracle-xe-11.2.0-1.0             ################################# [100%]
Executing post-install steps...
正在创建信箱文件: 文件已存在
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

[root@node1 oracle-xe]# 

0 人点赞