Fedora 10成功安装Oracle 10g

--------------------------------------------------------
主机:ThinkPad T400
内存:1024 MB
交换分区:2048MB
系统:Fedora 10
内核:2.6.27.7-134.fc10.i686
--------------------------------------------------------
1.硬件需求:
  内存要求至少512MB;交换分区至少1G或者是内存的两倍;/tmp目录至少有400M; 硬盘空间至少1.5G,但是最好大于3.5G。
   
2.软件需求
  1)Oracle官方推荐的RPM包,其实并不一定都需要达到,以下是我的F10中官方推荐包的安装情况。(我在安装好ATI之前,相同的软件环境却并不能够运行。而在安装好ATI显卡之后,一切才有了基础。万恶的ATI。)
    make-3.81-14.fc10.i386
    gcc-4.3.2-7.i386
    glibc-2.9-3.i686
    glibc-devel-2.9-3.i386
    compat-db45-4.5.20-5.fc10.i386
    compat-gcc-34-3.4.6-9.i386
    compat-gcc-34-c++-3.4.6-9.i386
    compat-libstdc++-33-3.2.3-64.i386
    gnome-libs-1.4.2-10.fc10.i386
    libaio-devel-0.3.107-4.fc10.i386
    libaio-0.3.107-4.fc10.i386
    libXp-1.0.0-11.fc9.i386
   
  2)提示:
    你可以通过 rpm -qa | grep XXX 或者 rpm -q XXX 来查询主机上是否有指定的RPM包
    或者你可以通过yum extender图形工具来查找,安装如下:#yum install yumex
   
  3)伪装成RHEL 3.0,修改/etc/redhat-release文件写入:Red Hat Enterprise Linux AS release 3(Taroon)
    
3.网上很多资料上都写要配置内核参数来优化系统性能,不过我发觉更多的资料上写的都不是针对本机的实际数据,于是就没有弄呵呵。最后证明这步对结果并没有什么影响。

4.创建Oracle用户及组
  $su - root
  #groupadd dba //数据库系统管理理组
  #groupadd oinstall //Oracle文件所有者的组
  #useradd -g oinstall -G dba -m -s /bin/bash oracle
  #passwd oracle

5.创建Oracle应用程序的目录
  $su - root
  #mkdir -p /opt/oracle/product/10.1.0/
  #chown -R oracle.oinstall /opt/oracle

6.为用户oracle设置环境变量,我是照着很多参考资料上写的脚本来修改的,我增加到在~/.bash_profile的开头部分:
--------------------------------------
# 设置oracle数据库相关环境变量
# 日期:2008/12/20

export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1
export ORACLE_SID=ORCL
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$PATH:/usr/sbin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$CLASSPATH;
# 设置结束
--------------------------------------

7.安装Oracle10g
  我使用的是跟官网发布的 ship.db.lnx32.cpio.gz,把它放在oracle用户能够合法访问的位置,我是放在了/home/oracle/oracle10g/ship.db.lnx32.cpio.gz。
  首先切换到oracle用户:$su - oracle
  $cd ~/oracle10g
  $gzip zxvf ship.db.lnx32.cpio.gz //解压该文件,生成ship_db_lnx32_10103.cpio
  $cpio -idmv < ship_db_lnx32_10103.cpio //生成Disk1,即Oracle安装目录。
  $cd Disk1/install
  $./runInstaller
 
  注意:./runInstaller很有可能会有一些错误,我碰到过一些异常,其中有一种是
    No protocol specified
    Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
    这种异常可以通过这种方法解决,在运行./runInstaller之前,用root用户运行#xhost + ,然后再使用oracle用户$./runInstaller,注意这种情况在安装完成之后,使用#xhost - 改变设置,否则会带来安全隐患。

  提示:如果安装向导界面乱码,可以在$./runInstaller之前$unset LANG;unset LANGUAGE 把语言环境取消这样会使用英语为默认环境安装Oracle10g。
  推荐使用$export LANG=en_US.UTF-8显式地赋予英语环境。两种方法我都试过,都是可用的。

  在安装过程中,注意自定义好安装的时候的值和环境变量中的值保持一致。其中特别注意安装目录:ORACLE_HOME;全局数据库名:ORACLE_SID。同时最好让Global Database Name(全局数据库名)和SID保持一致都为ORACLE_SID的值。
  我把字符集设成:Unicode standard UTF-8 AL32UTF8,同时也把Create database with sample schemas复选框选上了让它生成一个初始的Sample。
 
  根据界面提示,安装过程会提示用户两次以root权限执行一些文件,第一个是/opt/oracle/oraInventory/orainstRoot.sh,~~第二个是/opt/oracle/product/10.1.0/root.sh,这个家伙害我重装了两回。郁闷。以下是我在F10中执行root.sh的一些经验:注意屏幕输出,在执行到:
  Adding daemons to inittab
 Expecting the CRS daemons to be up within 600 seconds.
