本文当由本人整理发布,仅供各位同仁参考使用,错误之处请批评指正,不胜感激!

以下操作除系统配置外,有关Oracle数据库操作的用户都为oracle用户,否则为root用户。
在oracle登录条件下,使用sudo命令执行root命令。

一、系统包的安装和补丁

rpm -Uvh binutils-*.rpm
rpm -Uvh make-*.rpm
rpm -Uvh sysstat-*.rpm
rpm -Uvh openmotif*.rpm
rpm -Uvh compat-db-*.rpm
rpm -Uvh compat-gcc-34-*.rpm
rpm -Uvh compat-gcc-34-c++-*.rpm
rpm -Uvh compat-libstdc++-33-*.rpm

rpm -Uvh glibc-headers-*.rpm
rpm -Uvh glibc-devel-*.rpm
rpm -Uvh glibc-common-*.rpm
rpm -Uvh glibc-*.i686.rpm
rpm -Uvh libXp-*.rpm
rpm -Uvh libaio-*.rpm
rpm -Uvh libstdc++-*.rpm
rpm -Uvh libstdc++-devel-*.rpm
rpm -Uvh gcc-*.rpm
rpm -Uvh gcc-c++-*.rpm
rpm -Uvh unixODBC-*.rpm
rpm -Uvh unixODBC-devel-*.rpm


二、创建用户和组

$ groupadd oinstall
$ groupadd dba
$ useradd -g oinstall -G dba oracle
$ passwd oracle
------------------------------------------------------------------
三、系统配置文件的修改

1.增加以下内容到控制文件/etc/sysctl.conf行末
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144

运行下面的命令使得内核参数生效
$ /sbin/sysctl -p

2.增加以下内容到资源限定文件/etc/security/limits.conf行末
oracle  soft  nproc  2047
oracle hard  nproc  16384
oracle soft  nofile  1024
oracle hard  nofile  65536

3.增加以下内容到登录文件/etc/pam.d/login行末
session required /lib/security/pam_limits.so
session required pam_limits.so

4.增加以下内容到用户配置文件/etc/profile
if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
  ulimit -p 16384
  ulimit -n 65536
 else
  ulimit -u 16384 -n 65536
 fi
fi

5.进入用户oracle更改个人登录配置文件.bash_profile
$ su - oracle
$ vi .bash_profile
增加以下内容
export TEMP=/tmp
export TEMPDIR=$TEMP
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db10g
export PATH=$PATH:/usr/bin:/usr/sbin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:

$ORACLE_HOME/network/jlib
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_SID=ocp
export LD_ASSUME_KERNEL=2.6.9
export LC_CTYPE=en.UTF-8
#export LANG=en_US.UTF-8
#export NLS_LANG="Simplified Chinese_china".ZHS16GBK

运行下面的命令使得配置文件参数生效
$ source .bash_profile
-------------------------------------------------------------------
四、准备目录和安装介质

1.目录准备
$ mkdir -p /opt/oracle/db10g
$ chown -R oracle:oinstall /opt/oracle
$ chmod -R 775 /opt/oracle

2.安装介质
首先用虚拟机光盘的方式,装载10201_database_linux32.iso,为系统/media目录下。
然后再复制database至/home/oracle/database,
最后改变所属和权限。
$ chown -R oracle.oinstall /home/oracle/database
$ chmod -R 755 /home/oracle/database

--------------------------------------------------------------------
五、确保消除安装前系统其他环境因素
1.确定关闭防火墙
root权限下执行
$ chkconfig iptables off
$ service iptables stop
或进入图形操作界面关闭防火墙

2.关闭安全设置
root权限下执行
$ vi /etc/selinux/config
更改SELINUX=disabled
$ /usr/sbin/setenforce 0
或进入图形操作界面关闭SELINUX

3.获取Oracle安装程序10201_database_linux32.zip
解压:unzip 10201_database_linux32.zip (Linux root用户)

4.让Oracle10g支持RHEL5.4版本的安装
oracle权限下
$ cd /home/oracle/database/install
$ vi oraparam.ini

增加支持5版本的内容,
把以下
#begin
[Certified Versions]
Linux=redhat-3,SuSE-9,redhat-4,UnitedLinux-1.0,asianux-1,asianux-2
#end//
改为
#begin
[Certified Versions]
Linux=redhat-3,SuSE-9,redhat-4,redhat-5,UnitedLinux-1.0,asianux-1,asianux-2
#end//

