一、首先必须装一些必要的包,这步是必须的,不然后面一大堆的错误
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
你可以通过 rpm -qa | grep XXX 或者 rpm -q XXX 来查询主机上是否有指定的RPM包。
二、伪装成RHEL 3.0,修改/etc/redhat-release文件写入:Red Hat Enterprise Linux AS release 3(Taroon)
这步也是必须的,不然连装都装不下去。
三.系统内核参数的修改优化,这步先直接跳过,以后再慢慢设置。
四、创建用户,组,目录
创建Oracle用户及组
$su - root
#groupadd dba //数据库系统管理理组
#groupadd oinstall //Oracle文件所有者的组
#useradd -g oinstall -G dba -m -s /bin/bash oracle
#passwd oracle
创建Oracle应用程序的目录
$su - root
#mkdir -p /opt/oracle/product/10.2.1/
#chown -R oracle.oinstall /opt/oracle
五.为用户oracle设置环境变量,网上很多参考资料,增加到在~/.bash_profile的开头部分:
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;
六.下载安装Oracle10g
我使用的是跟官网发布的 10201_database_linux32,因为我系统是32位的,所以下载的oracle也是32位的,把它放在oracle用户能够合法访问的位置,我是放在了/home/oracle/oracle10g
解压出来是database 文件,unzip 10201_database_linux32.zip
首先登录oracle的图形界面
$cd database
$./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。
再有其他问题,就google吧。
七.启动|关闭 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为可选项。
八.启动|关闭Oracle脚本及管理
1)配置脚本自动启动[注意本脚本需要以oracle用户来执行具体优化等深入学习后再进行升级,故后边使用alternatives来管理脚本。
-------------------------------------------------------
#!/bin/bash
# 为oracle用户编写oracle启动、关闭脚本
# 作者:huang.bin.cn@live.cn
# 日期: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了。
参考文献:http://blog.csdn.net/Huang_Bin_CN/archive/2008/12/21/3570700.aspx。