天天看点

CentOS6.5安装Oracle Express Edition(快捷版本)

Oracle Express Edition是给个人学习、熟悉Oracle的简化版。此版本大小只有301M,分为windows和linux两个版本,有32为和64的。

1、下载:

到官网下载软件包,要先注册一个帐号,下载完是一个压缩包,解压出oracle-xe-11.2.0-1.0.x86_64.rpm。Linux下只有64位版本。下载地址:http://www.oracle.com/technetwork/cn/database/database-technologies/express-edition/downloads/index.html

2、安装依赖包:

yum install libaio libaio-devel bc -y      

3、安装:

使用root用户

1)解压、检测:

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

A、修改/etc/fstab文件

vim /etc/fstab

将:

tmpfs        /dev/shm        tmpfs   defaults      0 0

改为:

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

B、重新加载tmpfs

umount /dev/shm

mount /dev/shm

C、检查

df -h /dev/shm

Filesystem      Size  Used Avail Use% Mounted on

none            2.0G  243M  1.8G  12% /dev/shm

4)按照提示进行安装:(使用root用户)

/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`

设置后注销用户,使用oracle用户重新登录,就可以用sqlplus了。