把以下
#begin
[Linux-redhat-4.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256

[Linux-asianux-1.0-optional]
#end//
改为
#begin
[Linux-redhat-4.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256

[Linux-redhat-5.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256

[Linux-asianux-1.0-optional]
#end//

4.设置网络要求
$ vi /etc/hosts
如果下面所示没有,则增加
127.0.0.1 localhost localhost.localdomain
------------------------------------------------------------------------
六、安装开始
root权限下执行
$ xhost +
oracle权限下
$ export DISPLAY=:0.0

以oracle身份进入安装目录
$ cd /home/oracle/database
$ ./runInstaller
------------------------------------------------------------------------
安装完成别忘按提示执行
$ORACLE_BASE/oraInventory/orainstRoot.sh
【/opt/oracle/oraInventory/orainstRoot.sh】
和$ORACLE_HOME/root.sh。
【/opt/oracle/product/10.2.0.1/db10g/root.sh】

http://oratest.com.cn:5560/isqlplus
http://oratest.com.cn:5560/isqlplus/dba

如果配置了Enterprise Manager,记住登录端口,
如果配置了iSQL*Plus访问,也牢记登录端口。
--------------------------------------------------------------------
七、建立实例
以Oracle用户执行命令:dbca
图形界面建实例
http://oratest.com.cn:1158/em
--------------------------------------------------------------------
八、验证安装
如果实例名为xxxx,则
执行ps -ef|grep smon,可见ora_smon_xxxx进程。

$ export ORACLE_SID=xxxx
$ sqlplus / as sysdba
SQL>show parameter name

九、其他问题

1.数据库实例开关命令
启动命令
SQL>startup;
---如果实例启动有什么问题,请检查spfile,环境变量等是否正确(环境变量配置文件:.bash_profile)
关闭命令
SQL>shutdown immediate;

2.监听器(EM或iSQL*PLUS,须启动)
启动监听
$ lsnrctl start
停止监听
$ lsnrctl stop

3.Enterprise Manager
启动命令
$ $ORACLE_HOME/bin/emctl start dbconsole
emctl start dbconsole
停止命令
$ $ORACLE_HOME/bin/emctl stop dbconsole
emctl stop dbconsole

登录Enterprise Manager
在浏览器中登录,输入http://xxx.xxx.xx.xx:NNNN/em
NNNN代表端口号,与安装数据库决定,如果是sys用户,连接为:SYSDBA。

4.iSQL*Plus访问
启动iSQL*Plus
$ isqlplusctl start
停止iSQL*Plus
$ isqlplusctl stop
登录iSQL*Plus
在浏览器中,输入:http://xxx.xxx.xx.xx:NNNN/isqlplus
NNNN代表端口号,与安装数据库决定。

==========================================================================================
常见问题:
1.Checking Network Configuration requirements ...
Check complete. The overall result of this check is: Failed <<<<
Problem: The install has detected that the primary IP address of the system is DHCP-assigned.
Recommendation: Oracle supports installations on systems with
DHCP-assigned public IP addresses. However, the primary network
interface on the system should be configured with a static IP address in
order for the Oracle Software to function properly. See the
Installation Guide for more details on installing the software on
systems configured with DHCP
DHCP是动态IP地址分配协议。ORACLE安装时,检测到你网卡的IP地址是通过DHCP自动获取的,而不是静态的。你

可以给eth0配置一个固定IP地址,然后再安装ORACLE看看。

2.我的网卡不是DHCP分配的,我在netconfig中指定IP。
错误发生在:product-specific prerequisite checks
配置主机名不要用LOCALHOST
另外设置HOSTS即可解决。

3.在linux系统中用Oracle帐号执行DBCA或其他JAVA图形界面程序时,报错:
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Error: Can't open display: :0.0

解决办法:用root登陆,在shell中运行
xhost local:oracle
non-network local connections being added to access control list
在切换到Oracle用户执行图形界面任务就可以了
man xhost中有这样一段
       A complete name has the syntax &lsquo;&lsquo;family:name&rsquo;&rsquo; where the families are as follows:

       inet      Internet host (IPv4)
       inet6     Internet host (IPv6)
       dnet      DECnet host
       nis       Secure RPC network name
       krb       Kerberos V5 principal
       local     contains only one name, the empty string
       si        Server Interpreted

4.Oracle10g EM乱码之终极解决
在 $ORACLE_HOME/jdk/jre/lib 和 $ORACLE_HOME/jre/1.4.2/lib目录下都有多种字符集字体配置文件:
[oracle@RHEL ~]$ cd $ORACLE_HOME/jdk/jre/lib
[oracle@RHEL lib]$ ls font*zh_CN*
font.properties.zh_CN.Redhat     font.properties.zh_CN.Sun
font.properties.zh_CN.Redhat2.1  font.properties.zh_CN_UTF8.Sun
[oracle@RHEL lib]$ cd $ORACLE_HOME/jre/1.4.2/lib/
[oracle@RHEL lib]$ ls font*zh_CN*
font.properties.zh_CN.Redhat  font.properties.zh_CN.Redhat2.1 
font.properties.zh_CN.Sun  font.properties.zh_CN_UTF8.Sun 
我们只要用合适的中文字符集文件替换缺省文件即可,我选择使用font.properties.zh_CN.Sun来替换缺省字体定

义文件:
cd $ORACLE_HOME/jdk/jre/lib
cd $ORACLE_HOME/jre/1.4.2/lib/

[oracle@RHEL lib]$ cp font.properties font.properties.bak 
[oracle@RHEL lib]$ cp font.properties.zh_CN.Sun font.properties
 修改字体:切记查看系统路径里面是是否有字体
[oracle@RHEL lib]$ vim font.properties
------------------------------------------------------------------
#filename.-misc-fzsongti-medium-r-normal--*-%d-*-*-p-*-gbk-

0=/usr/X11R6/lib/X11/fonts/truetype/songti_gb.ttf
filename.-misc-fzsongti-medium-r-normal--*-%d-*-*-p-*-gbk-

0=/usr/share/fonts/chinese/TrueType/uming.ttf
# appendedfontpath=/usr/X11R6/lib/X11/fonts/truetype
appendedfontpath=/usr/share/fonts/chinese/TrueType
------------------------------------------------------------------
替换之后需要清理一下Cache,重启EM即可.
Cache路径通常位于: 

$ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/p_w_picpaths/cache/zhs/
执行命令:
rm -rf $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/p_w_picpaths/cache/zhs/*
清除所有gif文件即可.

然后重新启动EM:
[oracle@RHEL lib]$ emctl stop dbconsole
TZ set to UTC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://RHEL.smnpc.com:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
 ...  Stopped.

[oracle@RHEL lib]$ emctl start dbconsole
TZ set to UTC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://RHEL.smnpc.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ........................ started.
------------------------------------------------------------------
Logs are generated in directory /usr/app/oracle/product/10.2.0/db_1/RHEL.smnpc.com_orcl/sysman/log

再次重启EM,登录。OMG,正常了:

====================================================================================
Oracle 10g管理其他命令
查看实例是否启动: