debian 4上安装oracle database xe

由于兄弟公司的需要帮他们作邮件系统的二次开发,使用的是PHP+ORACLE
这东东都没玩过,系统必须使用Linux,所以没办法只好自己装一个试试。

玩了两天把页面的东西完成了,剩下的就是使用PHP读ORACLE数据库了,客户还没有给定数据表结构,所以还有时间,就抽空装Linux。

以前看人家装过Redhat9,自己试过几次都没成功,后来也就作罢了。这次又有机会玩,于是就想到RH9,去网上DOWN了一个,华硕的机器本本根本就不听话,检测都通不过,上网一查说是华硕与RH不兼容,没办法于是只好找其它的Linux发行版。于是就选择debian 4。
呵呵,上面都是废话,下面继续:

首先没玩过的当然是上网搜索有没有相关的文章(有互联网真方便:) ),找到下面这篇:
http://bbs.chinaunix.net/redirect.php?fid=19&tid=841397&goto=nextnewset
在Debian上安装Oracle Database XE
原作者: redice li
来源:http://rediceli.blogspot.com/200  le-database-xe.html

OracleXE 简介

甲骨文2005年宣布向中国市场推出的可免费下载的Oracle Database 10g Express Edition (Oracle Database XE) ,供专业人员在学习及应用开发的起步阶段使用。Oracle Database XE建立在Oracle数据库10g第二版的代码库之上,与Oracle数据库产品系列完全兼容。Oracle Database XE可用于32位Linux和Windows操作系统,在功能上,Oracle Database XE版相当于Oracle Standard Edition One。但由于是免费版本,在硬件上受到了一定的限制,如:

至多使用1个CPU或1个双核CPU的处理能力;
最多可使用1GB内存;
每个服务器只限于一个CPU;
最多存储4GB的用户数据。
安装Oracle XE

测试环境建立于Debian系统上,系统具备4Gb的磁盘空间用于建立数据库,500M以上的空间用于安装数据库。要数据库真正运行起来,那么你最好为你的系统配置1Gb的内存。下一步,我们将配置Debian的sources.list,加入oracle安装包的站点:

root@debian ~# echo "deb http://oss.oracle.com/debian/ unstable main non-free" >> /etc/apt/sources.list
root@debian ~# apt-get update
安装oracle database XE只需要简单的安装两个包即可,安装过程如下:

root@debian ~# apt-get install oracle-xe-client
root@debian ~# apt-get install oracle-xe
完成后,安装过程就完成了。安装过程会更新一些核心的配置参数,可以通过查看/etc/sysctl.conf来查看这些变化,如果你不想重启系统就启动 oracle数据库,那么需要先应用这些配置。下面我们直接应用Oracle database XE的默认配置,如用户账号:

root@debian ~# sh /etc/init.d/oracle-sh configure
Oracle Database XE启动后,将打开服务端口1521,可以通过命令lsof来查看(lsof -n -i TCP:1521),默认安装的情况下,我们还可以通过Web管理接口在本机进行数据库管理(http://127.0.0.1:8080/apex)。我们可以通过 /etc/default/oracle-xe 文件来查看和更新当前 oracle 数据库的配置。

Oracle database XE的运行除了要求有一定数量的物理内存外,对交换空间也有一定的要求。Oracle Database 10g Express Edition 要求系统有1006MB的交换空间。如果不希望重启系统,你可以通过创建一个文件交换来达到这一要求:

root@debian ~# dd if=/dev/zero of=/MY_SWP_FILE bs=1M count=1000
root@debian ~# mkswp /MY_SWP_FILE
root@debian ~# swapon /MY_SWP_FILE
要启用或禁止Oracle database XE在开机时自动启动,可以通过 update-rc.d 工具来完成,或者修改文件/etc/default/oracle-xe文件,将其中 ORACLE_DBENABLED=true改为ORACLE_DBENABLED=false。

对于如何使用Oracle database XE不是本文所涉及的内容,就不多讲了。
不过安装并不顺利,使用apt-get update时,出现如下错误:
W: GPG error: http://oss.oracle.com unstable Release: 由于没有公钥,下列签名无法进行验证: NO_PUBKEY 2E2BCDBCB38A8516
没办法,还是继续到net上找答案,费尽心思才找到解决办法:
http://marc.abramowitz.info/archives/2007/02/28/
fixing-no_pubkey-2e2bcdbcb38a8516-error-from-oracle-debian-repository/
Folks running and Debian, Ubuntu, etc. may be aware that Oracle has a
Debian repository for Oracle Express and other open-source software.

If you weren’t aware of it and wanted to use it, here’s the magic line to
add to /etc/apt/sources.list:

deb http://oss.oracle.com/debian unstable main non-free

Recently, my apt-get updates started printing this warning:

W: GPG error: http://oss.oracle.com unstable Release: The following signatures
couldn't be verified because the public key is not available:
NO_PUBKEY 2E2BCDBCB38A8516

because Oracle is signing their packages with GPG and my system didn’t
have their GPG public key.

First, I tried:

$ gpg --keyserver subkeys.pgp.net --recv 2E2BCDBCB38A8516
gpg: requesting key B38A8516 from hkp server subkeys.pgp.net
gpgkeys: key 2E2BCDBCB38A8516 not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
$ gpg --keyserver subkeys.pgp.net --recv-keys B38A8516
gpg: requesting key B38A8516 from hkp server subkeys.pgp.net
gpgkeys: key B38A8516 not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

No dice. So I poked around a bit and found Oracle’s RPM GPG key. I wondered
if they used the sameGPG key for their Debian packages as they did for their
RPM packages. One way to find out:

$ wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle

13:50:04 (356.53 KB/s) - `RPM-GPG-KEY-oracle' saved [1744/1744]
$ sudo apt-key add RPM-GPG-KEY-oracle
OK
$ sudo aptitude update

Fetched 194B in 2s (94B/s)
Reading package lists Done

Cool, it worked!
问题终于解决了,剩下还要慢慢研究,这篇文章只是记录了自己解决这个问题的过程,全部都是从网络上搜索出来,一是由于自己以前没有玩过Linux,也没玩过oracle,当然在学校也没有学过;二来时间很紧,不允许我去从头开始,只能边学边干了。

希望这篇文章也能帮助到遇到同样问题的朋友。

posted @ 2007-08-07 09:42  万朗  阅读(784)  评论(0编辑  收藏  举报