Red Hat Enterprise Linux 6.2操作系统下,安装Oracle database 11g R2。(全过程,亲历安装)
1.检查硬件要求,内存,交换区,临时文件,磁盘空间的使用情况。
查看计算机内存:
[root@localhost ~]# grep MemTotal /proc/meminfo
MemTotal: 1030888 kB
交换分区(为计算机内存大小的两倍)
[root@localhost ~]# grep SwapTotal /proc/meminfo
SwapTotal: 2064376 kB
临时文件:
[root@localhost ~]# df -hk /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 18306828 2165332 15211552 13% /
磁盘空间:
[root@localhost ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 2.1G 15G 13% /
tmpfs 504M 288K 504M 1% /dev/shm
/dev/sda1 291M 31M 246M 11% /boot
/dev/sr0 2.9G 2.9G 0 100% /media/RHEL_6.2 i386 Disc 1
2.检查操作系统要求。
3.安装linux时注意的问题。
4.检查安装Oracle11g R2所必须的包。
在终端中执行: rpm -q gcc make binutils setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel unixODBC unixODBC-devel libaio-devel sysstat
[root@localhost ~]# rpm -q gcc make binutils setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel unixODBC unixODBC-devel libaio-devel sysstat
gcc-4.4.6-3.el6.i686
make-3.81-19.el6.i686
binutils-2.20.51.0.2-5.28.el6.i686
package setarch is not installed
package compat-db is not installed
package compat-gcc is not installed
package compat-gcc-c++ is not installed
package compat-libstdc++ is not installed
package compat-libstdc++-devel is not installed
package unixODBC is not installed
package unixODBC-devel is not installed
package libaio-devel is not installed
sysstat-9.0.4-18.el6.i686
在linux安装盘中找到未安装的包,进行安装。
安装相应的包后,如下:
[root@localhost Packages]# rpm -q gcc make binutils setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel unixODBC unixODBC-devel libaio-devel sysstat
gcc-4.4.6-3.el6.i686
make-3.81-19.el6.i686
binutils-2.20.51.0.2-5.28.el6.i686
package setarch is not installed
compat-db-4.6.21-15.el6.i686
package compat-gcc is not installed
package compat-gcc-c++ is not installed
package compat-libstdc++ is not installed
package compat-libstdc++-devel is not installed
unixODBC-2.2.14-11.el6.i686
unixODBC-devel-2.2.14-11.el6.i686
libaio-devel-0.3.107-10.el6.i686
sysstat-9.0.4-18.el6.i686
这四个包显示未安装,其实在之前我们安装的包里已经安装过了,所以不用管这个。
5.系统参数和用户及目录设置
vi /etc/sysctl.conf
添加以下参数:
#user for oracle
kernel.core_uses_pid = 1
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
修改后,再运行执行操作:sysctl -p
添加用户组及用户:
#groupadd dba
#groupadd oinstall
#useradd oracle -g oinstall -G dba
#passwd oracle
#id oracle(查看当前用户的创建情况)
新建目录,并修改权限:
[root@localhost oracle]# mkdir -p /database
[root@localhost oracle]# chown -R oracle:dba /database
[root@localhost oracle]# chmod -R 755 /database
将数据库安装软件复制到/database目录下
在/home/oracle下创建目录:product/11.2.0;将数据库安装在此目录下。
[root@localhost oracle]# mkdir -p product/11.2.0
[root@localhost oracle]# chown -R oracle:dba product/11.2.0
[root@localhost oracle]# chmod -R 755 product/11.2.0
用户环境变量:
切换到oracle:su oracle
vi .bash_profile修改文件:
内容如下:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export TMP=/tmp
export TMPDIR=$tmp
export ORACLE_BASE=/home/oracle/product/11.2.0
export ORACLE_HOME=$ORACLE_BASE/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH;
export PATH=$ORACLE_HOME/bin:$PATH
#export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPRTH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
#export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
#export ORA_NLS10=$ORACLE_HOME/nls/data
#unset USERNAME
#umask 022
(更新中)