`
齐晓威_518
  • 浏览: 606223 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

在Linux上部署Java开发环境笔记(四)Linux中安装Oracle10g

 
阅读更多

一、下载Oracle XE

 

此次使用的Linux是红旗桌面6.0版本,oracle官方称oracle10g标准版(10201_database_linux32.zip)只支持

redhat-3,SuSE-9,redhat-4,UnitedLinux-1.0,asianux-1,asianux-2,redhat-5等Linux服务器版本

本人亲测,也确实不行,安装到62%的时候出现卡死的情况

重新在网上找了一个轻量级的oracle版本Oracle XE

下载地址:

http://download-llnw.oracle.com/otn/linux/oracle10g/xe/10201/oracle-xe-univ-10.2.0.1-1.0.i386.rpm
下载文件为“oracle-xe-univ-10.2.0.1-1.0.i386.rpm”

 

二、检查系统要求

 

查看可用RAM和交换空间大小

grep MemTotal /proc/meminfo

grep SwapTotal /proc/meminfo

所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。

要检查系统上的可用磁盘空间,运行以下命令:

df -h

 

三、检查下所需软件包

 

在shell下输入:

rpm -q  binutils gcc glibc glibc-headers glibc-kernheaders glibc-devel cpp compat-gcc-32 make compat-db compat-gcc-32-c++ compat-libstdc++-33 compat-libstdc++-devel setarch sysstat ksh libaio libaio-devel --qf '%{name}.%{arch}/n'|sort

会输出下面软件安装的信息:

binutils.i386
package compat-db is not installed
compat-gcc-32-c++.i386
compat-gcc-32.i386
compat-libstdc++-33.i386
cpp.i386
gcc.i386
glibc-devel.i386
glibc-headers.i386
glibc.i686
ksh.i386
package libaio-devel is not installed

package libaio is not installed
make.i386
package compat-libstdc++-devel is not installed
package glibc-kernheaders is not installed
package setarch is not installed
package sysstat is not installed

 

没装的软件包,去网上搜索,下载后放在/usr/share/目录下

执行shell安装,如下:

[root@localhost opt]# cd /usr/share
[root@localhost share]# ll *rpm
-rw-r--r-- 1 root root 1756069 06-13 11:53 compat-db-4.2.52-5.1.i386.rpm
-rw-r--r-- 1 root root   18526 06-13 16:51 libaio-0.3.103-3.i386.rpm
-rw-r--r-- 1 root root   10091 2005-03-09 libaio-devel-0.3.103-3.i386.rpm
-rw-r--r-- 1 root root    6021 06-13 10:55 setarch-1.3-1.i386.rpm
-rw-r--r-- 1 root root  105549 06-14 19:21 sysstat-5.0.5-1.i386.rpm

 

[root@localhost share]# rpm -ivh libaio-0.3.103-3.i386.rpm 
warning: libaio-0.3.103-3.i386.rpm: Header V3 DSA signature: NOKEY, key ID 73307de6
Preparing...                ########################################### [100%]
   1:libaio                 ########################################### [100%]
[root@localhost share]# rpm -ivh libaio-devel-0.3.103-3.i386.rpm 
warning: libaio-devel-0.3.103-3.i386.rpm: Header V3 DSA signature: NOKEY, key ID db42a60e
Preparing...                ########################################### [100%]
   1:libaio-devel           ########################################### [100%]
[root@localhost share]# rpm -ivh setarch-1.3-1.i386.rpm 
warning: setarch-1.3-1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 025e513b
Preparing...                ########################################### [100%]
   1:setarch                ########################################### [100%]
[root@localhost share]# rpm -ivh sysstat-5.0.5-1.i386.rpm 
warning: sysstat-5.0.5-1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
   1:sysstat                ########################################### [100%]
[root@localhost share]# rpm -ivh compat-db-4.2.52-5.1.i386.rpm 
warning: compat-db-4.2.52-5.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:compat-db              ########################################### [100%]

 

注:compat-libstdc++-devel 和 glibc-kernheaders 可能是因为其他软件版本高,导致这2个可以不用装(在网上搜索,有人说这2个包已废弃) 

 

四、安装Oracle XE

 

1.将下载后的“oracle-xe-univ-10.2.0.1-1.0.i386.rpm”上传至/opt目录下

 

2.使用root用户登录

[root@localhost ~]# cd /opt/
[root@localhost opt]# rpm -ivh oracle-xe-univ-10.2.0.1-1.0.i386.rpm 
Preparing...                ########################################### [100%]
   1:oracle-xe-univ         ########################################### [100%]
Executing Post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to 
configure the database.

 

3.shell下输入'/etc/init.d/oracle-xe configure'执行安装

安装过程中会需要输入http监听端口(默认8080),和oracle监听端口(默认1521)

为防止和tomcat的http监听端口相冲突,此处将oracle的http监听端口设置为8081 

[root@localhost opt]# /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g 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]: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:

Passwords do not match.  Enter the password:
Confirm the password:

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

Starting Oracle Net Listener...Done
Configuring Database...Done       ---- 此处会运行比较长一段时间,耐心等待
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "
http://127.0.0.1:8081/apex"

 

4.安装时防火墙一定要关闭
chkconfig –level 2345 iptables off

 

 

 

5. 安装时要关闭SELinux

 

 

(如果没有关闭,在安装应用程序的时候会出现问题)
setup Firewall configuration SELinux(Disabled)

 

五、查看监听是否启动

 

[root@localhost opt]# lsof -i:1521
COMMAND  PID   USER   FD   TYPE DEVICE SIZE NODE NAME
tnslsnr 2149 oracle   10u  IPv4  10073       TCP *:1521 (LISTEN)
tnslsnr 2149 oracle   12u  IPv4  11028       TCP localhost.localdomain:1521->localhost.localdomain:60455 (ESTABLISHED)
oracle  2267 oracle   19u  IPv4  11027       TCP localhost.localdomain:60455->localhost.localdomain:1521 (ESTABLISHED)
[root@localhost opt]# lsof -i:8081
COMMAND  PID   USER   FD   TYPE DEVICE SIZE NODE NAME
tnslsnr 2149 oracle   13u  IPv4  11146       TCP *:tproxy (LISTEN)

 

 

六、配置sqlplus

 

1.修改/root/.bash_profile内容

在/root/.bash_profile文件末增加下面内容

if [ -e /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh ];

then

   source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

elif [ -e /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin/oracle_env.sh ];

then

   source /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin/oracle_env.sh

fi

 

2.使配置文件/root/.bash_profile生效

然后shell下输入“source /root/.bash_profile”,使修改的配置文件生效:

[root@localhost opt]# source /root/.bash_profile

 

3.检验sqlplus是否可用

在shell下输入“sqlplus -?”:

[root@localhost opt]# sqlplus -?

SQL*Plus: Release 10.2.0.1.0 - Production

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

用法 1: sqlplus -H | -V

    -H             显示 SQL*Plus 版本和
                   用法帮助。
    -V             显示 SQL*Plus 版本。

用法 2: sqlplus [ [<option>] [<logon>] [<start>] ]

  <option> 为: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]

    -C <version>   将受影响的命令的兼容性设置为
                   <version> 指定的版本。该版本具有
                   "x.y[.z]" 格式。例如, -C 10.2.0
    -L             只尝试登录一次, 而不是
                   在出错时再次提示。
    -M "<options>" 设置输出的自动 HTML 标记。选项
                   的格式为:
                   HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
                   [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
    -R <level>     设置受限模式, 以禁用与文件系统交互的
                    SQL*Plus 命令。级别可以
                   是 1, 2 或 3。最高限制级别为 -R 3, 该级别
                   禁用与文件系统交互的
                   所有用户命令。
    -S             设置无提示模式, 该模式隐藏
                   命令的 SQL*Plus 标帜, 提示和回显
                   的显示。

  <logon> 为: (<username>[/<password>][@<connect_identifier>] | /)
              [AS SYSDBA | AS SYSOPER] | /NOLOG

    指定数据库帐户用户名, 口令和数据库连接
    的连接标识符。如果没有连接
    标识符, SQL*Plus 将连接到默认数据库。

    AS SYSDBA 和 AS SYSOPER 选项是数据库管理
    权限。

    /NOLOG 选项可启动 SQL*Plus 而不连接到
    数据库。

  <start> 为: @<URL>|<filename>[.<ext>] [<parameter> ...]

    使用将分配给脚本中的替代变量的指定参数
    从 Web 服务器 (URL) 或本地文件系统 (filename.ext)
    运行指定的 SQL*Plus 脚本。

在启动 SQL*Plus 并且执行 CONNECT 命令后, 将运行站点概要
文件 (例如, $ORACLE_HOME/sqlplus/admin/glogin.sql) 和用户概要文件
(例如, 工作目录中的 login.sql)。这些文件
可包含 SQL*Plus 命令。

有关详细信息, 请参阅 SQL*Plus 用户指南和参考。

 

这样就可以使用sqlplus访问oracle了

 

Oracle XE默认安装路径为:

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server

Oracle XE默认SID为:XE

 

七、oracle安装已完毕

可以通过sqlplus访问oracle或者在浏览器中输入http://ip:8080/apex,如果可以看到登录界面就可以了

注意:8080需换成你安装oracle时设置的http监听端口

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics