本文仅是CentOS7安装Oracle XE记录,供参考
1、下载安装包
oracle-xe-11.2.0-1.0.x86_64.rpm.zip
2、安装
(1)第一次安装
[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]# pm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
-bash: pm: 未找到命令
[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)安装失败,需要开启交互空间
[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 -htotal 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)重新安装
[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)配置
[root@node1 Disk1]# /etc/init.d/oracle-xe configureOracle 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]:yStarting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
[root@node1 Disk1]#
(5)环境变量临时生效
[root@node1 Disk1]# cd /u01/app/oracle/product/11.2.0/xe/bin
[root@node1 bin]# source ./oracle_env.sh
[root@node1 bin]# sqlplus /nologSQL*Plus: Release 11.2.0.2.0 Production on 星期三 6月 28 05:13:59 2023Copyright (c) 1982, 2011, Oracle. All rights reserved.SQL>
(6)环境变量永久生效
[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 /nologSQL*Plus: Release 11.2.0.2.0 Production on 星期三 6月 28 05:15:56 2023Copyright (c) 1982, 2011, Oracle. All rights reserved.SQL>
(7)配置Oracle XE远程访问
SQL> conn sys / as sysdba;
输入口令:
已连接。
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);PL/SQL 过程已成功完成。SQL>
3、数据库工具远程登录Oracle
需要添加Oracle的驱动程序包