Oracle在gentoo linux下安装

很久以前装的,回顾下!

1.OS:Gentoo-linux-2.6.23-rc5
Oracle:Oracle Database 10g Release 2 (10.2.0.1.0) for Linux x86

下载地址  (Size 668,734,007 bytes) (cksum - 2737423041)

2.使用管理员账户建立Oracle用户和dba,oinstall用户组

groupadd dba     
groupadd oinstall   
useradd -c "Oracle Software Owner" -g oinstall -G dba -d /opt/oracle oracle
passwd oracle

3.建造Oracle安装根目录,并且修改权限
mkdir -p /opt/oracle/product/10.2.0.1
chown -R oracle:oinstall /opt/oracle
chmod 755 /opt/oracle/

4.设置安装的环境变量,创造编辑/etc/env.d/99oracle文件。
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/10.2.0.1
ORACLE_SID='YOURSID'
ORACLE_TERM=xterm
ORACLE_OWNER=oracle
TNS_ADMIN=/opt/oracle/product/10.2.0.1/network/admin
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
ORA_NLS10=/opt/oracle/product/10.2.0.1/nls/data
CLASSPATH=/opt/oracle/product/10.2.0.1/jdbc/lib/classes12.zip
LD_LIBRARY_PATH=/opt/oracle/product/10.2.0.1/lib:/opt/oracle/product/10.2.0.1/lib32
DISABLE_HUGETLBFS=1
PATH=/opt/oracle/product/10.2.0.1/bin
ROOTPATH=/opt/oracle/product/10.2.0.1/bin
LDPATH=/opt/oracle/product/10.2.0.1/lib:/opt/oracle/product/10.2.0.1/lib32
TZ=GMT

注意:其中 的YOURSID是传剑数据库的名字

我的设置为我这台机器的hostname

5.更新环境变量
env-update
source /etc/profile

6.检查网络及相关设置是否正确

7.安装Oracle依赖的软件包
emerge -a =sys-libs/libstdc++-v3-3.3*
emerge -a dev-java/sun-jdk
emerge -a libaio
emerge -a logger
ln -s /usr/lib/libstdc++-v3/libstdc++.so.5 /usr/lib

其中sun-jdk我不是很清楚是不是必须装,感觉Oracle应该自带的有!那位朋友知道可以告诉我

8.写自动启动的脚本,有三个
/etc/init.d/ora.console

#!/sbin/runscript
# ----------------------------------------------------------------------
# File:    /etc/init.d/ora.console   
# Purpose:  Startup Oracle Enterprise Manager DB Console and ISQL
# ----------------------------------------------------------------------

depend() ...{
    need net
    after ora.listener
}

start() ...{
    source /etc/profile.env
    ebegin "Start Oracle Enterprise Manager DB Console"
    /bin/su $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole"
    /bin/su $ORACLE_OWNER -c "$ORACLE_HOME/bin/isqlplusctl start"
    eend $? "Failed to start Oracle Enterprise Manager DB Console."
}

stop() ...{
    source /etc/profile.env
    ebegin "Stopping Oracle Enterprise Manager DB Console"
    /bin/su $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
    /bin/su $ORACLE_OWNER -c "$ORACLE_HOME/bin/isqlplusctl stop"
    eend $? "Failed to stop Oracle Enterprise Manager DB Console."
}
/etc/init.d/ora.database



#!/sbin/runscript
# ----------------------------------------------------------------------
# File:    /etc/init.d/ora.database
# Purpose:  Startup Oracle Database(s) defined in /etc/oratab
# ----------------------------------------------------------------------

depend()...{
need net  hostname clock
}

start() ...{

    source /etc/profile.env

    if [ ! -f $ORACLE_HOME/bin/dbstart ]
    then
         echo "Oracle not started (no dbstart script)"
         return 1
    fi

    ebegin "Starting Oracle"

    /bin/su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbstart
    eend $? "Failed to start Oracle."
}

stop() ...{
    source /etc/profile.env
    if [ ! -f $ORACLE_HOME/bin/dbshut ]
    then
            echo "Oracle not stopped (no dbshut script)"
            return 1
    fi

    ebegin "Stopping Oracle"
    /bin/su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut
    eend $? "Failed to stop Oracle."
}


/etc/init.d/listener



depend() ...{
    need net
    after ora.database
}

start() ...{
    source /etc/profile.env
    ebegin "Start Oracle Listeners"
    /bin/su $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start LISTENER"
    eend $? "Failed to start Oracle Listeners."
}

stop() ...{
    source /etc/profile.env
    ebegin "Stopping Oracle Listeners"
    export ORACLE_OWNER=oracle;
    /bin/su $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop LISTENER"
    eend $? "Failed to stop Oracle Listeners."
}

9.启动x环境,注意已oracle用户,开始正式安装。
   cd ~
   $ mkdir /tmp/oratmp && chown oracle:oinstall /tmp/oratmp && chmod 777 /tmp/oratmp
   $ export TEMP=/tmp/oratmp
   $ export TMPDIR=/tmp/oratmp

   unzip 10201_database_linux32.zip
   ./database/runInstaller -ignoreSysPrereqs

10,安装的过程很简单,不多述了。安装过后手动启动oracle服务。
   /etc/init.d/ora.console start
   /etc/init.d/ora.database start
   /etc/init.d/ora.listener start
   /opt/oracle/product/10.2.0.1/bin/isqlplusctl   

11.OK。安装完毕!