Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1188571
  • 博文数量: 89
  • 博客积分: 10546
  • 博客等级: 上将
  • 技术积分: 1510
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-16 01:24
文章分类

全部博文(89)

文章存档

2012年(7)

2011年(4)

2010年(5)

2009年(52)

2008年(21)

分类: Oracle

2008-11-10 16:23:03

Oracle XE 是Oracle 提供一种免费的简易的版本,它可以用于商业用途而不需要支付授权费用,但有一个限制,数据库大小被限制在4G之内。
从安装程序上看,Oracle 一改过去的作风,使用操作系统内置的方式的进行,而没有使用Oracle 传统的Universal Installer。
在 Linux 下安装Oracle 曾经只是少数 Linux用户能够胜任的事,现在变得简单起来。
从Oracle 官方网站下载Oracle XE 10g(为什么现在还没有11g呢?),网站地址是,。
Linux 版本提供两种当前发行版本最流行的格式,rpm 和deb,rpm 版本可以安装在redhat 版本中,deb用于是用于Debian ,特别是Ubuntu发行版本。
对于中文用户,需要多语言环境的支持,请下载oracle-xe-univ的版本。

[hantsy@localhost Packages]$ sudo yum localinstall --nogpgcheck oracle-xe-univ-10.2.0.1-1.0.i386.rpm


第一次使用前需要进行配置。

[hantsy@localhost Packages]$ sudo /sbin/service 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 to accept the defaults.
Ctrl-C will abort.

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


Oracle Application Express这里主要为数据库提供一个web图形操作界面,这里端口保持默认,直接按Enter。

Specify a port that will be used for the database listener [1521]:


指定数据库Oracle XE的监听器端口,这里使用默认端口,1521,直接按下Enter。
 

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:


设置SYS 和SYSTEM 密码。

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


是否开机就启动数据库,默认为是,如果保持默认,直接按Enter 。
配置完毕,Oracle XE 会自动启动。
配置生成的结果,最终保存在文件/etc/sysconfig/oracle-xe中。

如果你不想在机器启动时,启动数据库。
将oracle-xe 服务关闭。

[hantsy@localhost Packages]$ sudo /sbin/chkconfig --level 5 oracle-xe off


如果在上面配置数据库,选了Y来默认启动数据库。重启之后,却发现,即使关掉 oracle-xe 服务,Oracle 数据库依然会启动。
这不是我想要的结果。

[hantsy@localhost Packages]$ sudo /sbin/service oracle-xe disable


它会修改之前配置的开机时启动数据库的选项,它最终是修改配置文件/etc/sysconfig/oracle-xe中的ORACLE_DBENABLED值,上面的命令执行值其变成false。
再次重启机器后,发现Oracle 开机时没有启动。
这么说来,决定Oracle 是否在开机启动取决于
/etc/sysconfig/oracle-xe中的ORACLE_DBENABLED值,而关闭系统服务oracle-xe 的设置无效。非常不解Oracle 为什么这么做。

现在开机不启动Oracle 的目的总算达到了,当我们想手动启动Oracle ,执行下面命令。

[hantsy@localhost Packages]$ sudo /sbin/service oracle-xe start


问题又来了,Oracle XE 根本没有启动。
打开/etc/init.d/oracle-xe文件,可以看到,执行start 和stop 会检测Oracle的系统配置文件/etc/sysconfig/oracle-xe,如果
ORACLE_DBENABLED的值是false,则程序退出。
难道非得每次都把ORACLE_DBENABLED的值改成true,再去执行启动操作命令吗?
后来在Oracle的官方论坛上看到一个折中的方案,修改/etc/init.d/oracle-xe,增加两个额外的启动命令选项,用于手动操作。

  start_manual)
       ORACLE_DBENABLED=true
       start
       ;;  
  stop_manual)
       ORACLE_DBENABLED=true
       stop
       ;;  


这样就可以使用sudo /sbin/service start_manual|stop_manual来启动和停止Oracle XE服务。
另外,如果想把Oracle的一些环境变量加入到系统中,只要/etc/profie.d目录下添加两个文件的链接即可。

[hantsy@localhost Packages]$ sudo ln -sf /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle-env.sh /etc/profile.d/

[hantsy@localhost Packages]$ sudo ln -sf /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle-env.csh /etc/profile.d/













阅读(2174) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~