时,请开一终端以root执行#/etc/init.d/init.cssd run &
这样就可以很快通过这个测试然后完成安装。

8.启动|关闭 Oracle
    (1)监听器--lsnrctl( listener control) 
    a.启动: $lsnrctl start
    b.关闭: $lsnrctl stop

    (2)数据库
      (1)$sqlplus /nolog
      (2)SQL> conn /as sysdba
      a.启动:SQL>startup
      b.关闭:SQL>shutdown imediate|abort

    (3)控制台--emctl(EM control)  --  使用web访问:http://127.0.0.1:1158/em/
      a.启动:$emctl start dbconsole
      b.关闭:$emctl stop dbconsole

    (4)isqlplus--isqlplusctl(Internet sqlplus control) -- 使用web访问:http://127.0.0.1:5560/isqlplus/
      a.启动:$isqlplusctl start
      b.关闭:$isqlplusctl stop
 
  其中3、4为可选项。

9.启动|关闭Oracle脚本及管理
  1)配置脚本自动启动[注意本脚本需要以oracle用户来执行。]--注:由于对shell脚本才有些了解,故写得很难看。具体优化等深入学习后再进行升级,故后边使用alternatives来管理脚本。
-------------------------------------------------------
#!/bin/bash
# 为oracle用户编写oracle启动、关闭脚本
# 日期:2008/12/20
# 版本:1.0

case $1 in
begin)
    echo "******** Begin the Oracle 10g! ********"
    echo "******** Beginning the lsnrctl ********"
    lsnrctl start

    echo "******** Beginning the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
startup
EOF
    echo "Complete(begin)!"
    ;;
end)
    echo "******** End the Oracle 10g! ********"
    echo "******** Endding the lsnrctl ********"
    lsnrctl stop

    echo "******** Endding the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
shutdown immediate
EOF
    echo "Complete(end)!"
    ;;
rebegin)
    echo "******** Rebegin the Oracle 10g! ********"
    echo "******** Endding the lsnrctl ********"
    lsnrctl stop

    echo "******** Endding the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
shutdown immediate
EOF
    echo "******** Beginning the lsnrctl ********"
    lsnrctl start

    echo "******** Beginning the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
startup
EOF
    echo "Complete(rebegin)!"
    ;;
start)
    echo "******** Start the Oracle 10g! ********"
    echo "******** Startting the lsnrctl ********"
    lsnrctl start

    echo "******** Startting the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
startup
EOF

    echo "******** Startting the emctl ********"
    emctl start dbconsole

    echo "******** Startting the isqlplusctrl  ********"
    isqlplusctl start

    echo "Complete(start)!"
    ;;
stop)
    echo "******** Stop the Oracle 10g! ********"
    echo "******** Stopping the lsnrctl ********"
    lsnrctl stop

    echo "******** Stopping the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
shutdown immediate
EOF

    echo "******** Stopping the emctl ********"
    emctl stop dbconsole

    echo "******** Stopping the isqlplusctrl  ********"
    isqlplusctl stop

    echo "Complete(stop)!"
    ;;
restart)
    echo "******** Restart the Oracle 10g! ********"
    echo "******** Stopping the lsnrctl ********"
    lsnrctl stop

    echo "******** Stopping the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
shutdown abort
EOF

    echo "******** Stopping the emctl ********"
    emctl stop dbconsole

    echo "******** Stopping the isqlplusctrl  ********"
    isqlplusctl stop

    echo "******** Startting the lsnrctl ********"
    lsnrctl start

    echo "******** Startting the DB ********"
    sqlplus /nolog <<EOF
conn / as sysdba
startup
EOF

    echo "******** Startting the emctl ********"
    emctl start dbconsole

    echo "******** Startting the isqlplusctrl  ********"
    isqlplusctl start

    echo "Complete(restart)!"
    ;;
*)
    echo "Usage {begin|end|rebegin|start|stop|restart}"
    echo "1.begin|end|rebegin for lsnrctrl&db service"
    echo "2.start|stop|restart for lsnrctrl&db&emctrl&isqlplusctrl service"
    exit 1
esac
-------------------------------------------------------
  2)[可选]使用alternatives来管理脚本和链接
    我把脚本放在/opt/scripts/hbcn.oracle_1.0.sh,把链接放在/usr/local/bin/hbcn.oracle
    安装:#alternatives --install /usr/local/bin/hbcn.oracle hbcn.oracle /opt/scripts/hbcn.oracle_1.0.sh 1
    这样oracle就可以通过hbcn.oracle {begin|end|rebegin|start|stop|restart}来直接启动/关闭oracle了。

具体安装过程参考了网上很多文章也记不清楚具体有哪些了,谢谢大家。
   
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值