建议大家使用Oracle XE版本,因为这是唯一在Oracle商业条款中可以免费使用的版本。其他Oracle版本中我没有看到free的字样,因此哪怕是用于开发和学习可能都是有问题的,不要因为学习和开发导致自己承担犯法的风险。同时请遵循以下要求,无论是在阿里云ECS上安装还是在自己的虚拟机或服务器,内存不得大于1GB,数据空间限制为11GB,以下内容摘自Oracle官网:
下载及安装
到Oracle官方网站下载:oracle-xe-11.2.0-1.0.x86_64.rpm.zip,解压后得到oracle-xe-11.2.0-1.0.x86_64.rpm文件,并进行RPM安装
[root@ora112 Oracle]# cd Disk1/
[root@ora112 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing... ################################# [100%]
/var/tmp/rpm-tmp.3YUxbo: line 186: bc: command not found
/var/tmp/rpm-tmp.3YUxbo: line 257: [: 18446744073692774399: integer expression expected
/var/tmp/rpm-tmp.3YUxbo: line 271: [: 18446744073692774399: integer expression expected
Updating / installing...
1:oracle-xe-11.2.0-1.0 ################################# [100%]
Executing post-install steps...
/var/tmp/rpm-tmp.we7w30: line 76: bc: command not found
/var/tmp/rpm-tmp.we7w30: line 77: bc: command not found
/var/tmp/rpm-tmp.we7w30: line 78: [: -gt: unary operator expected
/var/tmp/rpm-tmp.we7w30: line 82: bc: command not found
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.
[root@ora112 Disk1]#
问题处理
SWAP空间不足
如果在进行rpm安装时出现
[root@ora112 Oracle]# cd Disk1/
[root@ora112 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing... ################################# [100%]
/var/tmp/rpm-tmp.odUoYL: line 186: bc: command not found
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 1639 MB
of swap space. Configure more swap space on the system and retry the
installation.
error: %pre(oracle-xe-11.2.0-1.0.x86_64) scriptlet failed, exit status 1
error: oracle-xe-11.2.0-1.0.x86_64: install failed
请进行以下操作,扩大SWAP空间以完成进行数据库安装
[root@ora112 opt]# swapon
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 1.6G 0B -1
[root@ora112 opt]# dd if=/dev/zero of=/opt/swapfile2GB bs=1MB count=2048
2048+0 records in
2048+0 records out
2048000000 bytes (2.0 GB) copied, 4.10784 s, 499 MB/s
[root@ora112 opt]# chmod 0600 /opt/swapfile2GB
[root@ora112 opt]# mkswap /opt/swapfile2GB
Setting up swapspace version 1, size = 1999996 KiB
no label, UUID=230dd90e-c6fb-436d-8d24-96a946165f4d
[root@ora112 opt]# vi /etc/fstab
[root@ora112 opt]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Feb 9 21:21:02 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=4f2b0f6a-6e44-4b1a-b764-af7aaf2551af /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
/opt/swapfile2GB swap swap defaults 0 0
[root@ora112 opt]# swapon /opt/swapfile2GB
swapon: /opt/swapfile2GB: insecure permissions 0644, 0600 suggested.
[root@ora112 opt]# swapon /opt/swapfile2GB
[root@ora112 opt]# swapon
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 1.6G 0B -1
/opt/swapfile2GB file 1.9G 0B -2