CentOS6.5安装Oracle Express Edition

Oracle Express Edition是给个人学习、熟悉Oracle的简化版。

到官网下载软件包,要先注册一个帐号,下载完是一个压缩包,解压出oracle-xe-11.2.0-1.0.x86_64.rpm。Linux下只有64位版本。

网盘下载地址:http://pan.baidu.com/s/1ntJsDOt

1、安装依赖包

yum install libaio libaio-devel bc -y

2、安装Oracle Express Edition
使用root用户操作。

cd ~
wget http://download.oracle.com/otn/linux/oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip?AuthParam=1409379226_d26581af452e67b3a2b04fe09ee28749 -O oracle-xe-11.2.0-1.0.x86_64.rpm.zip
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
cd Disk1
rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

安装时会对系统进行检测,最好内存有1G,SWAP要求是内存的2倍。

[root@server01 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracle-xe              ########################################### [100%]
Executing post-install steps...

You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.



3、将tmpfs扩充为2G
tmpfs小于2G,在下一步执行设置命令会报错:

Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details

1)修改/etc/fstab文件

vim /etc/fstab

将:

tmpfs        /dev/shm        tmpfs   defaults      0 0


改为:

tmpfs        /dev/shm        tmpfs   defaults,size=2048M      0 0


2)重新加载tmpfs

umount /dev/shm
mount /dev/shm

3)检查

df -h /dev/shm
Filesystem      Size  Used Avail Use% Mounted on
none            2.0G  243M  1.8G  12% /dev/shm


4、按照提示进行设置

/etc/init.d/oracle-xe configure

[root@server01 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  to accept the defaults. 
Ctrl-C will abort.

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

Specify a port that will be used for the database listener [1521]: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.


输入的四项内容是:http访问时的端口、数据库的监听端口、SYS和SYSTEM用户的密码、是否开机启动(并没有开机启动,可能还有地方要设置)。

安装完成后,会自动建立一个名为oracle的用户,家目录/u01/app/oracle。
会建立dba组,oracle用户属于这个组。
会自动生成一个数据库实例,名为XE。/u01/app/oracle/product/11.2.0/xe/dbs/spfileXE.ora

HTTP管理地址:
http://服务器IP:8081/
用SYS或SYSTEM用户登录。

5、设置oracle的环境变量

vim /etc/profile

加入:

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`

设置后注销用户重新登录,就可以用sqlplus了。
环境变量内容参考:/u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

6、进入sqlplus控制台

sqlplus /nolog

SQL> connect as sysdba
Enter user-name: sys
Enter password:
Connected.
SQL>
之后可以做其它操作。

启动命令:
startup
关闭命令:
shutdown

参考资料:
http://blog.csdn.net/reda0821/article/details/7816562
http://blog.chinaunix.net/uid-24058189-id-29650.html
http://blog.csdn.net/yybjroam05/article/details/8566955
http://blog.csdn.net/redbednil/article/details/2825582

《CentOS6.5安装Oracle Express Edition》上的一个想法

评论已关闭。